/* check if mailto defines a from */
if (mailto && *mailto != '\0') {
- scan_mailto_url(mailto, &mailto_from, NULL, NULL, NULL, NULL, NULL, NULL);
+ scan_mailto_url(mailto, &mailto_from, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* mailto defines a from, check if we can get account prefs from it,
if not, the account prefs will be guessed using other ways, but we'll keep
the from anyway */
mfield = compose_entries_set(compose, mailto, COMPOSE_TO);
} else if (item && FOLDER_CLASS(item->folder) == news_get_class()) {
compose_entry_append(compose, item->path, COMPOSE_NEWSGROUPS, PREF_FOLDER);
+ mfield = TO_FIELD_PRESENT;
}
/*
* CLAWS: just don't allow return receipt request, even if the user
g_free(subject);
g_free(tmp);
+ mfield = SUBJECT_FIELD_PRESENT;
}
if ( body_format
g_free(tmp);
#ifdef USE_ENCHANT
- if (compose->gtkaspell->check_while_typing)
+ if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
+ mfield = BODY_FIELD_PRESENT;
}
}
/* Place cursor according to provided input (mfield) */
switch (mfield) {
case NO_FIELD_PRESENT:
- gtk_widget_grab_focus(compose->header_last->entry);
+ if (compose->header_last)
+ gtk_widget_grab_focus(compose->header_last->entry);
break;
case TO_FIELD_PRESENT:
- buf = g_strdup("");
- gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf);
+ buf = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1);
+ if (buf) {
+ gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf);
+ g_free(buf);
+ }
gtk_widget_grab_focus(compose->subject_entry);
break;
case SUBJECT_FIELD_PRESENT:
textview = GTK_TEXT_VIEW(compose->text);
+ if (!textview)
+ break;
textbuf = gtk_text_view_get_buffer(textview);
+ if (!textbuf)
+ break;
mark = gtk_text_buffer_get_insert(textbuf);
gtk_text_buffer_get_iter_at_mark(textbuf, &iter, mark);
gtk_text_buffer_insert(textbuf, &iter, "", -1);
compose->modified = FALSE;
compose_set_title(compose);
+
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
+
return compose;
}
compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
#ifdef USE_ENCHANT
- if (compose->gtkaspell->check_while_typing)
+ if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
return NULL;
}
END_TIMING();
+
return compose;
}
procmsg_msginfo_free(full_msginfo);
#ifdef USE_ENCHANT
- if (compose->gtkaspell->check_while_typing)
+ if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
return NULL;
}
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
+
return compose;
}
return NULL;
}
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
+
return compose;
}
}
if (folder_has_parent_of_type(msginfo->folder, F_QUEUE) ||
- folder_has_parent_of_type(msginfo->folder, F_DRAFT)) {
+ folder_has_parent_of_type(msginfo->folder, F_DRAFT) ||
+ folder_has_parent_of_type(msginfo->folder, F_OUTBOX)) {
gchar queueheader_buf[BUFFSIZE];
gint id, param;
compose_extract_original_charset(compose);
if (folder_has_parent_of_type(msginfo->folder, F_QUEUE) ||
- folder_has_parent_of_type(msginfo->folder, F_DRAFT)) {
+ folder_has_parent_of_type(msginfo->folder, F_DRAFT) ||
+ folder_has_parent_of_type(msginfo->folder, F_OUTBOX)) {
gchar queueheader_buf[BUFFSIZE];
/* Set message save folder */
compose->sig_str = account_get_signature_str(compose->account);
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
+
return compose;
}
return NULL;
}
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
+
return compose;
}
case COMPOSE_FOLLOWUPTO:
header = N_( "Followup-To:");
break;
+ case COMPOSE_INREPLYTO:
+ header = N_( "In-Reply-To:");
+ break;
case COMPOSE_TO:
default:
header = N_("To:");
gchar *temp = NULL;
gsize len = 0;
gchar **attach = NULL;
+ gchar *inreplyto = NULL;
MailField mfield = NO_FIELD_PRESENT;
/* get mailto parts but skip from */
- scan_mailto_url(mailto, NULL, &to, &cc, &bcc, &subject, &body, &attach);
+ scan_mailto_url(mailto, NULL, &to, &cc, &bcc, &subject, &body, &attach, &inreplyto);
if (to) {
compose_entry_append(compose, to, to_type, PREF_MAILTO);
g_free(warn_files);
}
}
+ if (inreplyto)
+ compose_entry_append(compose, inreplyto, COMPOSE_INREPLYTO, PREF_MAILTO);
+
g_free(to);
g_free(cc);
g_free(bcc);
g_free(subject);
g_free(body);
g_strfreev(attach);
+ g_free(inreplyto);
return mfield;
}
start = strstr(hentry[H_LIST_POST].body, "mailto:");
scan_mailto_url(start ? start : hentry[H_LIST_POST].body,
- NULL, &to, NULL, NULL, NULL, NULL, NULL);
+ NULL, &to, NULL, NULL, NULL, NULL, NULL, NULL);
if (to) {
g_free(compose->ml_post);
GSList *cur;
gchar *from = NULL;
gchar *replyto = NULL;
+ gchar *ac_email = NULL;
gboolean reply_to_ml = FALSE;
gboolean default_reply_to = FALSE;
cc_list = address_list_append_with_comments(cc_list, msginfo->to);
cc_list = address_list_append_with_comments(cc_list, compose->cc);
+ ac_email = g_utf8_strdown(compose->account->address, -1);
+
if (cc_list) {
- for (cur = cc_list; cur != NULL; cur = cur->next)
- compose_entry_append(compose, (gchar *)cur->data,
- COMPOSE_CC, PREF_NONE);
+ for (cur = cc_list; cur != NULL; cur = cur->next) {
+ gchar *addr = g_utf8_strdown(cur->data, -1);
+ extract_address(addr);
+
+ if (strcmp(ac_email, addr))
+ compose_entry_append(compose, (gchar *)cur->data,
+ COMPOSE_CC, PREF_NONE);
+ else
+ debug_print("Cc address same as compose account's, ignoring\n");
+
+ g_free(addr);
+ }
+
slist_free_strings(cc_list);
g_slist_free(cc_list);
}
+
+ g_free(ac_email);
}
#define SET_ENTRY(entry, str) \
SET_ADDRESS(COMPOSE_REPLYTO, compose->replyto);
SET_ADDRESS(COMPOSE_NEWSGROUPS, compose->newsgroups);
SET_ADDRESS(COMPOSE_FOLLOWUPTO, compose->followup_to);
+ SET_ADDRESS(COMPOSE_INREPLYTO, compose->inreplyto);
compose_update_priority_menu_item(compose);
compose_update_privacy_system_menu_item(compose, FALSE);
static void compose_select_account(Compose *compose, PrefsAccount *account,
gboolean init)
{
- gchar *from = NULL, *email, *header;
+ gchar *from = NULL, *header;
ComposeHeaderEntry *header_entry;
cm_return_if_fail(account != NULL);
- email = g_utf8_strdown(compose->account->address, -1);
- g_hash_table_remove(compose->email_hashtable, email);
- g_free(email);
-
compose->account = account;
- g_hash_table_insert(compose->email_hashtable,
- g_utf8_strdown(account->address, -1),
- GUINT_TO_POINTER(1));
-
if (account->name && *account->name) {
gchar *buf;
QUOTE_IF_REQUIRED_NORMAL(buf, account->name, return);
{
ComposeHeaderEntry *last_header = compose->header_last;
gchar *tmp = g_strdup(text), *email;
+ gboolean replyto_hdr = g_str_has_suffix(header, "-To:");
extract_address(tmp);
email = g_utf8_strdown(tmp, -1);
- if (!(!strcmp(header, "To:") && !strcasecmp(compose->account->address, email))
- && g_hash_table_lookup(compose->email_hashtable, email) != NULL) {
+ if (replyto_hdr == FALSE &&
+ g_hash_table_lookup(compose->email_hashtable, email) != NULL)
+ {
debug_print("Ignoring duplicate address - %s %s, pref_type: %d\n",
header, text, (gint) pref_type);
g_free(email);
return;
}
- combobox_select_by_text(GTK_COMBO_BOX(last_header->combo), header);
+ if (!strcmp(header, prefs_common_translated_header_name("In-Reply-To:")))
+ gtk_entry_set_text(GTK_ENTRY(
+ gtk_bin_get_child(GTK_BIN(last_header->combo))), header);
+ else
+ combobox_select_by_text(GTK_COMBO_BOX(last_header->combo), header);
gtk_entry_set_text(GTK_ENTRY(last_header->entry), text);
last_header->type = pref_type;
- g_hash_table_insert(compose->email_hashtable, email,
- GUINT_TO_POINTER(1));
+ if (replyto_hdr == FALSE)
+ g_hash_table_insert(compose->email_hashtable, email,
+ GUINT_TO_POINTER(1));
+ else
+ g_free(email);
+
g_free(tmp);
}
{
Compose *compose = (Compose *) data;
- if(compose->gtkaspell->recheck_when_changing_dict == FALSE)
+ if(compose->gtkaspell &&
+ compose->gtkaspell->recheck_when_changing_dict == FALSE)
return;
gtkaspell_highlight_all(compose->gtkaspell);
}
}
}
- compose->gtkaspell = gtkaspell;
+ compose->gtkaspell = gtkaspell;
compose_spell_menu_changed(compose);
claws_spell_entry_set_gtkaspell(CLAWS_SPELL_ENTRY(subject_entry), gtkaspell);
#endif
compose_changed_cb(NULL, compose);
#ifdef USE_ENCHANT
- if (compose->gtkaspell->check_while_typing)
+ if (compose->gtkaspell && compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
slist_free_strings(compose->header_list);
g_slist_free(compose->header_list);
+ compose->header_list = compose->newsgroup_list = compose->to_list = NULL;
+
g_hash_table_destroy(compose->email_hashtable);
procmsg_msginfo_free(compose->targetinfo);
}
#ifdef USE_ENCHANT
- if (files_inserted > 0 && compose->gtkaspell->check_while_typing)
+ if (files_inserted > 0 && compose->gtkaspell &&
+ compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
#ifdef USE_ENCHANT
if (GTK_WIDGET_HAS_FOCUS(compose->text) &&
- compose->gtkaspell->check_while_typing)
+ compose->gtkaspell &&
+ compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
#ifdef USE_ENCHANT
if (GTK_WIDGET_HAS_FOCUS(compose->text) &&
- compose->gtkaspell->check_while_typing)
+ compose->gtkaspell &&
+ compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
#ifdef USE_ENCHANT
if (GTK_WIDGET_HAS_FOCUS(compose->text) &&
- compose->gtkaspell->check_while_typing)
+ compose->gtkaspell &&
+ compose->gtkaspell->check_while_typing)
gtkaspell_highlight_all(compose->gtkaspell);
#endif
}
}
g_free(s_system);
g_free(body);
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
}
void compose_reply_from_messageview(MessageView *msgview, GSList *msginfo_list,