* refactor: MU_MSG_PART_OPTION -> MU_MSG_OPTION and related changes

This commit is contained in:
djcb
2012-07-18 16:22:10 +03:00
parent b36d684b81
commit acfabfdf4b
13 changed files with 87 additions and 68 deletions

View File

@ -244,7 +244,7 @@ save_certain_parts (MuMsg *msg, gboolean attachments_only,
mu_msg_part_foreach (msg,
(MuMsgPartForeachFunc)save_part_if,
&sd, MU_MSG_PART_OPTION_NONE);
&sd, MU_MSG_OPTION_NONE);
if (sd.saved_num == 0) {
g_warning ("no %s extracted from this message",
@ -347,7 +347,7 @@ show_parts (const char* path, MuConfig *opts, GError **err)
mu_msg_part_foreach
(msg, (MuMsgPartForeachFunc)each_part_show,
GUINT_TO_POINTER(!opts->nocolor),
MU_MSG_PART_OPTION_NONE);
MU_MSG_OPTION_NONE);
mu_msg_unref (msg);

View File

@ -493,7 +493,7 @@ output_sexp (MuMsg *msg, MuMsgIter *iter, MuConfig *opts, GError **err)
ti = opts->threads ? mu_msg_iter_get_thread_info (iter) : NULL;
sexp = mu_msg_to_sexp (msg, mu_msg_iter_get_docid (iter),
ti, TRUE, FALSE);
ti, MU_MSG_OPTION_HEADERS_ONLY);
fputs (sexp, stdout);
g_free (sexp);

View File

@ -453,7 +453,7 @@ include_attachments (MuMsg *msg)
attlist = NULL;
mu_msg_part_foreach (msg, (MuMsgPartForeachFunc)each_part,
&attlist, MU_MSG_PART_OPTION_NONE);
&attlist, MU_MSG_OPTION_NONE);
gstr = g_string_sized_new (512);
gstr = g_string_append_c (gstr, '(');
@ -518,7 +518,8 @@ cmd_compose (ServerContext *ctx, GSList *args, GError **err)
print_and_clear_g_error (err);
return MU_OK;
}
sexp = mu_msg_to_sexp (msg, atoi(docidstr), NULL, FALSE, FALSE);
sexp = mu_msg_to_sexp (msg, atoi(docidstr), NULL,
MU_MSG_OPTION_NONE);
atts = (ctype == FORWARD) ? include_attachments (msg) : NULL;
mu_msg_unref (msg);
} else
@ -655,7 +656,7 @@ print_sexps (MuMsgIter *iter, gboolean threads, unsigned maxnum)
ti = threads ? mu_msg_iter_get_thread_info (iter) : NULL;
sexp = mu_msg_to_sexp (msg, mu_msg_iter_get_docid (iter),
ti, TRUE, FALSE);
ti, MU_MSG_OPTION_HEADERS_ONLY);
print_expr ("%s", sexp);
g_free (sexp);
++u;
@ -1081,8 +1082,7 @@ do_move (MuStore *store, unsigned docid, MuMsg *msg, const char *maildir,
print_and_clear_g_error (err);
}
sexp = mu_msg_to_sexp (msg, docid, NULL, FALSE/*include body*/,
FALSE/*do not include images*/);
sexp = mu_msg_to_sexp (msg, docid, NULL, MU_MSG_OPTION_NONE);
/* note, the :move t thing is a hint to the frontend that it
* could remove the particular header */
print_expr ("(:update %s :move %s)", sexp,
@ -1343,13 +1343,15 @@ cmd_view (ServerContext *ctx, GSList *args, GError **err)
MuMsg *msg;
unsigned docid;
char *sexp;
gboolean extract_images;
MuMsgOptions opts;
extract_images = get_bool_from_args (args, "extract-images", FALSE, err);
if (err && *err) {
print_and_clear_g_error (err);
return MU_OK;
}
opts = MU_MSG_OPTION_CHECK_SIGNATURES;
if (get_bool_from_args (args, "extract-images", FALSE, err))
opts |= MU_MSG_OPTION_EXTRACT_IMAGES;
if (get_bool_from_args (args, "use-agent", FALSE, NULL))
opts |= MU_MSG_OPTION_USE_AGENT;
if (get_bool_from_args (args, "auto-retrieve-key", FALSE, NULL))
opts |= MU_MSG_OPTION_AUTO_RETRIEVE_KEY;
docid = determine_docid (ctx->query, args, err);
if (docid == MU_STORE_INVALID_DOCID) {
@ -1363,7 +1365,7 @@ cmd_view (ServerContext *ctx, GSList *args, GError **err)
return MU_OK;
}
sexp = mu_msg_to_sexp (msg, docid, NULL, FALSE, extract_images);
sexp = mu_msg_to_sexp (msg, docid, NULL, opts);
mu_msg_unref (msg);
print_expr ("(:view %s)\n", sexp);

View File

@ -52,7 +52,7 @@ view_msg_sexp (MuMsg *msg)
{
char *sexp;
sexp = mu_msg_to_sexp (msg, 0, NULL, FALSE, FALSE);
sexp = mu_msg_to_sexp (msg, 0, NULL, MU_MSG_OPTION_NONE);
fputs (sexp, stdout);
g_free (sexp);
@ -84,7 +84,7 @@ get_attach_str (MuMsg *msg)
attach = NULL;
mu_msg_part_foreach (msg, (MuMsgPartForeachFunc)each_part, &attach,
MU_MSG_PART_OPTION_NONE);
MU_MSG_OPTION_NONE);
return attach;
}
@ -437,7 +437,7 @@ MuError
mu_cmd_verify (MuConfig *opts, GError **err)
{
MuMsg *msg;
MuMsgPartOptions partopts;
MuMsgOptions msgopts;
VData vdata;
g_return_val_if_fail (opts, MU_ERROR_INTERNAL);
@ -448,18 +448,18 @@ mu_cmd_verify (MuConfig *opts, GError **err)
if (!msg)
return MU_ERROR;
partopts = MU_MSG_PART_OPTION_CHECK_SIGNATURES;
msgopts = MU_MSG_OPTION_CHECK_SIGNATURES;
if (opts->auto_retrieve)
partopts |= MU_MSG_PART_OPTION_AUTO_RETRIEVE_KEY;
msgopts |= MU_MSG_OPTION_AUTO_RETRIEVE_KEY;
if (opts->use_agent)
partopts |= MU_MSG_PART_OPTION_USE_AGENT;
msgopts |= MU_MSG_OPTION_USE_AGENT;
vdata.status = MU_MSG_PART_SIG_STATUS_UNKNOWN;
vdata.opts = opts;
vdata.msg = NULL;
mu_msg_part_foreach (msg,(MuMsgPartForeachFunc)each_sig, &vdata,
partopts);
msgopts);
/* if there's anything bad, all goodness goes away */
if (vdata.status & MU_MSG_PART_SIG_STATUS_BAD ||