2007-01-06 [colin] 2.6.1cvs113
authorColin Leroy <colin@colino.net>
Sat, 6 Jan 2007 17:57:16 +0000 (17:57 +0000)
committerColin Leroy <colin@colino.net>
Sat, 6 Jan 2007 17:57:16 +0000 (17:57 +0000)
* src/etpan/imap-thread.c
Add casts to int to get certs. Fixes
bug 1064, 'crash @ etpan_certificate_check()
when opening an IMAP folder', with latest
libetpan CVS or >= 0.49
* src/mainwindow.c
* src/mainwindow.h
* src/imap_gtk.c
* src/news_gtk.c
* src/prefs_folder_item.c
Grey out the "synchronise" menu items if
there's nothing to synchronise.
* src/plugins/pgpcore/sgpgme.c
Make an error clearer than "Unknown error"

ChangeLog
PATCHSETS
configure.ac
src/etpan/imap-thread.c
src/imap_gtk.c
src/mainwindow.c
src/mainwindow.h
src/news_gtk.c
src/plugins/pgpcore/sgpgme.c
src/prefs_folder_item.c

index 373b6d9b35a8b48dcefa6c0952eb4306ccbb791d..084538c2fd44162702bf3dc9ce26db9b7d46b62c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-01-06 [colin]     2.6.1cvs113
+
+       * src/etpan/imap-thread.c
+               Add casts to int to get certs. Fixes
+               bug 1064, 'crash @ etpan_certificate_check() 
+               when opening an IMAP folder', with latest
+               libetpan CVS or >= 0.49
+       * src/mainwindow.c
+       * src/mainwindow.h
+       * src/imap_gtk.c
+       * src/news_gtk.c
+       * src/prefs_folder_item.c
+               Grey out the "synchronise" menu items if
+               there's nothing to synchronise.
+       * src/plugins/pgpcore/sgpgme.c
+               Make an error clearer than "Unknown error"
+
 2007-01-06 [colin]     2.6.1cvs112
 
        * src/messageview.c
 2007-01-06 [colin]     2.6.1cvs112
 
        * src/messageview.c
index c44365b0b1fd7dd608a06dacb983bc89cb39166b..afb088feeefc9054da114d77e32cc8cbb1fabb61 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.145 -r 1.179.2.146 src/imap.c;  cvs diff -u -r 1.16.2.48 -r 1.16.2.49 src/msgcache.c;  ) > 2.6.1cvs110.patchset
 ( cvs diff -u -r 1.395.2.273 -r 1.395.2.274 src/summaryview.c;  ) > 2.6.1cvs111.patchset
 ( cvs diff -u -r 1.94.2.115 -r 1.94.2.116 src/messageview.c;  ) > 2.6.1cvs112.patchset
 ( cvs diff -u -r 1.179.2.145 -r 1.179.2.146 src/imap.c;  cvs diff -u -r 1.16.2.48 -r 1.16.2.49 src/msgcache.c;  ) > 2.6.1cvs110.patchset
 ( cvs diff -u -r 1.395.2.273 -r 1.395.2.274 src/summaryview.c;  ) > 2.6.1cvs111.patchset
 ( cvs diff -u -r 1.94.2.115 -r 1.94.2.116 src/messageview.c;  ) > 2.6.1cvs112.patchset
