void compose_reedit(MsgInfo *msginfo)
{
- Compose *compose;
+ Compose *compose = NULL;
PrefsAccount *account = NULL;
GtkTextView *textview;
GtkTextBuffer *textbuf;
ComposeEntryType type)
{
gchar *header;
-
+ gchar *cur, *begin;
+ gboolean in_quote = FALSE;
if (!address || *address == '\0') return;
-#if 0 /* NEW COMPOSE GUI */
- switch (type) {
- case COMPOSE_CC:
- entry = GTK_ENTRY(compose->cc_entry);
- break;
- case COMPOSE_BCC:
- entry = GTK_ENTRY(compose->bcc_entry);
- break;
- case COMPOSE_NEWSGROUPS:
- entry = GTK_ENTRY(compose->newsgroups_entry);
- break;
- case COMPOSE_TO:
- default:
- entry = GTK_ENTRY(compose->to_entry);
- break;
- }
-
- text = gtk_entry_get_text(entry);
- if (*text != '\0')
- gtk_entry_append_text(entry, ", ");
- gtk_entry_append_text(entry, address);
-#endif
-
switch (type) {
case COMPOSE_CC:
header = N_("Cc:");
break;
}
header = prefs_common.trans_hdr ? gettext(header) : header;
-
- compose_add_header_entry(compose, header, (gchar *)address);
+
+ cur = begin = (gchar *)address;
+
+ /* we separate the line by commas, but not if we're inside a quoted
+ * string */
+ while (*cur != '\0') {
+ if (*cur == '"')
+ in_quote = !in_quote;
+ if (*cur == ',' && !in_quote) {
+ gchar *tmp = g_strdup(begin);
+ gchar *o_tmp = tmp;
+ tmp[cur-begin]='\0';
+ cur++;
+ begin = cur;
+ while (*tmp == ' ')
+ tmp++;
+ compose_add_header_entry(compose, header, tmp);
+ g_free(o_tmp);
+ continue;
+ }
+ cur++;
+ }
+ if (begin < cur) {
+ gchar *tmp = g_strdup(begin);
+ gchar *o_tmp = tmp;
+ tmp[cur-begin]='\0';
+ cur++;
+ begin = cur;
+ while (*tmp == ' ')
+ tmp++;
+ compose_add_header_entry(compose, header, tmp);
+ g_free(o_tmp);
+ }
}
void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
{
gchar *to = NULL;
gchar *cc = NULL;
- gchar *bcc = NULL;
gchar *subject = NULL;
gchar *body = NULL;
gchar *temp = NULL;
gint len = 0;
- scan_mailto_url(mailto, &to, &cc, &bcc, &subject, &body);
+ scan_mailto_url(mailto, &to, &cc, NULL, &subject, &body);
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 (subject) {
if (!g_utf8_validate (subject, -1, NULL)) {
temp = g_locale_to_utf8 (subject, -1, NULL, &len, NULL);
gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), temp);
} else {
gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), subject);
}
+ }
if (body) {
GtkTextView *text = GTK_TEXT_VIEW(compose->text);
GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
g_free(to);
g_free(cc);
- g_free(bcc);
g_free(subject);
g_free(body);
}
gchar *name;
if (!is_file_exist(file)) {
- g_warning("File %s doesn't exist\n", file);
+ g_warning("File %s doesn't exist\n", filename);
return;
}
if ((size = get_file_size(file)) < 0) {
- g_warning("Can't get file size of %s\n", file);
+ g_warning("Can't get file size of %s\n", filename);
return;
}
if (size == 0) {
- alertpanel_notice(_("File %s is empty."), file);
+ alertpanel_notice(_("File %s is empty."), filename);
return;
}
if ((fp = fopen(file, "rb")) == NULL) {
- alertpanel_error(_("Can't read %s."), file);
+ alertpanel_error(_("Can't read %s."), filename);
return;
}
fclose(fp);
static gboolean compose_is_sig_separator(Compose *compose, GtkTextBuffer *textbuf, GtkTextIter *iter)
{
- char *text = NULL;
GtkTextIter start = *iter;
GtkTextIter end_iter;
int start_pos = gtk_text_iter_get_offset(&start);
val = compose_queue(compose, &msgnum, &folder);
if (val) {
- alertpanel_error(_("Could not queue message for sending"));
+ alertpanel_error(_("Could not queue message for sending."));
goto bail;
}
compose_close(compose);
/* No more compose access in the normal codepath
* after this point! */
+ compose = NULL;
}
if (msgnum == 0) {
to_hdr = prefs_common.trans_hdr ? _("To:") : "To:";
first_to_address = TRUE;
- first_cc_address = TRUE;
for (list = compose->header_list; list; list = list->next) {
headerentry = ((ComposeHeaderEntry *)list->data);
headerentryname = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(headerentry->combo)->entry));
- if (g_utf8_collate(headerentryname, cc_hdr) == 0
- || g_utf8_collate(headerentryname, to_hdr) == 0) {
+ if (g_utf8_collate(headerentryname, to_hdr) == 0) {
const gchar *entstr = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
Xstrdup_a(str, entstr, return -1);
g_strstrip(str);
compose_convert_header
(buf, sizeof(buf), str,
strlen("Resent-To") + 2, TRUE);
- if (g_utf8_collate(headerentryname, to_hdr) == 0) {
- if (first_to_address) {
- fprintf(fp, "Resent-To: ");
- first_to_address = FALSE;
- } else {
- fprintf(fp, ",");
- }
- }
- if (g_utf8_collate(headerentryname, cc_hdr) == 0) {
- if (first_cc_address) {
- fprintf(fp, "\n");
- fprintf(fp, "Resent-Cc: ");
- first_cc_address = FALSE;
- } else {
- fprintf(fp, ",");
- }
- }
-
+
+ if (first_to_address) {
+ fprintf(fp, "Resent-To: ");
+ first_to_address = FALSE;
+ } else {
+ fprintf(fp, ",");
+ }
fprintf(fp, "%s", buf);
}
}
}
- /* if (!first_address) { */
- fprintf(fp, "\n");
- /* } */
+ if (!first_to_address) {
+ fprintf(fp, "\n");
+ }
+
+ first_cc_address = TRUE;
+ for (list = compose->header_list; list; list = list->next) {
+ headerentry = ((ComposeHeaderEntry *)list->data);
+ headerentryname = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(headerentry->combo)->entry));
+ if (g_utf8_collate(headerentryname, cc_hdr) == 0) {
+ const gchar *strg = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
+ Xstrdup_a(str, strg, return -1);
+ g_strstrip(str);
+ if (str[0] != '\0') {
+ compose_convert_header
+ (buf, sizeof(buf), str,
+ strlen("Resent-Cc") + 2, TRUE);
+
+ if (first_cc_address) {
+ fprintf(fp, "Resent-Cc: ");
+ first_cc_address = FALSE;
+ } else {
+ fprintf(fp, ",");
+ }
+ fprintf(fp, "%s", buf);
+ }
+ }
+ }
+ if (!first_cc_address) {
+ fprintf(fp, "\n");
+ }
+
return(0);
}
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))
+ 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);
FILE *fp;
size_t len;
gchar *chars, *tmp;
- const gchar *src_codeset, *dest_codeset;
if ((fp = fopen(file, "wb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
COL_NAME, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(attach_clist), column);
- gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(attach_clist), TRUE);
+ gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(attach_clist),
+ prefs_common.enable_rules_hint);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(attach_clist));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
#if USE_ASPELL
if (compose->gtkaspell) {
gtkaspell_delete(compose->gtkaspell);
+ compose->gtkaspell = NULL;
}
#endif
static void compose_attach_remove_selected(Compose *compose)
{
GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist);
- AttachInfo *ainfo;
GtkTreeSelection *selection;
GList *sel, *cur;
GtkTreeModel *model;
gpointer data)
{
Compose *compose = (Compose *)data;
- GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist);
- GtkTreeIter iter;
if (!event) return FALSE;
menu_set_sensitive(ifactory, "/Options", allow);
menu_set_sensitive(ifactory, "/Tools", allow);
menu_set_sensitive(ifactory, "/Help", allow);
+
+ gtk_text_view_set_editable(GTK_TEXT_VIEW(compose->text), allow);
+
}
static void compose_send_cb(gpointer data, guint action, GtkWidget *widget)