PRIORITY_LOWEST
} PriorityLevel;
+#if USE_GPGME
+typedef enum
+{
+ SIG_MODE_DETACH,
+ SIG_MODE_CLEAR
+} ComposeSigMode;
+
+typedef enum
+{
+ ENC_MODE_DETACH,
+ ENC_MODE_ASCII
+} ComposeEncMode;
+#endif
+
#define B64_LINE_SIZE 57
#define B64_BUFFSIZE 77
static void compose_reply_set_entry (Compose *compose,
MsgInfo *msginfo,
gboolean to_all,
+ gboolean to_ml,
gboolean to_sender,
gboolean
followup_and_reply_to);
static void compose_toggle_encrypt_cb (gpointer data,
guint action,
GtkWidget *widget);
+static void compose_set_sigmode_cb (gpointer data,
+ guint action,
+ GtkWidget *widget);
+static void compose_set_encmode_cb (gpointer data,
+ guint action,
+ GtkWidget *widget);
+static void compose_update_sigmode_menu_item(Compose * compose);
+static void compose_update_encmode_menu_item(Compose * compose);
+static void activate_gnupg_mode (Compose *compose,
+ PrefsAccount *account);
#endif
static void compose_toggle_return_receipt_cb(gpointer data, guint action,
GtkWidget *widget);
gint *position,
Compose *compose);
static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
- gboolean to_all,
+ gboolean to_all, gboolean to_ml,
gboolean ignore_replyto,
gboolean followup_and_reply_to,
const gchar *body);
#if USE_GPGME
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/Si_gn"), NULL, compose_toggle_sign_cb , 0, "<ToggleItem>"},
+ {N_("/_Message/Sign mode"), NULL, NULL, 0, "<Branch>"},
+ {N_("/_Message/Sign mode/MIME"), NULL, compose_set_sigmode_cb, SIG_MODE_DETACH, "<RadioItem>"},
+ {N_("/_Message/Sign mode/Clear"),NULL, compose_set_sigmode_cb, SIG_MODE_CLEAR, "/Message/Sign mode/MIME"},
{N_("/_Message/_Encrypt"), NULL, compose_toggle_encrypt_cb, 0, "<ToggleItem>"},
+ {N_("/_Message/Encrypt mode"), NULL, NULL, 0, "<Branch>"},
+ {N_("/_Message/Encrypt mode/MIME"), NULL, compose_set_encmode_cb, ENC_MODE_DETACH, "<RadioItem>"},
+ {N_("/_Message/Encrypt mode/ASCII"),NULL, compose_set_encmode_cb, ENC_MODE_ASCII, "/Message/Encrypt mode/MIME"},
#endif /* USE_GPGME */
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/_Priority"), NULL, NULL, 0, "<Branch>"},
gtk_stext_thaw(text);
- /* workaround for initial XIM problem */
- gtk_widget_grab_focus(compose->text);
- gtkut_widget_wait_for_draw(compose->text);
-
if (account->protocol != A_NNTP) {
if (mailto && *mailto != '\0') {
compose_entries_set(compose, mailto);
return compose;
}
-#define CHANGE_FLAGS(msginfo) \
-{ \
-if (msginfo->folder->folder->change_flags != NULL) \
-msginfo->folder->folder->change_flags(msginfo->folder->folder, \
- msginfo->folder, \
- msginfo); \
-}
-
/*
Compose *compose_new_followup_and_replyto(PrefsAccount *account,
const gchar *followupto, gchar * to)
*/
void compose_reply(MsgInfo *msginfo, gboolean quote, gboolean to_all,
- gboolean ignore_replyto, const gchar *body)
+ gboolean to_ml, gboolean ignore_replyto,
+ const gchar *body)
{
- compose_generic_reply(msginfo, quote, to_all, ignore_replyto, FALSE,
- body);
+ compose_generic_reply(msginfo, quote, to_all, to_ml,
+ ignore_replyto, FALSE, body);
}
void compose_followup_and_reply_to(MsgInfo *msginfo, gboolean quote,
gboolean ignore_replyto,
const gchar *body)
{
- compose_generic_reply(msginfo, quote, to_all, ignore_replyto, TRUE,
- body);
+ compose_generic_reply(msginfo, quote, to_all, FALSE,
+ ignore_replyto, TRUE, body);
}
static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
- gboolean to_all,
+ gboolean to_all, gboolean to_ml,
gboolean ignore_replyto,
gboolean followup_and_reply_to,
const gchar *body)
reply_account = account;
compose = compose_create(account, COMPOSE_REPLY);
- compose->replyinfo = procmsg_msginfo_new_ref(msginfo);
-#if 0 /* NEW COMPOSE GUI */
- if (followup_and_reply_to) {
- gtk_widget_show(compose->to_hbox);
- gtk_widget_show(compose->to_entry);
- gtk_table_set_row_spacing(GTK_TABLE(compose->table), 1, 4);
- compose->use_to = TRUE;
- }
-#endif
+ compose->replyinfo = procmsg_msginfo_get_full_info(msginfo);
+ if (!compose->replyinfo)
+ compose->replyinfo = procmsg_msginfo_copy(msginfo);
+
if (msginfo->folder && msginfo->folder->ret_rcpt) {
GtkItemFactory *ifactory;
}
if (compose_parse_header(compose, msginfo) < 0) return;
- compose_reply_set_entry(compose, msginfo, to_all, ignore_replyto,
- followup_and_reply_to);
+ compose_reply_set_entry(compose, msginfo, to_all, to_ml,
+ ignore_replyto, followup_and_reply_to);
compose_show_first_last_header(compose, TRUE);
text = GTK_STEXT(compose->text);
else
qmark = "> ";
- quote_str = compose_quote_fmt(compose, msginfo,
+ quote_str = compose_quote_fmt(compose, compose->replyinfo,
prefs_common.quotefmt,
qmark, body);
}
gboolean as_attach, const gchar *body)
{
Compose *compose;
- /* PrefsAccount *account; */
GtkSText *text;
g_return_val_if_fail(msginfo != NULL, NULL);
g_return_val_if_fail(msginfo->folder != NULL, NULL);
- account = msginfo->folder->folder->account;
+ if (!account)
+ account = msginfo->folder->folder->account;
if (!account && msginfo->to && prefs_common.forward_account_autosel) {
gchar *to;
Xstrdup_a(to, msginfo->to, return NULL);
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED);
if (MSG_IS_IMAP(msginfo->flags))
imap_msg_unset_perm_flags(msginfo, MSG_REPLIED);
- CHANGE_FLAGS(msginfo);
compose = compose_create(account, COMPOSE_FORWARD);
} else {
gchar *qmark;
gchar *quote_str;
+ MsgInfo *full_msginfo;
+
+ full_msginfo = procmsg_msginfo_get_full_info(msginfo);
+ if (!full_msginfo)
+ full_msginfo = procmsg_msginfo_copy(msginfo);
if (prefs_common.fw_quotemark &&
*prefs_common.fw_quotemark)
else
qmark = "> ";
- quote_str = compose_quote_fmt(compose, msginfo,
+ quote_str = compose_quote_fmt(compose, full_msginfo,
prefs_common.fw_quotefmt,
qmark, body);
compose_attach_parts(compose, msginfo);
+
+ procmsg_msginfo_free(full_msginfo);
}
if (prefs_common.auto_sig)
for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) {
MSG_UNSET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_REPLIED);
MSG_SET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_FORWARDED);
- CHANGE_FLAGS(((MsgInfo *)msginfo->data));
}
compose = compose_create(account, COMPOSE_FORWARD);
g_return_if_fail(msginfo != NULL);
g_return_if_fail(msginfo->folder != NULL);
- if (msginfo->folder->stype == F_QUEUE) {
+ if (msginfo->folder->stype == F_QUEUE || msginfo->folder->stype == F_DRAFT) {
gchar queueheader_buf[BUFFSIZE];
gint id;
if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
g_warning(_("Can't get text part\n"));
else {
- while (fgets(buf, sizeof(buf), fp) != NULL)
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ strcrchomp(buf);
gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
+ }
fclose(fp);
}
compose_attach_parts(compose, msginfo);
#if USE_GPGME
menu_set_sensitive(ifactory, "/Message/Sign", FALSE);
menu_set_sensitive(ifactory, "/Message/Encrypt", FALSE);
+ menu_set_sensitive(ifactory, "/Message/Sign mode/", FALSE);
+ menu_set_sensitive(ifactory, "/Message/Encrypt mode/", FALSE);
#endif
menu_set_sensitive(ifactory, "/Message/Request Return Receipt", FALSE);
menu_set_sensitive(ifactory, "/Tools/Template", FALSE);
static void compose_entries_set(Compose *compose, const gchar *mailto)
{
- gchar *subject = NULL;
gchar *to = NULL;
gchar *cc = NULL;
gchar *bcc = NULL;
+ gchar *subject = NULL;
gchar *body = NULL;
- gchar *p;
- gchar *tmp_mailto;
- Xstrdup_a(tmp_mailto, mailto, return);
-
- to = tmp_mailto;
-
- p = strchr(tmp_mailto, '?');
- if (p) {
- *p = '\0';
- p++;
- }
-
- while (p) {
- gchar *field, *value;
-
- field = p;
-
- p = strchr(p, '=');
- if (!p) break;
- *p = '\0';
- p++;
-
- value = p;
-
- p = strchr(p, '&');
- if (p) {
- *p = '\0';
- p++;
- }
-
- if (*value == '\0') continue;
-
- if (!g_strcasecmp(field, "subject")) {
- Xalloca(subject, strlen(value) + 1, return);
- decode_uri(subject, value);
- } else if (!g_strcasecmp(field, "cc")) {
- cc = value;
- } else if (!g_strcasecmp(field, "bcc")) {
- bcc = value;
- } else if (!g_strcasecmp(field, "body")) {
- Xalloca(body, strlen(value) + 1, return);
- decode_uri(body, value);
- }
- }
+ scan_mailto_url(mailto, &to, &cc, &bcc, &subject, &body);
if (to)
compose_entry_append(compose, to, COMPOSE_TO);
- if (subject)
- gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), subject);
if (cc)
compose_entry_append(compose, cc, COMPOSE_CC);
if (bcc)
compose_entry_append(compose, bcc, COMPOSE_BCC);
+ if (subject)
+ gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), subject);
if (body) {
gtk_stext_insert(GTK_STEXT(compose->text),
NULL, NULL, NULL, body, -1);
gtk_stext_insert(GTK_STEXT(compose->text),
NULL, NULL, NULL, "\n", 1);
}
+
+ g_free(to);
+ g_free(cc);
+ g_free(bcc);
+ g_free(subject);
+ g_free(body);
}
static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
{
- static HeaderEntry hentry[] = {{"Reply-To:", NULL, TRUE},
- {"Cc:", NULL, FALSE},
- {"References:", NULL, FALSE},
- {"Bcc:", NULL, FALSE},
- {"Newsgroups:", NULL, FALSE},
- {"Followup-To:", NULL, FALSE},
- {"X-Mailing-List:", NULL, FALSE},
- {"X-BeenThere:", NULL, FALSE},
- {"X-Priority:", NULL, FALSE},
- {NULL, NULL, FALSE}};
+ static HeaderEntry hentry[] = {{"Reply-To:", NULL, TRUE},
+ {"Cc:", NULL, FALSE},
+ {"References:", NULL, FALSE},
+ {"Bcc:", NULL, FALSE},
+ {"Newsgroups:", NULL, FALSE},
+ {"Followup-To:", NULL, FALSE},
+ {"List-Post:", NULL, FALSE},
+ {"X-Priority:", NULL, FALSE},
+ {NULL, NULL, FALSE}};
enum
{
- H_REPLY_TO = 0,
- H_CC = 1,
- H_REFERENCES = 2,
- H_BCC = 3,
- H_NEWSGROUPS = 4,
- H_FOLLOWUP_TO = 5,
- H_X_MAILING_LIST = 6,
- H_X_BEENTHERE = 7,
- H_X_PRIORITY = 8
+ H_REPLY_TO = 0,
+ H_CC = 1,
+ H_REFERENCES = 2,
+ H_BCC = 3,
+ H_NEWSGROUPS = 4,
+ H_FOLLOWUP_TO = 5,
+ H_LIST_POST = 6,
+ H_X_PRIORITY = 7
};
FILE *fp;
compose->cc = hentry[H_CC].body;
hentry[H_CC].body = NULL;
}
- if (hentry[H_X_MAILING_LIST].body != NULL) {
- /* this is good enough to parse debian-devel */
- gchar *buf = g_malloc(strlen(hentry[H_X_MAILING_LIST].body) + 1);
- g_return_val_if_fail(buf != NULL, -1 );
- if (1 == sscanf(hentry[H_X_MAILING_LIST].body, "<%[^>]>", buf))
- compose->mailinglist = g_strdup(buf);
- g_free(buf);
- g_free(hentry[H_X_MAILING_LIST].body);
- hentry[H_X_MAILING_LIST].body = NULL ;
- }
- if (hentry[H_X_BEENTHERE].body != NULL) {
- /* this is good enough to parse the sylpheed-claws lists */
- gchar *buf = g_malloc(strlen(hentry[H_X_BEENTHERE].body) + 1);
- g_return_val_if_fail(buf != NULL, -1 );
- if (1 == sscanf(hentry[H_X_BEENTHERE].body, "%[^>]", buf))
- compose->mailinglist = g_strdup(buf);
- g_free(buf);
- g_free(hentry[H_X_BEENTHERE].body);
- hentry[H_X_BEENTHERE].body = NULL ;
- }
if (hentry[H_REFERENCES].body != NULL) {
if (compose->mode == COMPOSE_REEDIT)
compose->references = hentry[H_REFERENCES].body;
compose->followup_to = hentry[H_FOLLOWUP_TO].body;
hentry[H_FOLLOWUP_TO].body = NULL;
}
+ if (hentry[H_LIST_POST].body != NULL) {
+ gchar *to = NULL;
+ extract_address(hentry[H_LIST_POST].body);
+ if (hentry[H_LIST_POST].body[0] != '\0') {
+ scan_mailto_url(hentry[H_LIST_POST].body,
+ &to, NULL, NULL, NULL, NULL);
+ if (to) {
+ g_free(compose->ml_post);
+ compose->ml_post = to;
+ }
+ }
+ g_free(hentry[H_LIST_POST].body);
+ hentry[H_LIST_POST].body = NULL;
+ }
+
+ /* CLAWS - X-Priority */
if (compose->mode == COMPOSE_REEDIT)
if (hentry[H_X_PRIORITY].body != NULL) {
gint priority;
}
static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
- gboolean to_all, gboolean ignore_replyto,
+ gboolean to_all, gboolean to_ml,
+ gboolean ignore_replyto,
gboolean followup_and_reply_to)
{
GSList *cc_list = NULL;
g_return_if_fail(compose->account != NULL);
g_return_if_fail(msginfo != NULL);
- if ((compose->account->protocol != A_NNTP) || followup_and_reply_to)
- compose_entry_append(compose,
- ((compose->replyto && !ignore_replyto)
- ? compose->replyto
- : (compose->mailinglist && !ignore_replyto)
- ? compose->mailinglist
- : msginfo->from ? msginfo->from : ""),
- COMPOSE_TO);
-
- if (compose->account->protocol == A_NNTP) {
+ if (compose->account->protocol != A_NNTP || followup_and_reply_to) {
+ if (!compose->replyto && to_ml && compose->ml_post)
+ compose_entry_append(compose,
+ compose->ml_post,
+ COMPOSE_TO);
+ else if (!(to_all || ignore_replyto)
+ && msginfo->folder
+ && msginfo->folder->prefs->enable_default_reply_to) {
+ compose_entry_append(compose,
+ msginfo->folder->prefs->default_reply_to,
+ COMPOSE_TO);
+ } else
+ compose_entry_append(compose,
+ (compose->replyto && !ignore_replyto)
+ ? compose->replyto
+ : msginfo->from ? msginfo->from : "",
+ COMPOSE_TO);
+ } else {
if (ignore_replyto)
compose_entry_append
(compose, msginfo->from ? msginfo->from : "",
COMPOSE_TO);
else {
- if (compose->followup_to && !strncmp(compose->followup_to,"poster",6)) {
+ if (compose->followup_to && !strncmp(compose->followup_to, "poster", 6)) {
compose_entry_append
(compose,
((compose->replyto && !ignore_replyto)
? compose->replyto
- : (compose->mailinglist && !ignore_replyto)
- ? compose->mailinglist
: msginfo->from ? msginfo->from : ""),
COMPOSE_TO);
} else {
} else
gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), "Re: ");
+ if (to_ml && compose->ml_post) return;
if (!to_all || compose->account->protocol == A_NNTP) return;
if (compose->replyto) {
extract_address(from);
}
- if (compose->mailinglist && from) {
- cc_list = address_list_append(cc_list, from);
- }
-
if (replyto && from)
cc_list = address_list_append(cc_list, from);
-
- if (!compose->mailinglist)
- cc_list = address_list_append(cc_list, msginfo->to);
-
+ cc_list = address_list_append(cc_list, msginfo->to);
cc_list = address_list_append(cc_list, compose->cc);
to_table = g_hash_table_new(g_str_hash, g_str_equal);
SET_ADDRESS(COMPOSE_REPLYTO, compose->replyto);
compose_update_priority_menu_item(compose);
-
+#if USE_GPGME
+ compose_update_sigmode_menu_item(compose);
+ compose_update_encmode_menu_item(compose);
+#endif
compose_show_first_last_header(compose, TRUE);
#if 0 /* NEW COMPOSE GUI */
gtk_widget_show(compose->newsgroups_hbox);
gtk_widget_show(compose->newsgroups_entry);
gtk_table_set_row_spacing(GTK_TABLE(compose->table), 2, 4);
+ compose->use_newsgroups = TRUE;
menuitem = gtk_item_factory_get_item(ifactory, "/View/To");
gtk_check_menu_item_set_active
gtk_widget_hide(compose->newsgroups_entry);
gtk_table_set_row_spacing(GTK_TABLE(compose->table), 2, 0);
gtk_widget_queue_resize(compose->table_vbox);
+ compose->use_newsgroups = FALSE;
menuitem = gtk_item_factory_get_item(ifactory, "/View/To");
gtk_check_menu_item_set_active
menuitem = gtk_item_factory_get_item(ifactory, "/Message/Encrypt");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
account->default_encrypt);
+
+ activate_gnupg_mode(compose, account);
#endif /* USE_GPGME */
}
if (lock) return 1;
g_return_val_if_fail(compose->account != NULL, -1);
- g_return_val_if_fail(compose->orig_account != NULL, -1);
lock = TRUE;
#if 0 /* NEW COMPOSE GUI */
if (compose->account->protocol != A_NNTP)
ac = compose->account;
- else if (compose->orig_account->protocol != A_NNTP)
- ac = compose->orig_account;
- else if (cur_account && cur_account->protocol != A_NNTP)
- ac = cur_account;
else {
- ac = compose_current_mail_account();
+ ac = account_find_from_address(compose->account->address);
if (!ac) {
+ if (cur_account && cur_account->protocol != A_NNTP)
+ ac = cur_account;
+ else
+ ac = account_get_default();
+ }
+ if (!ac || ac->protocol == A_NNTP) {
+ alertpanel_error(_("Account for sending mail is not specified.\n"
+ "Please select a mail account before sending."));
unlink(tmp);
lock = FALSE;
return -1;
}
if (ok == 0 && compose->newsgroup_list) {
- Folder *folder;
-
- if (compose->account->protocol == A_NNTP)
- folder = FOLDER(compose->account->folder);
- else
- folder = FOLDER(compose->orig_account->folder);
-
- ok = news_post(folder, tmp);
+ ok = news_post(FOLDER(compose->account->folder), tmp);
if (ok < 0) {
alertpanel_error(_("Error occurred while posting the message to %s ."),
compose->account->nntp_server);
#if USE_GPGME
if (!is_draft &&
- compose->use_signing && !compose->account->clearsign &&
+ compose->use_signing && !compose->sigmode &&
encoding == ENC_8BIT)
encoding = ENC_BASE64;
#endif
}
g_free(chars);
+ /* Canonicalize line endings in the message text */
+ {
+ gchar *canon_buf, *out;
+ const gchar *p;
+ guint new_len = 0;
+
+ for (p = buf ; *p; ++p) {
+ if (*p != '\r') {
+ ++new_len;
+ if (*p == '\n')
+ ++new_len;
+ }
+ }
+
+ out = canon_buf = g_new(gchar, new_len + 1);
+ for (p = buf; *p; ++p) {
+ if (*p != '\r') {
+ if (*p == '\n')
+ *out++ = '\r';
+ *out++ = *p;
+ }
+ }
+ *out = '\0';
+
+ free(buf);
+ buf = canon_buf;
+ }
+
#if USE_GPGME
- if (!is_draft && compose->use_signing && compose->account->clearsign) {
+ if (!is_draft && compose->use_signing && compose->sigmode) {
if (compose_clearsign_text(compose, &buf) < 0) {
g_warning("clearsign failed\n");
fclose(fp);
if (is_draft)
return 0;
- if ((compose->use_signing && !compose->account->clearsign) ||
+ if ((compose->use_signing && !compose->sigmode) ||
compose->use_encryption) {
if (canonicalize_file_replace(file) < 0) {
unlink(file);
}
}
- if (compose->use_signing && !compose->account->clearsign) {
+ if (compose->use_signing && !compose->sigmode) {
GSList *key_list;
if (compose_create_signers_list(compose, &key_list) < 0 ||
}
if (compose->use_encryption) {
if (rfc2015_encrypt(file, compose->to_list,
- compose->account->ascii_armored) < 0) {
+ compose->encmode) < 0) {
unlink(file);
return -1;
}
debug_print("queueing message...\n");
g_return_val_if_fail(compose->account != NULL, -1);
- g_return_val_if_fail(compose->orig_account != NULL, -1);
lock = TRUE;
if (compose->to_list) {
if (compose->account->protocol != A_NNTP)
mailac = compose->account;
- else if (compose->orig_account->protocol != A_NNTP)
- mailac = compose->orig_account;
else if (cur_account && cur_account->protocol != A_NNTP)
mailac = cur_account;
else if (!(mailac = compose_current_mail_account())) {
if (compose->newsgroup_list) {
if (compose->account->protocol == A_NNTP)
newsac = compose->account;
- else if (!(newsac = compose->orig_account) || (newsac->protocol != A_NNTP)) {
+ else if (!newsac->protocol != A_NNTP) {
lock = FALSE;
alertpanel_error(_("No account for posting news available!"));
return -1;
fprintf(fp, "NSV:\n");
fprintf(fp, "SSH:\n");
/* write recepient list */
- fprintf(fp, "R:");
if (compose->to_list) {
- fprintf(fp, "<%s>", (gchar *)compose->to_list->data);
- for (cur = compose->to_list->next; cur != NULL; cur = cur->next)
+ fprintf(fp, "R:<%s>", (gchar *)compose->to_list->data);
+ for (cur = compose->to_list->next; cur != NULL;
+ cur = cur->next)
fprintf(fp, ",<%s>", (gchar *)cur->data);
+ fprintf(fp, "\n");
}
- fprintf(fp, "\n");
/* write newsgroup list */
- fprintf(fp, "NG:");
if (compose->newsgroup_list) {
+ fprintf(fp, "NG:");
fprintf(fp, "%s", (gchar *)compose->newsgroup_list->data);
for (cur = compose->newsgroup_list->next; cur != NULL; cur = cur->next)
fprintf(fp, ",%s", (gchar *)cur->data);
+ fprintf(fp, "\n");
}
- fprintf(fp, "\n");
/* Sylpheed account IDs */
if (mailac) {
fprintf(fp, "MAID:%d\n", mailac->account_id);
fputc('\n', fp);
}
break;
+ default:
+ debug_print("Tried to write attachment in unsupported encoding type\n");
+ break;
}
fclose(attach_fp);
g_return_val_if_fail(compose->account != NULL, -1);
g_return_val_if_fail(compose->account->address != NULL, -1);
- /* Save copy folder */
+ /* Save draft infos */
if (is_draft) {
+ fprintf(fp, "S:%s\n", compose->account->address);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) {
gchar *savefolderid;
savefolderid = gtk_editable_get_chars(GTK_EDITABLE(compose->savemsg_entry), 0, -1);
- fprintf(fp, "SCF:%s\n\n", savefolderid);
+ fprintf(fp, "SCF:%s\n", savefolderid);
g_free(savefolderid);
- } else {
- fprintf(fp, " \n\n");
}
+ fprintf(fp, "\n");
}
/* Date */
/* Newsgroups */
compose_write_headers_from_headerlist(compose, fp, "Newsgroups");
#if 0 /* NEW COMPOSE GUI */
- str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
- if (*str != '\0') {
- Xstrdup_a(str, str, return -1);
- g_strstrip(str);
- remove_space(str);
+ if (compose->use_newsgroups) {
+ str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
if (*str != '\0') {
- compose->newsgroup_list =
- newsgroup_list_append(compose->newsgroup_list,
- str);
- compose_convert_header(buf, sizeof(buf), str,
- strlen("Newsgroups: "));
- fprintf(fp, "Newsgroups: %s\n", buf);
+ Xstrdup_a(str, str, return -1);
+ g_strstrip(str);
+ remove_space(str);
+ if (*str != '\0') {
+ compose->newsgroup_list =
+ newsgroup_list_append
+ (compose->newsgroup_list, str);
+ compose_convert_header(buf, sizeof(buf), str,
+ strlen("Newsgroups: "));
+ fprintf(fp, "Newsgroups: %s\n", buf);
+ }
}
}
#endif
/* drag and drop */
gtk_drag_dest_set(attach_clist,
GTK_DEST_DEFAULT_ALL, compose_mime_types, 1,
- GDK_ACTION_COPY);
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
gtk_signal_connect(GTK_OBJECT(attach_clist), "drag_data_received",
GTK_SIGNAL_FUNC(compose_attach_drag_received_cb),
compose);
GdkColormap *cmap;
GdkColor color[1];
gboolean success[1];
- GdkFont *font;
GtkWidget *popupmenu;
GtkItemFactory *popupfactory;
GtkItemFactory *ifactory;
titles[COL_NAME] = _("Name");
compose->account = account;
- compose->orig_account = account;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
/* drag and drop */
gtk_drag_dest_set(text, GTK_DEST_DEFAULT_ALL, compose_mime_types, 1,
- GDK_ACTION_COPY);
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
gtk_signal_connect(GTK_OBJECT(text), "drag_data_received",
GTK_SIGNAL_FUNC(compose_insert_drag_received_cb),
compose);
new_style = gtk_style_copy(style);
if (prefs_common.textfont) {
- if (MB_CUR_MAX == 1) {
- gchar *fontstr, *p;
+ GdkFont *font;
- Xstrdup_a(fontstr, prefs_common.textfont, );
- if (fontstr && (p = strchr(fontstr, ',')) != NULL)
- *p = '\0';
- font = gdk_font_load(fontstr);
- } else
- font = gdk_fontset_load(prefs_common.textfont);
- if (font) {
+ if ((font = gtkut_font_load(prefs_common.textfont)) != NULL) {
gdk_font_unref(new_style->font);
new_style->font = font;
}
compose->replyinfo = NULL;
compose->replyto = NULL;
- compose->mailinglist = NULL;
compose->cc = NULL;
compose->bcc = NULL;
compose->followup_to = NULL;
+
+ compose->ml_post = NULL;
+
compose->inreplyto = NULL;
compose->references = NULL;
compose->msgid = NULL;
#if USE_ASPELL
menu_set_sensitive(ifactory, "/Spelling", FALSE);
- if (prefs_common.enable_aspell) {
+ if (prefs_common.enable_aspell &&
+ strcmp(prefs_common.dictionary, _("None"))) {
gtkaspell = gtkaspell_new((const gchar*)prefs_common.dictionary,
conv_get_current_charset_str(),
prefs_common.misspelled_col,
/* Priority */
compose->priority = PRIORITY_NORMAL;
compose_update_priority_menu_item(compose);
+
+#if USE_GPGME
+ activate_gnupg_mode(compose, account);
+#endif
set_toolbar_style(compose);
}
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
}
+
+#if USE_GPGME
+static void compose_set_sigmode_cb(gpointer data,
+ guint action,
+ GtkWidget *widget)
+{
+ Compose *compose = (Compose *) data;
+ compose->sigmode = action;
+}
+
+static void compose_update_sigmode_menu_item(Compose * compose)
+{
+ GtkItemFactory *ifactory;
+ GtkWidget *menuitem = NULL;
+
+ ifactory = gtk_item_factory_from_widget(compose->menubar);
+
+ switch (compose->sigmode) {
+ case SIG_MODE_DETACH:
+ menuitem = gtk_item_factory_get_item
+ (ifactory, "/Message/Sign mode/MIME");
+ break;
+ case SIG_MODE_CLEAR:
+ menuitem = gtk_item_factory_get_item
+ (ifactory, "/Message/Sign mode/Clear");
+ break;
+ }
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+
+ if (compose->use_signing == TRUE)
+ menu_set_sensitive(ifactory, "/Message/Sign mode", TRUE);
+ else
+ menu_set_sensitive(ifactory, "/Message/Sign mode", FALSE);
+}
+
+static void compose_set_encmode_cb(gpointer data,
+ guint action,
+ GtkWidget *widget)
+{
+ Compose *compose = (Compose *) data;
+ compose->encmode = action;
+}
+
+static void compose_update_encmode_menu_item(Compose * compose)
+{
+ GtkItemFactory *ifactory;
+ GtkWidget *menuitem = NULL;
+
+ ifactory = gtk_item_factory_from_widget(compose->menubar);
+
+ switch (compose->encmode) {
+ case ENC_MODE_DETACH:
+ menuitem = gtk_item_factory_get_item
+ (ifactory, "/Message/Encrypt mode/MIME");
+ break;
+ case ENC_MODE_ASCII:
+ menuitem = gtk_item_factory_get_item
+ (ifactory, "/Message/Encrypt mode/ASCII");
+ break;
+ }
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+
+ if (compose->use_encryption == TRUE)
+ menu_set_sensitive(ifactory, "/Message/Encrypt mode", TRUE);
+ else
+ menu_set_sensitive(ifactory, "/Message/Encrypt mode", FALSE);
+}
+#endif
static void compose_set_template_menu(Compose *compose)
{
tmpl->subject);
if (tmpl->to && *tmpl->to != '\0')
compose_entry_append(compose, tmpl->to, COMPOSE_TO);
+ if (tmpl->cc && *tmpl->cc != '\0')
+ compose_entry_append(compose, tmpl->cc, COMPOSE_CC);
+
+ if (tmpl->bcc && *tmpl->bcc != '\0')
+ compose_entry_append(compose, tmpl->bcc, COMPOSE_BCC);
if (replace)
gtk_stext_clear(GTK_STEXT(compose->text));
g_free(compose->newsgroups);
g_free(compose->followup_to);
+ g_free(compose->ml_post);
+
g_free(compose->inreplyto);
g_free(compose->references);
g_free(compose->msgid);
if (!val) gtk_widget_destroy(compose->window);
}
+void compose_draft (gpointer data)
+{
+ compose_draft_cb(data, 0, NULL);
+}
+
static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
{
Compose *compose = (Compose *)data;
compose->use_signing = TRUE;
else
compose->use_signing = FALSE;
+
+ compose_update_sigmode_menu_item(compose);
}
static void compose_toggle_encrypt_cb(gpointer data, guint action,
compose->use_encryption = TRUE;
else
compose->use_encryption = FALSE;
+
+ compose_update_encmode_menu_item(compose);
+}
+
+static void activate_gnupg_mode (Compose *compose, PrefsAccount *account)
+{
+ if (account->clearsign)
+ compose->sigmode = SIG_MODE_CLEAR;
+ else
+ compose->sigmode = SIG_MODE_DETACH;
+ compose_update_sigmode_menu_item(compose);
+
+ if (account->ascii_armored)
+ compose->encmode = ENC_MODE_ASCII;
+ else
+ compose->encmode = ENC_MODE_DETACH;
+
+ compose_update_encmode_menu_item(compose);
}
#endif /* USE_GPGME */
compose_send_control_enter(compose);
}
-#define EDITABLE_LENGTH(x) \
- strlen(gtk_editable_get_chars(x,0,-1))
-
static void text_inserted(GtkWidget *widget, const gchar *text,
gint length, gint *position, Compose *compose)
{
if (prefs_common.autosave &&
- EDITABLE_LENGTH(editable) % prefs_common.autosave_length == 0)
+ gtk_stext_get_length(GTK_STEXT(widget)) % prefs_common.autosave_length == 0)
compose_draft_cb((gpointer)compose, 1, NULL);
}