#endif
static void compose_attach_update_label(Compose *compose);
+static void compose_attach_from_list(Compose *compose, GList *file_list, gboolean free_data);
+
static GtkItemFactoryEntry compose_popup_entries[] =
{
{N_("/_Add..."), NULL, compose_attach_cb, 0, NULL},
NULL, compose_set_encoding_cb, C_AUTO, "<RadioItem>"},
{N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
- {N_("/_Options/Character _encoding/7bit ascii (US-ASC_II)"),
+ {N_("/_Options/Character _encoding/7bit ASCII (US-ASC_II)"),
ENC_ACTION(C_US_ASCII)},
{N_("/_Options/Character _encoding/Unicode (_UTF-8)"),
ENC_ACTION(C_UTF_8)},
alertpanel_error(_("New message subject format error."));
else
gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf);
+ compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
g_free(subject);
body_format,
NULL, tmp, FALSE, TRUE,
_("New message body format error at line %d."));
+ compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
g_free(tmp);
compose_quote_fmt(compose, compose->replyinfo,
body_fmt, qmark, body, FALSE, TRUE,
_("Message reply format error at line %d."));
+ compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
}
compose_quote_fmt(compose, full_msginfo,
body_fmt, qmark, body, FALSE, TRUE,
_("Message forward format error at line %d."));
+ compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
compose_attach_parts(compose, msginfo);
{
gchar *to = NULL;
gchar *cc = NULL;
+ gchar *bcc = NULL;
gchar *subject = NULL;
gchar *body = NULL;
gchar *temp = NULL;
gsize len = 0;
- gchar *attach = NULL;
+ gchar **attach = NULL;
- scan_mailto_url(mailto, &to, &cc, NULL, &subject, &body, &attach);
+ scan_mailto_url(mailto, &to, &cc, &bcc, &subject, &body, &attach);
if (to)
compose_entry_append(compose, to, COMPOSE_TO);
if (cc)
compose_entry_append(compose, cc, COMPOSE_CC);
+ if (bcc)
+ compose_entry_append(compose, bcc, COMPOSE_BCC);
if (subject) {
if (!g_utf8_validate (subject, -1, NULL)) {
temp = g_locale_to_utf8 (subject, -1, NULL, &len, NULL);
}
if (attach) {
- gchar *utf8_filename = conv_filename_to_utf8(attach);
- if (utf8_filename) {
- if (compose_attach_append(compose, attach, utf8_filename, NULL)) {
- alertpanel_notice(_("The file '%s' has been attached."), attach);
- }
- g_free(utf8_filename);
- } else {
- alertpanel_error(_("Couldn't attach a file (charset conversion failed)."));
+ gint i = 0;
+ while (attach[i] != NULL) {
+ gchar *utf8_filename = conv_filename_to_utf8(attach[i]);
+ if (utf8_filename) {
+ if (compose_attach_append(compose, attach[i], utf8_filename, NULL)) {
+ alertpanel_notice(_("The file '%s' has been attached."), utf8_filename);
+ }
+ g_free(utf8_filename);
+ } else {
+ alertpanel_error(_("Couldn't attach a file (charset conversion failed)."));
+ }
+ i++;
}
}
g_free(to);
g_free(cc);
+ g_free(bcc);
g_free(subject);
g_free(body);
- g_free(attach);
+ g_strfreev(attach);
}
static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
goto bail;
}
- tmsgid = g_strdup(compose->msgid);
+ tmsgid = compose->msgid ? g_strdup(compose->msgid) : NULL;
if (discard_window) {
compose->sending = FALSE;
compose_close(compose);
} else {
g_snprintf(buf, sizeof(buf), "%s", "");
}
- generate_msgid(buf, sizeof(buf));
- err |= (fprintf(fp, "Resent-Message-ID: <%s>\n", buf) < 0);
- compose->msgid = g_strdup(buf);
+
+ if (compose->account->gen_msgid) {
+ generate_msgid(buf, sizeof(buf));
+ err |= (fprintf(fp, "Resent-Message-ID: <%s>\n", buf) < 0);
+ compose->msgid = g_strdup(buf);
+ } else {
+ compose->msgid = NULL;
+ }
if (compose_redirect_write_headers_from_headerlist(compose, fp))
return -1;
} else {
g_snprintf(buf, sizeof(buf), "%s", "");
}
- generate_msgid(buf, sizeof(buf));
- g_string_append_printf(header, "Message-ID: <%s>\n", buf);
- compose->msgid = g_strdup(buf);
+
+ if (compose->account->gen_msgid) {
+ generate_msgid(buf, sizeof(buf));
+ g_string_append_printf(header, "Message-ID: <%s>\n", buf);
+ compose->msgid = g_strdup(buf);
+ } else {
+ compose->msgid = NULL;
+ }
if (compose->remove_references == FALSE) {
/* In-Reply-To */
/* process the other fields */
compose_template_apply_fields(compose, tmpl);
+ compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
compose_changed_cb(NULL, compose);
}
compose_draft(data, action);
}
-static void compose_attach_cb(gpointer data, guint action, GtkWidget *widget)
+static void compose_attach_from_list(Compose *compose, GList *file_list, gboolean free_data)
{
- Compose *compose = (Compose *)data;
- GList *file_list;
-
- if (compose->redirect_filename != NULL)
- return;
-
- file_list = filesel_select_multiple_files_open(_("Select file"));
-
- if (file_list) {
+ if (compose && file_list) {
GList *tmp;
for ( tmp = file_list; tmp; tmp = tmp->next) {
gchar *utf8_filename = conv_filename_to_utf8(file);
compose_attach_append(compose, file, utf8_filename, NULL);
compose_changed_cb(NULL, compose);
+ if (free_data) {
g_free(file);
+ tmp->data = NULL;
+ }
g_free(utf8_filename);
}
+ }
+}
+
+static void compose_attach_cb(gpointer data, guint action, GtkWidget *widget)
+{
+ Compose *compose = (Compose *)data;
+ GList *file_list;
+
+ if (compose->redirect_filename != NULL)
+ return;
+
+ file_list = filesel_select_multiple_files_open(_("Select file"));
+
+ if (file_list) {
+ compose_attach_from_list(compose, file_list, TRUE);
g_list_free(file_list);
}
}