static void save_part_if (MuMsg *msg, MuMsgPart *part, SaveData *sd) { gchar *filepath; gboolean rv; GError *err; MuMsgOptions msgopts; if (ignore_part (msg, part, sd)) return; rv = FALSE; filepath = NULL; err = NULL; msgopts = mu_config_get_msg_options (sd->opts); filepath = mu_msg_part_get_path (msg, msgopts, sd->opts->targetdir, part->index, &err); if (!filepath) goto exit; if (!mu_msg_part_save (msg, msgopts, filepath, part->index, &err)) goto exit; if (sd->opts->play) rv = mu_util_play (filepath, TRUE, FALSE, &err); else rv = TRUE; ++sd->saved_num; exit: if (err) g_warning ("error saving MIME part: %s", err->message); g_free (filepath); g_clear_error (&err); sd->result = rv; }
static void save_part_if (MuMsg *msg, MuMsgPart *part, SaveData *sd) { gchar *filepath; gboolean rv; GError *err; if (ignore_part (msg, part, sd)) return; rv = FALSE; filepath = NULL; err = NULL; filepath = mu_msg_part_filepath (msg, sd->targetdir, part->index, &err); if (!filepath) { g_warning ("failed to get file path: %s", err&&err->message ? err->message : "error"); g_clear_error (&err); goto leave; } if (!mu_msg_part_save (msg, filepath, part->index, sd->overwrite, FALSE, &err)) { g_warning ("failed to save MIME-part: %s", err&&err->message ? err->message : "error"); g_clear_error (&err); goto leave; } if (sd->play && !mu_util_play (filepath, TRUE, FALSE)) goto leave; rv = TRUE; ++sd->saved_num; leave: sd->result = rv; g_free (filepath); }