/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gtk_widget_grab_focus(compose->header_last->entry);
- filename = procmsg_get_message_file(msginfo);
+ filename = procmsg_get_message_file_path(msginfo);
if (filename == NULL)
return NULL;
ifactory = gtk_item_factory_from_widget(compose->popupmenu);
menu_set_sensitive(ifactory, "/Add...", FALSE);
menu_set_sensitive(ifactory, "/Remove", FALSE);
- menu_set_sensitive(ifactory, "/Property...", FALSE);
+ menu_set_sensitive(ifactory, "/Properties...", FALSE);
ifactory = gtk_item_factory_from_widget(compose->menubar);
menu_set_sensitive(ifactory, "/Message/Save", FALSE);
menu_set_sensitive(ifactory, "/Message/Attach file", FALSE);
menu_set_sensitive(ifactory, "/Message/Insert signature", FALSE);
menu_set_sensitive(ifactory, "/Edit", FALSE);
- menu_set_sensitive(ifactory, "/Options/Sign", FALSE);
- menu_set_sensitive(ifactory, "/Options/Encrypt", FALSE);
- menu_set_sensitive(ifactory, "/Options/Priority", FALSE);
- menu_set_sensitive(ifactory, "/Options/Request Return Receipt", FALSE);
+ menu_set_sensitive(ifactory, "/Options", FALSE);
menu_set_sensitive(ifactory, "/Tools/Show ruler", FALSE);
menu_set_sensitive(ifactory, "/Tools/Actions", FALSE);
};
FILE *fp;
+ gchar buf[BUFFSIZE];
g_return_val_if_fail(msginfo != NULL, -1);
fclose(fp);
if (hentry[H_REPLY_TO].body != NULL) {
- conv_unmime_header_overwrite(hentry[H_REPLY_TO].body);
- compose->replyto = hentry[H_REPLY_TO].body;
+ conv_unmime_header(buf, sizeof(buf), hentry[H_REPLY_TO].body,
+ NULL);
+ compose->replyto = g_strdup(buf);
+ g_free(hentry[H_REPLY_TO].body);
hentry[H_REPLY_TO].body = NULL;
}
if (hentry[H_CC].body != NULL) {
- conv_unmime_header_overwrite(hentry[H_CC].body);
- compose->cc = hentry[H_CC].body;
+ conv_unmime_header(buf, sizeof(buf), hentry[H_CC].body, NULL);
+ compose->cc = g_strdup(buf);
+ g_free(hentry[H_CC].body);
hentry[H_CC].body = NULL;
}
if (hentry[H_REFERENCES].body != NULL) {
}
if (hentry[H_BCC].body != NULL) {
if (compose->mode == COMPOSE_REEDIT) {
- conv_unmime_header_overwrite(hentry[H_BCC].body);
- compose->bcc = hentry[H_BCC].body;
- } else
- g_free(hentry[H_BCC].body);
+ conv_unmime_header
+ (buf, sizeof(buf), hentry[H_BCC].body, NULL);
+ compose->bcc = g_strdup(buf);
+ }
+ g_free(hentry[H_BCC].body);
hentry[H_BCC].body = NULL;
}
if (hentry[H_NEWSGROUPS].body != NULL) {
- conv_unmime_header_overwrite(hentry[H_NEWSGROUPS].body);
compose->newsgroups = hentry[H_NEWSGROUPS].body;
hentry[H_NEWSGROUPS].body = NULL;
}
if (hentry[H_FOLLOWUP_TO].body != NULL) {
- conv_unmime_header_overwrite(hentry[H_FOLLOWUP_TO].body);
- compose->followup_to = hentry[H_FOLLOWUP_TO].body;
+ conv_unmime_header
+ (buf, sizeof(buf), hentry[H_FOLLOWUP_TO].body, NULL);
+ compose->followup_to = g_strdup(buf);
+ g_free(hentry[H_FOLLOWUP_TO].body);
hentry[H_FOLLOWUP_TO].body = NULL;
}
if (hentry[H_LIST_POST].body != NULL) {
compose->priority = priority;
}
- if (compose->mode == COMPOSE_REEDIT && msginfo->inreplyto)
- compose->inreplyto = g_strdup(msginfo->inreplyto);
- else if (compose->mode != COMPOSE_REEDIT &&
- msginfo->msgid && *msginfo->msgid) {
+ if (compose->mode == COMPOSE_REEDIT) {
+ if (msginfo->inreplyto && *msginfo->inreplyto)
+ compose->inreplyto = g_strdup(msginfo->inreplyto);
+ return 0;
+ }
+
+ if (msginfo->msgid && *msginfo->msgid)
compose->inreplyto = g_strdup(msginfo->msgid);
- if (!compose->references) {
+ if (!compose->references) {
+ if (msginfo->msgid && *msginfo->msgid) {
if (msginfo->inreplyto && *msginfo->inreplyto)
compose->references =
g_strdup_printf("<%s>\n\t<%s>",
compose->references =
g_strconcat("<", msginfo->msgid, ">",
NULL);
+ } else if (msginfo->inreplyto && *msginfo->inreplyto) {
+ compose->references =
+ g_strconcat("<", msginfo->inreplyto, ">",
+ NULL);
}
}
}
GET_CHAR(cur_pos, cb, clen);
-
- /* insert space if it's alphanumeric */
- if ((cur_pos != line_pos) &&
- ((clen > 1) || isalnum((guchar)cb[0]))) {
- gtk_stext_insert(text, NULL, NULL,
- NULL, " ", 1);
- tlen++;
+ /* insert space between the next line */
+ if (cur_pos > 0) {
+ gint clen_prev;
+ gchar cb_prev[MB_LEN_MAX];
+
+ GET_CHAR(cur_pos - 1, cb_prev,
+ clen_prev);
+ if ((clen_prev != clen && clen > 1) ||
+ (clen == 1 &&
+ !isspace((guchar)cb[0]))) {
+ gtk_stext_insert
+ (text, NULL, NULL,
+ NULL, " ", 1);
+ tlen++;
+ }
}
/* and start over with current line */
#endif
- if (account->default_sign)
+ if (account->default_sign && compose->mode != COMPOSE_REDIRECT)
menu_set_active(ifactory, "/Options/Sign", TRUE);
else
menu_set_active(ifactory, "/Options/Sign", FALSE);
- if (account->default_encrypt)
+ if (account->default_encrypt && compose->mode != COMPOSE_REDIRECT)
menu_set_active(ifactory, "/Options/Encrypt", TRUE);
else
menu_set_active(ifactory, "/Options/Encrypt", FALSE);
if (action == COMPOSE_WRITE_FOR_SEND) {
buf = conv_codeset_strdup(chars, src_codeset, out_codeset);
+
if (!buf) {
AlertValue aval;
gchar *msg;
}
g_free(chars);
+ if (encoding == ENC_8BIT || encoding == ENC_7BIT) {
+ if (!strncmp(buf, "From ", sizeof("From ")-1) ||
+ strstr(buf, "\nFrom ") != NULL) {
+ encoding = ENC_QUOTED_PRINTABLE;
+ }
+ }
+
mimetext = procmime_mimeinfo_new();
mimetext->content = MIMECONTENT_MEM;
mimetext->data.mem = buf;
mimetext->subtype = g_strdup("plain");
g_hash_table_insert(mimetext->typeparameters, g_strdup("charset"),
g_strdup(out_codeset));
+ /* protect trailing spaces when signing message */
+ if (action == COMPOSE_WRITE_FOR_SEND && compose->use_signing &&
+ privacy_system_can_sign(compose->privacy_system))
+ if (encoding == ENC_7BIT)
+ encoding = ENC_QUOTED_PRINTABLE;
+ else if (encoding == ENC_8BIT)
+ encoding = ENC_BASE64;
if (encoding != ENC_UNKNOWN)
procmime_encode_content(mimetext, encoding);
return -1;
procmime_write_mimeinfo(mimemsg, fp);
+
+ procmime_mimeinfo_free_all(mimemsg);
return 0;
}
mimepart->disposition = DISPOSITIONTYPE_ATTACHMENT;
}
+ if (compose->use_signing) {
+ if (ainfo->encoding == ENC_7BIT)
+ ainfo->encoding = ENC_QUOTED_PRINTABLE;
+ else if (ainfo->encoding == ENC_8BIT)
+ ainfo->encoding = ENC_BASE64;
+ }
+
procmime_encode_content(mimepart, ainfo->encoding);
g_node_append(parent->node, mimepart->node);
ifactory = gtk_item_factory_from_widget(compose->menubar);
menu_set_sensitive(ifactory, "/Options/Sign", can_sign);
+ if (!can_sign)
+ menu_set_active(ifactory, "/Options/Sign", FALSE);
menu_set_sensitive(ifactory, "/Options/Encrypt", can_encrypt);
+ if (!can_encrypt)
+ menu_set_active(ifactory, "/Options/Encrypt", FALSE);
}
static void compose_update_privacy_system_menu_item(Compose * compose)
prefs_common.compose_width = compose->scrolledwin->allocation.width;
prefs_common.compose_height = compose->window->allocation.height;
- gtk_widget_destroy(compose->paned);
+ if (!compose->paned->parent)
+ gtk_widget_destroy(compose->paned);
+ gtk_widget_destroy(compose->popupmenu);
toolbar_destroy(compose->toolbar);
g_free(compose->toolbar);
}
fprintf(fp, "X-Sylpheed-Sign:%d\n", compose->use_signing);
fprintf(fp, "X-Sylpheed-Encrypt:%d\n", compose->use_encryption);
- fprintf(fp, "X-Sylpheed-Gnupg-Mode:%s\n", compose->privacy_system);
+ fprintf(fp, "X-Sylpheed-Privacy-System:%s\n", compose->privacy_system);
fprintf(fp, "\n");
if (compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_STORE) < 0) {
}
}
+void compose_reply_from_messageview(MessageView *msgview, GSList *msginfo_list,
+ guint action)
+{
+ gchar *body;
+ GSList *new_msglist = NULL;
+ MsgInfo *tmp_msginfo = NULL;
+
+ g_return_if_fail(msgview != NULL);
+
+ g_return_if_fail(msginfo_list != NULL);
+
+ if (g_slist_length(msginfo_list) == 1) {
+ MimeInfo *mimeinfo = messageview_get_selected_mime_part(msgview);
+ MsgInfo *orig_msginfo = (MsgInfo *)msginfo_list->data;
+
+ if (mimeinfo != NULL && mimeinfo->type == MIMETYPE_MESSAGE &&
+ !g_strcasecmp(mimeinfo->subtype, "rfc822")) {
+
+ tmp_msginfo = procmsg_msginfo_new_from_mimeinfo(
+ orig_msginfo, mimeinfo);
+ if (tmp_msginfo != NULL) {
+ new_msglist = g_slist_append(NULL, tmp_msginfo);
+ }
+ }
+ }
+
+ body = messageview_get_selection(msgview);
+
+ if (new_msglist) {
+ compose_reply_mode((ComposeMode)action, new_msglist, body);
+ procmsg_msginfo_free(tmp_msginfo);
+ g_slist_free(new_msglist);
+ } else
+ compose_reply_mode((ComposeMode)action, msginfo_list, body);
+
+ g_free(body);
+}
+
/*
* End of Source.
*/
-