static void each_part (MuMsg *msg, MuMsgPart *part, GSList **attlist) { char *att, *cachefile; GError *err; /* exclude things that don't look like proper attachments, * unless they're images */ if (!mu_msg_part_maybe_attachment(part)) return; err = NULL; cachefile = mu_msg_part_save_temp (msg, MU_MSG_OPTION_OVERWRITE, part->index, &err); if (!cachefile) { print_and_clear_g_error (&err); return; } att = g_strdup_printf ( "(:file-name \"%s\" :mime-type \"%s/%s\")", cachefile, part->type, part->subtype); *attlist = g_slist_append (*attlist, att); g_free (cachefile); }
static void each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) { char *att, *cachefile, *encfile; GError *err; /* exclude things that don't look like proper attachments, * unless they're images */ if (!mu_msg_part_maybe_attachment(part)) return; err = NULL; cachefile = mu_msg_part_save_temp (msg, pinfo->opts|MU_MSG_OPTION_OVERWRITE, part->index, &err); if (!cachefile) { print_and_clear_g_error (&err); return; } encfile = mu_str_escape_c_literal(cachefile, TRUE); g_free (cachefile); att = g_strdup_printf ( "(:file-name %s :mime-type \"%s/%s\")", encfile, part->type, part->subtype); pinfo->attlist = g_slist_append (pinfo->attlist, att); g_free (encfile); }