mirror of https://github.com/djcb/mu.git
Fix forwarding of gpg encrypted mails (#186)
This commit is contained in:
parent
c5fd36a67f
commit
925bc6a15c
|
@ -415,8 +415,14 @@ cmd_add (ServerContext *ctx, GHashTable *args, GError **err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct _PartInfo {
|
||||||
|
GSList *attlist;
|
||||||
|
MuMsgOptions opts;
|
||||||
|
};
|
||||||
|
typedef struct _PartInfo PartInfo;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
each_part (MuMsg *msg, MuMsgPart *part, GSList **attlist)
|
each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo)
|
||||||
{
|
{
|
||||||
char *att, *cachefile;
|
char *att, *cachefile;
|
||||||
GError *err;
|
GError *err;
|
||||||
|
@ -427,7 +433,8 @@ each_part (MuMsg *msg, MuMsgPart *part, GSList **attlist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
cachefile = mu_msg_part_save_temp (msg, MU_MSG_OPTION_OVERWRITE,
|
cachefile = mu_msg_part_save_temp (msg,
|
||||||
|
pinfo->opts|MU_MSG_OPTION_OVERWRITE,
|
||||||
part->index, &err);
|
part->index, &err);
|
||||||
if (!cachefile) {
|
if (!cachefile) {
|
||||||
print_and_clear_g_error (&err);
|
print_and_clear_g_error (&err);
|
||||||
|
@ -437,7 +444,7 @@ each_part (MuMsg *msg, MuMsgPart *part, GSList **attlist)
|
||||||
att = g_strdup_printf (
|
att = g_strdup_printf (
|
||||||
"(:file-name \"%s\" :mime-type \"%s/%s\")",
|
"(:file-name \"%s\" :mime-type \"%s/%s\")",
|
||||||
cachefile, part->type, part->subtype);
|
cachefile, part->type, part->subtype);
|
||||||
*attlist = g_slist_append (*attlist, att);
|
pinfo->attlist = g_slist_append (pinfo->attlist, att);
|
||||||
g_free (cachefile);
|
g_free (cachefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,23 +457,25 @@ each_part (MuMsg *msg, MuMsgPart *part, GSList **attlist)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static gchar*
|
static gchar*
|
||||||
include_attachments (MuMsg *msg)
|
include_attachments (MuMsg *msg, MuMsgOptions opts)
|
||||||
{
|
{
|
||||||
GSList *attlist, *cur;
|
GSList *cur;
|
||||||
GString *gstr;
|
GString *gstr;
|
||||||
|
PartInfo pinfo;
|
||||||
|
|
||||||
attlist = NULL;
|
pinfo.attlist = NULL;
|
||||||
mu_msg_part_foreach (msg, MU_MSG_OPTION_NONE,
|
pinfo.opts = opts;
|
||||||
|
mu_msg_part_foreach (msg, opts,
|
||||||
(MuMsgPartForeachFunc)each_part,
|
(MuMsgPartForeachFunc)each_part,
|
||||||
&attlist);
|
&pinfo);
|
||||||
|
|
||||||
gstr = g_string_sized_new (512);
|
gstr = g_string_sized_new (512);
|
||||||
gstr = g_string_append_c (gstr, '(');
|
gstr = g_string_append_c (gstr, '(');
|
||||||
for (cur = attlist; cur; cur = g_slist_next (cur))
|
for (cur = pinfo.attlist; cur; cur = g_slist_next (cur))
|
||||||
g_string_append (gstr, (gchar*)cur->data);
|
g_string_append (gstr, (gchar*)cur->data);
|
||||||
gstr = g_string_append_c (gstr, ')');
|
gstr = g_string_append_c (gstr, ')');
|
||||||
|
|
||||||
mu_str_free_list (attlist);
|
mu_str_free_list (pinfo.attlist);
|
||||||
|
|
||||||
return g_string_free (gstr, FALSE);
|
return g_string_free (gstr, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -542,7 +551,7 @@ cmd_compose (ServerContext *ctx, GHashTable *args, GError **err)
|
||||||
return MU_OK;
|
return MU_OK;
|
||||||
}
|
}
|
||||||
sexp = mu_msg_to_sexp (msg, atoi(docidstr), NULL, opts);
|
sexp = mu_msg_to_sexp (msg, atoi(docidstr), NULL, opts);
|
||||||
atts = (ctype == FORWARD) ? include_attachments (msg) : NULL;
|
atts = (ctype == FORWARD) ? include_attachments (msg, opts) : NULL;
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
} else
|
} else
|
||||||
atts = sexp = NULL;
|
atts = sexp = NULL;
|
||||||
|
|
Loading…
Reference in New Issue