+( cvs diff -u -r 1.1.2.37 -r 1.1.2.38 src/imap_gtk.c;  cvs diff -u -r 1.274.2.160 -r 1.274.2.161 src/mainwindow.c;  cvs diff -u -r 1.39.2.28 -r 1.39.2.29 src/mainwindow.h;  cvs diff -u -r 1.2.2.20 -r 1.2.2.21 src/news_gtk.c;  cvs diff -u -r 1.52.2.33 -r 1.52.2.34 src/prefs_folder_item.c;  cvs diff -u -r 1.1.4.62 -r 1.1.4.63 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.2.38 -r 1.1.2.39 src/plugins/pgpcore/sgpgme.c;  ) > 2.6.1cvs113.patchset
index bd4dbb5831d5492ae9fcc911e82d20c919e09e6a..c5f03b368da9816f58d6937aa5ee594dd1ff1fa9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=112
+EXTRA_VERSION=113
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6030636ad65db7aa66c7caf74dc5a06dfde668cc..c15b8f20df5855e7d3ccf89873026d22424bca15 100644 (file)
@@ -440,7 +440,7 @@ static int etpan_certificate_check(const unsigned char *certificate, int len, vo
 #ifdef USE_OPENSSL
        struct connect_param *param = (struct connect_param *)data;
        X509 *cert = NULL;
 #ifdef USE_OPENSSL
        struct connect_param *param = (struct connect_param *)data;
        X509 *cert = NULL;
-
+       
        if (certificate == NULL || len < 0) {
                g_warning("no cert presented.\n");
                return 0;
        if (certificate == NULL || len < 0) {
                g_warning("no cert presented.\n");
                return 0;
@@ -502,10 +502,10 @@ int imap_threaded_connect_ssl(Folder * folder, const char * server, int port)
        
        refresh_resolvers();
        threaded_run(folder, &param, &result, connect_ssl_run);
        
        refresh_resolvers();
        threaded_run(folder, &param, &result, connect_ssl_run);
-       
+
        if ((result.error == MAILIMAP_NO_ERROR_AUTHENTICATED ||
             result.error == MAILIMAP_NO_ERROR_NON_AUTHENTICATED) && !etpan_skip_ssl_cert_check) {
        if ((result.error == MAILIMAP_NO_ERROR_AUTHENTICATED ||
             result.error == MAILIMAP_NO_ERROR_NON_AUTHENTICATED) && !etpan_skip_ssl_cert_check) {
-               cert_len = mailstream_ssl_get_certificate(imap->imap_stream, &certificate);
+               cert_len = (int)mailstream_ssl_get_certificate(imap->imap_stream, &certificate);
                if (etpan_certificate_check(certificate, cert_len, &param) < 0)
                        return -1;
                if (certificate) 
                if (etpan_certificate_check(certificate, cert_len, &param) < 0)
                        return -1;
                if (certificate) 
@@ -946,9 +946,9 @@ int imap_threaded_starttls(Folder * folder, const gchar *host, int port)
        threaded_run(folder, &param, &result, starttls_run);
        
        debug_print("imap starttls - end\n");
        threaded_run(folder, &param, &result, starttls_run);
        
        debug_print("imap starttls - end\n");
-       
+
        if (result.error == 0 && !etpan_skip_ssl_cert_check) {
        if (result.error == 0 && !etpan_skip_ssl_cert_check) {
-               cert_len = mailstream_ssl_get_certificate(param.imap->imap_stream, &certificate);
+               cert_len = (int)mailstream_ssl_get_certificate(param.imap->imap_stream, &certificate);
                if (etpan_certificate_check(certificate, cert_len, &param) < 0)
                        result.error = MAILIMAP_ERROR_STREAM;
                if (certificate) 
                if (etpan_certificate_check(certificate, cert_len, &param) < 0)
                        result.error = MAILIMAP_ERROR_STREAM;
                if (certificate) 
index bd76cb20bd0b77cc93ddaa7180b1fe97468a0cb4..5a80b5dd0d66c1cc166c6f53d6ed8ec5b86f1120 100644 (file)
@@ -108,6 +108,8 @@ static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
        SET_SENS("/Move folder...",         folder_is_normal && folder_item_parent(item) != NULL);
        SET_SENS("/Delete folder...",       item->stype == F_NORMAL && folder_item_parent(item) != NULL);
 
        SET_SENS("/Move folder...",         folder_is_normal && folder_item_parent(item) != NULL);
        SET_SENS("/Delete folder...",       item->stype == F_NORMAL && folder_item_parent(item) != NULL);
 
+       SET_SENS("/Synchronise",            item ? (folder_item_parent(item) == NULL && folder_want_synchronise(item->folder))
+                                               : FALSE);
        SET_SENS("/Check for new messages", folder_item_parent(item) == NULL);
        SET_SENS("/Check for new folders",  folder_item_parent(item) == NULL);
        SET_SENS("/Rebuild folder tree",    folder_item_parent(item) == NULL);
        SET_SENS("/Check for new messages", folder_item_parent(item) == NULL);
        SET_SENS("/Check for new folders",  folder_item_parent(item) == NULL);
        SET_SENS("/Rebuild folder tree",    folder_item_parent(item) == NULL);
index 504f635a92f4778bf801992c2dc7ea3568363658..5dfe566cc2a1ed04c9afa4d83091d1db9b644848 100644 (file)
@@ -490,6 +490,7 @@ static void mailing_list_open_uri(GtkWidget *w, gpointer *data);
 static void mainwindow_quicksearch             (MainWindow     *mainwin, 
                                                 guint           action, 
                                                 GtkWidget      *widget);
 static void mainwindow_quicksearch             (MainWindow     *mainwin, 
                                                 guint           action, 
                                                 GtkWidget      *widget);
+static gboolean any_folder_want_synchronise(void);
 
 static GtkItemFactoryEntry mainwin_entries[] =
 {
 
 static GtkItemFactoryEntry mainwin_entries[] =
 {
@@ -2180,6 +2181,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
        
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
        
+       if (any_folder_want_synchronise())
+               state |= M_WANT_SYNC;
+
        for ( ; account_list != NULL; account_list = account_list->next) {
                if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
                        state |= M_HAVE_NEWS_ACCOUNT;
        for ( ; account_list != NULL; account_list = account_list->next) {
                if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
                        state |= M_HAVE_NEWS_ACCOUNT;
@@ -2222,6 +2226,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        } entry[] = {
                {"/File/Save as...", M_TARGET_EXIST},
                {"/File/Print..."  , M_TARGET_EXIST},
        } entry[] = {
                {"/File/Save as...", M_TARGET_EXIST},
                {"/File/Print..."  , M_TARGET_EXIST},
+               {"/File/Synchronise folders", M_WANT_SYNC},
                {"/File/Exit"      , M_UNLOCKED},
 
                {"/Edit/Select thread"             , M_SINGLE_TARGET_EXIST},
                {"/File/Exit"      , M_UNLOCKED},
 
                {"/Edit/Select thread"             , M_SINGLE_TARGET_EXIST},
@@ -3251,7 +3256,7 @@ static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget
        main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active, TRUE);
 }
 
        main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active, TRUE);
 }
 
-static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+static gboolean any_folder_want_synchronise(void)
 {
        GList *folderlist = folder_get_list();
        gboolean found = FALSE;
 {
        GList *folderlist = folder_get_list();
        gboolean found = FALSE;
@@ -3260,14 +3265,20 @@ static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
        for (; folderlist; folderlist = folderlist->next) {
                Folder *folder = (Folder *)folderlist->data;
                if (folder_want_synchronise(folder)) {
        for (; folderlist; folderlist = folderlist->next) {
                Folder *folder = (Folder *)folderlist->data;
                if (folder_want_synchronise(folder)) {
-                       found = TRUE;
-                       break;
+                       return TRUE;
                }
        }
        
                }
        }
        
-       if (!found)
+       return FALSE;
+
+}
+
+static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+{
+       
+       if (!any_folder_want_synchronise())
                return;
                return;
-               
+
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
                        GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
                        GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
index 0d1cca9a301f9b1a86ccfd2835c62cee51d049f6..f0812c70e52fd29180d6cd7fbed3cbde1acad87b 100644 (file)
@@ -54,7 +54,8 @@ typedef enum
        M_NOT_NEWS            = 1 << 15,
        M_CAN_LEARN_SPAM      = 1 << 16,
        M_ACTIONS_EXIST       = 1 << 17,
        M_NOT_NEWS            = 1 << 15,
        M_CAN_LEARN_SPAM      = 1 << 16,
        M_ACTIONS_EXIST       = 1 << 17,
-       M_HAVE_QUEUED_MAILS   = 1 << 18
+       M_HAVE_QUEUED_MAILS   = 1 << 18,
+       M_WANT_SYNC           = 1 << 19
 } SensitiveCond;
 
 typedef enum
 } SensitiveCond;
 
 typedef enum
index 8d19f42ab0de57b9e66f3a5584b0e10f4b671c78..c62d55095c34ecec1e138662c5acb73e71671f4b 100644 (file)
@@ -100,6 +100,9 @@ static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
                 folder_item_parent(item) == NULL 
                 && mainwin->lock_count == 0
                 && news_folder_locked(item->folder) == 0);
                 folder_item_parent(item) == NULL 
                 && mainwin->lock_count == 0
                 && news_folder_locked(item->folder) == 0);
+       SET_SENS("/Synchronise",    
+                item ? (folder_item_parent(item) != NULL && folder_want_synchronise(item->folder))
+                        : FALSE);
 
 #undef SET_SENS
 }
 
 #undef SET_SENS
 }
index d7713cb6e33a5ff938762baa9f351198952d02b4..3d65e067acf11f23034a5f988122de51432744ad 100644 (file)
@@ -408,6 +408,7 @@ gpgme_data_t sgpgme_decrypt_verify(gpgme_data_t cipher, gpgme_verify_result_t *s
                err = gpgme_op_decrypt(ctx, cipher, plain);
                if (err != GPG_ERR_NO_ERROR) {
                        debug_print("can't decrypt (%s)\n", gpgme_strerror(err));
                err = gpgme_op_decrypt(ctx, cipher, plain);
                if (err != GPG_ERR_NO_ERROR) {
                        debug_print("can't decrypt (%s)\n", gpgme_strerror(err));
+                       privacy_set_error("%s", gpgme_strerror(err));
                        gpgmegtk_free_passphrase();
                        gpgme_data_release(plain);
                        return NULL;
                        gpgmegtk_free_passphrase();
                        gpgme_data_release(plain);
                        return NULL;
index 55fee368506963b4239a44f6ee53b03e4e154f8d..20dbfaf6a9fd0751905138234e87c681697df3b5 100644 (file)
@@ -565,6 +565,8 @@ void prefs_folder_item_general_save_func(PrefsPage *page_)
 
        g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
                        -1, general_save_recurse_func, page);
 
        g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
                        -1, general_save_recurse_func, page);
+       
+       main_window_set_menu_sensitive(mainwindow_get_mainwindow());
 
 }
 
 
 }