- format->item_id (message, "",
- notmuch_message_get_filename (message));
+ filenames = notmuch_message_get_filenames (message);
+
+ for (;
+ notmuch_filenames_valid (filenames);
+ notmuch_filenames_move_to_next (filenames))
+ {
+ if (! first_message)
+ fputs (format->item_sep, stdout);
+
+ format->item_id (message, "",
+ notmuch_filenames_get (filenames));
+
+ first_message = 0;
+ }
+
+ notmuch_filenames_destroy( filenames );
+