]> git.notmuchmail.org Git - notmuch/blobdiff - show-message.c
pass entire format structure to various show_message functions
[notmuch] / show-message.c
index c206bddc0371d4d6bdebbb9936b2c2531fb71aa0..44ab8194eed78f31e74c323d2af536bcc971ee68 100644 (file)
@@ -25,8 +25,7 @@
 static void
 show_message_part (GMimeObject *part,
                   int *part_count,
-                  void (*show_part) (GMimeObject *part, int *part_count, int first),
-                  void (*show_part_end) (GMimeObject *part),
+                  const notmuch_show_format_t *format,
                   int first)
 {
     if (GMIME_IS_MULTIPART (part)) {
@@ -34,15 +33,15 @@ show_message_part (GMimeObject *part,
        int i;
 
        *part_count = *part_count + 1;
-       (*show_part) (part, part_count, first);
+       format->part (part, part_count, first);
 
        for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {
            show_message_part (g_mime_multipart_get_part (multipart, i),
-                              part_count, show_part, show_part_end, i == 0);
+                              part_count, format, i == 0);
        }
 
-       if (show_part_end)
-           (*show_part_end) (part);
+       if (format->part_end)
+           format->part_end (part);
 
        return;
     }
@@ -53,7 +52,7 @@ show_message_part (GMimeObject *part,
        mime_message = g_mime_message_part_get_message (GMIME_MESSAGE_PART (part));
 
        show_message_part (g_mime_message_get_mime_part (mime_message),
-                          part_count, show_part, show_part_end, first);
+                          part_count, format, first);
 
        return;
     }
@@ -66,15 +65,14 @@ show_message_part (GMimeObject *part,
 
     *part_count = *part_count + 1;
 
-    (*show_part) (part, part_count, first);
-    if (show_part_end)
-       (*show_part_end) (part);
+    format->part (part, part_count, first);
+    if (format->part_end)
+       format->part_end (part);
 }
 
 notmuch_status_t
 show_message_body (const char *filename,
-                  void (*show_part) (GMimeObject *part, int *part_count, int first),
-                  void (*show_part_end) (GMimeObject *part))
+                  const notmuch_show_format_t *format)
 {
     GMimeStream *stream = NULL;
     GMimeParser *parser = NULL;
@@ -98,7 +96,9 @@ show_message_body (const char *filename,
     mime_message = g_mime_parser_construct_message (parser);
 
     show_message_part (g_mime_message_get_mime_part (mime_message),
-                      &part_count, show_part, show_part_end, TRUE);
+                      &part_count,
+                      format,
+                      TRUE);
 
   DONE:
     if (mime_message)