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 373b6d9..084538c 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
index c44365b..afb088f 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.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 bd4dbb5..c5f03b3 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=112
+EXTRA_VERSION=113
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6030636..c15b8f2 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;
-
+       
        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);
-       
+
        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) 
@@ -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");
-       
+
        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) 
index bd76cb2..5a80b5d 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("/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);
index 504f635..5dfe566 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 gboolean any_folder_want_synchronise(void);
 
 static GtkItemFactoryEntry mainwin_entries[] =
 {
@@ -2180,6 +2181,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        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;
@@ -2222,6 +2226,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        } 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},
@@ -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);
 }
 
-static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+static gboolean any_folder_want_synchronise(void)
 {
        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)) {
-                       found = TRUE;
-                       break;
+                       return TRUE;
                }
        }
        
-       if (!found)
+       return FALSE;
+
+}
+
+static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+{
+       
+       if (!any_folder_want_synchronise())
                return;
-               
+
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
                        GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
index 0d1cca9..f0812c7 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_HAVE_QUEUED_MAILS   = 1 << 18
+       M_HAVE_QUEUED_MAILS   = 1 << 18,
+       M_WANT_SYNC           = 1 << 19
 } SensitiveCond;
 
 typedef enum
index 8d19f42..c62d550 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);
+       SET_SENS("/Synchronise",    
+                item ? (folder_item_parent(item) != NULL && folder_want_synchronise(item->folder))
+                        : FALSE);
 
 #undef SET_SENS
 }
index d7713cb..3d65e06 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));
+                       privacy_set_error("%s", gpgme_strerror(err));
                        gpgmegtk_free_passphrase();
                        gpgme_data_release(plain);
                        return NULL;
index 55fee36..20dbfaf 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);
+       
+       main_window_set_menu_sensitive(mainwindow_get_mainwindow());
 
 }