FolderItem *folder_item);
#endif
static void compose_attach_update_label(Compose *compose);
+static void compose_set_folder_prefs(Compose *compose, FolderItem *folder,
+ gboolean respect_default_to);
static GtkActionEntry compose_popup_entries[] =
{
if (mailto && *mailto != '\0') {
mfield = compose_entries_set(compose, mailto, COMPOSE_TO);
- } else if (item && item->prefs) {
- if (item->prefs->enable_default_bcc) {
- compose_entry_append(compose, item->prefs->default_bcc,
- COMPOSE_BCC, PREF_FOLDER);
- }
- if (item->prefs->enable_default_cc) {
- compose_entry_append(compose, item->prefs->default_cc,
- COMPOSE_CC, PREF_FOLDER);
- }
- if (item->prefs->enable_default_replyto) {
- compose_entry_append(compose, item->prefs->default_replyto,
- COMPOSE_REPLYTO, PREF_FOLDER);
- }
- if (item->prefs->enable_default_to) {
- compose_entry_append(compose, item->prefs->default_to,
- COMPOSE_TO, PREF_FOLDER);
- compose_entry_mark_default_to(compose, item->prefs->default_to);
- }
+ } else {
+ compose_set_folder_prefs(compose, item, TRUE);
}
if (item && item->ret_rcpt) {
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE);
switch (mode) {
case COMPOSE_REPLY:
+ case COMPOSE_REPLY_TO_ADDRESS:
compose = compose_reply(msginfo, COMPOSE_QUOTE_CHECK,
FALSE, prefs_common.default_reply_list, FALSE, body);
break;
debug_print("reply mode List\n");
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/ReplyMode/List", TRUE);
break;
+ case COMPOSE_REPLY_TO_ADDRESS:
+ cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/ReplyMode", FALSE);
+ break;
default:
break;
}
gboolean to_all,
gboolean to_ml,
gboolean to_sender,
- const gchar *body)
+ const gchar *body)
{
return compose_generic_reply(msginfo, quote_mode, to_all, to_ml,
to_sender, FALSE, body);
return result;
}
+static void compose_set_folder_prefs(Compose *compose, FolderItem *folder,
+ gboolean respect_default_to)
+{
+ if (!compose)
+ return;
+ if (!folder || !folder->prefs)
+ return;
+
+ if (respect_default_to && folder->prefs->enable_default_to) {
+ compose_entry_append(compose, folder->prefs->default_to,
+ COMPOSE_TO, PREF_FOLDER);
+ compose_entry_mark_default_to(compose, folder->prefs->default_to);
+ }
+ if (folder->prefs->enable_default_cc)
+ compose_entry_append(compose, folder->prefs->default_cc,
+ COMPOSE_CC, PREF_FOLDER);
+ if (folder->prefs->enable_default_bcc)
+ compose_entry_append(compose, folder->prefs->default_bcc,
+ COMPOSE_BCC, PREF_FOLDER);
+ if (folder->prefs->enable_default_replyto)
+ compose_entry_append(compose, folder->prefs->default_replyto,
+ COMPOSE_REPLYTO, PREF_FOLDER);
+}
+
+static void compose_reply_set_subject(Compose *compose, MsgInfo *msginfo)
+{
+ gchar *buf, *buf2;
+ gchar *p;
+
+ if (!compose || !msginfo)
+ return;
+
+ if (msginfo->subject && *msginfo->subject) {
+ buf = p = g_strdup(msginfo->subject);
+ p += subject_get_prefix_length(p);
+ memmove(buf, p, strlen(p) + 1);
+
+ buf2 = g_strdup_printf("Re: %s", buf);
+ gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf2);
+
+ g_free(buf2);
+ g_free(buf);
+ } else
+ gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), "Re: ");
+}
+
static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
gboolean to_all, gboolean to_ml,
gboolean to_sender,
msginfo->folder->prefs->enable_default_reply_to;
if (compose->account->protocol != A_NNTP) {
- if (msginfo && msginfo->folder && msginfo->folder->prefs) {
- if (msginfo->folder->prefs->enable_default_replyto) {
- compose_entry_append(compose, msginfo->folder->prefs->default_replyto,
- COMPOSE_REPLYTO, PREF_FOLDER);
- }
- if (msginfo->folder->prefs->enable_default_bcc) {
- compose_entry_append(compose, msginfo->folder->prefs->default_bcc,
- COMPOSE_BCC, PREF_FOLDER);
- }
- if (msginfo->folder->prefs->enable_default_cc) {
- compose_entry_append(compose, msginfo->folder->prefs->default_cc,
- COMPOSE_CC, PREF_FOLDER);
- }
- }
+ compose_set_folder_prefs(compose, msginfo->folder, FALSE);
+
if (reply_to_ml && !default_reply_to) {
gboolean is_subscr = is_subscription(compose->ml_post,
compose->newsgroups ? compose->newsgroups : "",
COMPOSE_NEWSGROUPS, PREF_NONE);
}
-
- if (msginfo->subject && *msginfo->subject) {
- gchar *buf, *buf2;
- gchar *p;
-
- buf = p = g_strdup(msginfo->subject);
- p += subject_get_prefix_length(p);
- memmove(buf, p, strlen(p) + 1);
-
- buf2 = g_strdup_printf("Re: %s", buf);
- gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf2);
-
- g_free(buf2);
- g_free(buf);
- } else
- gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), "Re: ");
+ compose_reply_set_subject(compose, msginfo);
if (to_ml && compose->ml_post) return;
if (!to_all || compose->account->protocol == A_NNTP) return;
CLAWS_SET_TIP(from_name,
_("Sender address to be used"));
+ compose->account_combo = optmenu;
compose->from_name = from_name;
return hbox;
}
}
+void compose_check_for_email_account(Compose *compose)
+{
+ PrefsAccount *ac = NULL, *curr = NULL;
+ GList *list;
+
+ if (!compose)
+ return;
+
+ if (compose->account && compose->account->protocol == A_NNTP) {
+ ac = account_get_cur_account();
+ if (ac->protocol == A_NNTP) {
+ list = account_get_list();
+
+ for( ; list != NULL ; list = g_list_next(list)) {
+ curr = (PrefsAccount *) list->data;
+ if (curr->protocol != A_NNTP) {
+ ac = curr;
+ break;
+ }
+ }
+ }
+ combobox_select_by_data(GTK_COMBO_BOX(compose->account_combo),
+ ac->account_id);
+ }
+}
+
+void compose_reply_to_address(MessageView *msgview, MsgInfo *msginfo,
+ const gchar *address)
+{
+ GSList *msginfo_list = NULL;
+ gchar *body = messageview_get_selection(msgview);
+ Compose *compose;
+
+ msginfo_list = g_slist_prepend(msginfo_list, msginfo);
+
+ compose = compose_reply_mode(COMPOSE_REPLY_TO_ADDRESS, msginfo_list, body);
+ compose_check_for_email_account(compose);
+ compose_set_folder_prefs(compose, msginfo->folder, FALSE);
+ compose_entry_append(compose, address, COMPOSE_TO, PREF_NONE);
+ compose_reply_set_subject(compose, msginfo);
+
+ g_free(body);
+ hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
+}
+
void compose_set_position(Compose *compose, gint pos)
{
GtkTextView *text = GTK_TEXT_VIEW(compose->text);
TextView *textview);
static void add_uri_to_addrbook_cb (GtkAction *action,
TextView *textview);
+static void reply_to_uri_cb (GtkAction *action,
+ TextView *textview);
static void mail_to_uri_cb (GtkAction *action,
TextView *textview);
static void copy_mail_to_uri_cb (GtkAction *action,
{
{"TextviewPopupMail", NULL, "TextviewPopupMail" },
{"TextviewPopupMail/Compose", NULL, N_("Compose _new message"), NULL, NULL, G_CALLBACK(mail_to_uri_cb) },
+ {"TextviewPopupMail/ReplyTo", NULL, N_("_Reply to this address"), NULL, NULL, G_CALLBACK(reply_to_uri_cb) },
{"TextviewPopupMail/AddAB", NULL, N_("Add to _Address book"), NULL, NULL, G_CALLBACK(add_uri_to_addrbook_cb) },
{"TextviewPopupMail/Copy", NULL, N_("Copy this add_ress"), NULL, NULL, G_CALLBACK(copy_mail_to_uri_cb) },
};
"/Menus/TextviewPopupLink", "Copy", "TextviewPopupLink/Copy", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(textview->ui_manager,
"/Menus/TextviewPopupMail", "Compose", "TextviewPopupMail/Compose", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(textview->ui_manager,
+ "/Menus/TextviewPopupMail", "ReplyTo", "TextviewPopupMail/ReplyTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(textview->ui_manager,
"/Menus/TextviewPopupMail", "AddAB", "TextviewPopupMail/AddAB", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(textview->ui_manager,
} else {
PrefsAccount *account = NULL;
FolderItem *folder_item = NULL;
+ Compose *compose;
+
if (textview->messageview && textview->messageview->msginfo &&
textview->messageview->msginfo->folder) {
if (!account)
account = account_find_from_item(folder_item);
}
- compose_new_with_folderitem(account, folder_item, uri->uri + 7);
+ compose = compose_new_with_folderitem(account,
+ folder_item, uri->uri + 7);
+ compose_check_for_email_account(compose);
}
return TRUE;
} else if (g_ascii_strncasecmp(uri->uri, "file:", 5)) {
g_free(fromname);
}
+static void reply_to_uri_cb (GtkAction *action, TextView *textview)
+{
+ ClickableText *uri = g_object_get_data(G_OBJECT(textview->mail_popup_menu),
+ "menu_button");
+ if (!textview->messageview || !uri)
+ return;
+
+ compose_reply_to_address (textview->messageview,
+ textview->messageview->msginfo, uri->uri+7);
+}
+
static void mail_to_uri_cb (GtkAction *action, TextView *textview)
{
PrefsAccount *account = NULL;
+ Compose *compose;
ClickableText *uri = g_object_get_data(G_OBJECT(textview->mail_popup_menu),
"menu_button");
if (uri == NULL)
if (folder_item->prefs && folder_item->prefs->enable_default_account)
account = account_find_from_id(folder_item->prefs->default_account);
- compose_new_with_folderitem(account, folder_item, uri->uri+7);
+ compose = compose_new_with_folderitem(account, folder_item, uri->uri+7);
} else {
- compose_new(account, uri->uri + 7, NULL);
+ compose = compose_new(account, uri->uri + 7, NULL);
}
+ compose_check_for_email_account(compose);
}
static void copy_mail_to_uri_cb (GtkAction *action, TextView *textview)