diff --git a/ChangeLog b/ChangeLog index 9791c7784..540f480fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-11-09 [colin] 2.6.0cvs22 + + * src/account.c + * src/compose.c + Search for one of our accounts in Delivered-To + (helps for auto-account selection when + replying/forwarding) + * src/folderview.c + * src/mainwindow.c + * src/mainwindow.h + * src/plugins/trayicon/trayicon.c + Allow opening a new mail with any account from + the contextual menu + 2006-11-09 [wwp] 2.6.0cvs21 * src/compose.c diff --git a/PATCHSETS b/PATCHSETS index 9019c0a91..8a925ab1f 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -2046,3 +2046,4 @@ ( cvs diff -u -r 1.1.2.27 -r 1.1.2.28 src/gtk/authors.h; ) > 2.6.0cvs19.patchset ( cvs diff -u -r 1.1.2.28 -r 1.1.2.29 src/gtk/authors.h; ) > 2.6.0cvs20.patchset ( cvs diff -u -r 1.382.2.324 -r 1.382.2.325 src/compose.c; cvs diff -u -r 1.204.2.108 -r 1.204.2.109 src/prefs_common.c; cvs diff -u -r 1.103.2.66 -r 1.103.2.67 src/prefs_common.h; cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/prefs_compose_writing.c; ) > 2.6.0cvs21.patchset +( cvs diff -u -r 1.61.2.54 -r 1.61.2.55 src/account.c; cvs diff -u -r 1.382.2.325 -r 1.382.2.326 src/compose.c; cvs diff -u -r 1.207.2.131 -r 1.207.2.132 src/folderview.c; cvs diff -u -r 1.274.2.154 -r 1.274.2.155 src/mainwindow.c; cvs diff -u -r 1.39.2.26 -r 1.39.2.27 src/mainwindow.h; cvs diff -u -r 1.14.2.41 -r 1.14.2.42 src/plugins/trayicon/trayicon.c; ) > 2.6.0cvs22.patchset diff --git a/configure.ac b/configure.ac index 6bd4aab64..e430802e2 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=6 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=21 +EXTRA_VERSION=22 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/account.c b/src/account.c index d873e9fa2..5e883e0e5 100644 --- a/src/account.c +++ b/src/account.c @@ -1335,6 +1335,15 @@ PrefsAccount *account_get_reply_account(MsgInfo *msginfo, gboolean reply_autosel } } } + if (!account) { + gchar deliveredto[BUFFSIZE]; + if (!procheader_get_header_from_msginfo + (msginfo, deliveredto,sizeof deliveredto , "Delivered-To:")) { + gchar *buf = deliveredto + strlen("Delivered-To:"); + extract_address(buf); + account = account_find_from_address(buf); + } + } } /* select the account for the whole folder (IMAP / NNTP) */ diff --git a/src/compose.c b/src/compose.c index a0f14802a..a6ef740f8 100644 --- a/src/compose.c +++ b/src/compose.c @@ -9194,9 +9194,20 @@ static PrefsAccount *compose_guess_forward_account_from_msginfo(MsgInfo *msginfo if (!account && prefs_common.forward_account_autosel) { gchar cc[BUFFSIZE]; if (!procheader_get_header_from_msginfo - (msginfo, cc,sizeof cc , "CC:")) { /* Found a CC header */ - extract_address(cc); - account = account_find_from_address(cc); + (msginfo, cc,sizeof cc , "Cc:")) { + gchar *buf = cc + strlen("Cc:"); + extract_address(buf); + account = account_find_from_address(buf); + } + } + + if (!account && prefs_common.forward_account_autosel) { + gchar deliveredto[BUFFSIZE]; + if (!procheader_get_header_from_msginfo + (msginfo, deliveredto,sizeof deliveredto , "Delivered-To:")) { + gchar *buf = deliveredto + strlen("Delivered-To:"); + extract_address(buf); + account = account_find_from_address(buf); } } diff --git a/src/folderview.c b/src/folderview.c index 6234b8f57..4b520d5c0 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -1684,6 +1684,7 @@ gboolean folderview_update_item_claws(gpointer source, gpointer data) ctree = GTK_CTREE(folderview->ctree); node = gtk_ctree_find_by_row_data(ctree, NULL, update_info->item); + if (node) { if (update_info->update_flags & (F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_NAME)) folderview_update_node(folderview, node); diff --git a/src/mainwindow.c b/src/mainwindow.c index 6963422ef..fb41eddaa 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1792,6 +1792,7 @@ void main_window_set_account_menu(GList *account_list) main_window_set_toolbar_combo_receive_menu(mainwin, account_list); main_window_set_toolbar_combo_compose_menu(mainwin, account_list); } + hooks_invoke(ACCOUNT_LIST_CHANGED_HOOKLIST, NULL); } void main_window_set_account_menu_only_toolbar(GList *account_list) diff --git a/src/mainwindow.h b/src/mainwindow.h index 2b592ae8b..708434471 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -32,6 +32,7 @@ typedef struct _MainWindow MainWindow; #include "toolbar.h" #define OFFLINE_SWITCH_HOOKLIST "offline_switch" +#define ACCOUNT_LIST_CHANGED_HOOKLIST "account_list_changed" typedef enum { diff --git a/src/plugins/trayicon/trayicon.c b/src/plugins/trayicon/trayicon.c index 604cbae08..b92bb29b4 100644 --- a/src/plugins/trayicon/trayicon.c +++ b/src/plugins/trayicon/trayicon.c @@ -58,6 +58,7 @@ static guint item_hook_id; static guint folder_hook_id; static guint offline_hook_id; +static guint account_hook_id; static GdkPixmap *newmail_pixmap[2]; static GdkPixmap *newmail_bitmap[2]; @@ -91,6 +92,7 @@ typedef enum static void trayicon_get_all_cb (gpointer data, guint action, GtkWidget *widget); static void trayicon_compose_cb (gpointer data, guint action, GtkWidget *widget); +static void trayicon_compose_acc_cb (GtkMenuItem *menuitem, gpointer data ); static void trayicon_addressbook_cb (gpointer data, guint action, GtkWidget *widget); static void trayicon_exit_cb (gpointer data, guint action, GtkWidget *widget); static void trayicon_toggle_offline_cb (gpointer data, guint action, GtkWidget *widget); @@ -101,6 +103,8 @@ static GtkItemFactoryEntry trayicon_popup_menu_entries[] = {N_("/_Get Mail"), NULL, trayicon_get_all_cb, 0, NULL}, {N_("/---"), NULL, NULL, 0, ""}, {N_("/_Email"), NULL, trayicon_compose_cb, 0, NULL}, + {N_("/_Email from account"), NULL, NULL, 0, ""}, + {N_("/---"), NULL, NULL, 0, ""}, {N_("/Open A_ddressbook"), NULL, trayicon_addressbook_cb, 0, NULL}, {N_("/---"), NULL, NULL, 0, ""}, {N_("/_Work Offline"), NULL, trayicon_toggle_offline_cb, 0, ""}, @@ -108,6 +112,41 @@ static GtkItemFactoryEntry trayicon_popup_menu_entries[] = {N_("/E_xit Claws Mail"), NULL, trayicon_exit_cb, 0, NULL} }; +static gboolean trayicon_set_accounts_hook(gpointer source, gpointer data) +{ + GList *cur_ac, *cur_item = NULL; + GtkWidget *menu; + GtkWidget *menuitem; + PrefsAccount *ac_prefs; + + GList *account_list = account_get_list(); + + menu = gtk_item_factory_get_widget(traymenu_factory, + "/Email from account"); + + /* destroy all previous menu item */ + cur_item = GTK_MENU_SHELL(menu)->children; + while (cur_item != NULL) { + GList *next = cur_item->next; + gtk_widget_destroy(GTK_WIDGET(cur_item->data)); + cur_item = next; + } + + for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) { + ac_prefs = (PrefsAccount *)cur_ac->data; + + menuitem = gtk_menu_item_new_with_label + (ac_prefs->account_name ? ac_prefs->account_name + : _("Untitled")); + gtk_widget_show(menuitem); + gtk_menu_append(GTK_MENU(menu), menuitem); + g_signal_connect(G_OBJECT(menuitem), "activate", + G_CALLBACK(trayicon_compose_acc_cb), + ac_prefs); + } + return FALSE; +} + static void set_trayicon_pixmap(TrayIconType icontype) { GdkPixmap *pixmap = NULL; @@ -339,7 +378,14 @@ int plugin_init(gchar **error) return -1; } + account_hook_id = hooks_register_hook (ACCOUNT_LIST_CHANGED_HOOKLIST, trayicon_set_accounts_hook, NULL); + if (offline_hook_id == -1) { + *error = g_strdup(_("Failed to register offline switch hook")); + return -1; + } + create_trayicon(); + trayicon_set_accounts_hook(NULL, NULL); return 0; } @@ -349,6 +395,7 @@ void plugin_done(void) hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, item_hook_id); hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, folder_hook_id); hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, offline_hook_id); + hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, account_hook_id); if (sylpheed_is_exiting()) return; @@ -406,6 +453,11 @@ static void trayicon_compose_cb( gpointer data, guint action, GtkWidget *widget compose_mail_cb(mainwin, 0, NULL); } +static void trayicon_compose_acc_cb( GtkMenuItem *menuitem, gpointer data ) +{ + compose_new((PrefsAccount *)data, NULL, NULL); +} + static void trayicon_addressbook_cb( gpointer data, guint action, GtkWidget *widget ) { addressbook_open(NULL);