Bug#267949: balsa: several patches for 2.2.3

Miquel van Smoorenburg Miquel van Smoorenburg <miquels@cistron.nl>, 267949@bugs.debian.org
Wed, 25 Aug 2004 11:36:38 +0200


--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: balsa
Version: 2.2.3-1
Severity: important

I have reported several bugs in 2.2.3 on the balsa mailinglist
which promptly got fixed by the developers - patches are already
in CVS, but if you intend to put 2.2.3 into 'sarge' then these
patches are mandatory

01_mailbox-imap.patch	Balsa asks for IMAP password 5 times
02_mailbox-node.patch	Fixes crash when turning on/off subscribed IMAP folders
03_get-password.patch	Balsa asks for IMAP password 5 times
04_config.patch		Balsa messes up when IMAP config changes
05_steal.patch		Balsa messes up when IMAP config changes

Still outstanding issues:

- Balsa might hang at startup when you have "remember open mailboxes
  between sessions" enabled. Might be IMAP-only. Serious.
- Newly arrived mail in open folders in existing threads show up
  as a collapsed thread instead of following the folder startup property.
  Annoying.

Mike.
-- 
The question is, what is a "manamanap".
The question is, who cares ?

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="01_mailbox-imap.patch"

Index: libbalsa/mailbox_imap.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/mailbox_imap.c,v
retrieving revision 1.213
diff -u -r1.213 mailbox_imap.c
--- a/libbalsa/mailbox_imap.c	16 Aug 2004 20:40:17 -0000	1.213
+++ b/libbalsa/mailbox_imap.c	18 Aug 2004 17:48:50 -0000
@@ -285,6 +285,9 @@
     g_free(mailbox->path); mailbox->path = NULL;
 
     if(remote->server) {
+        g_signal_handlers_disconnect_by_func(remote->server,
+                                             server_host_settings_changed_cb,
+                                             remote);
 	g_object_unref(G_OBJECT(remote->server));
 	remote->server = NULL;
     }


--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="02_mailbox-node.patch"

Index: src/mailbox-node.c
===================================================================
RCS file: /cvs/gnome/balsa/src/mailbox-node.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- a/src/mailbox-node.c	12 Aug 2004 20:05:17 -0000	1.85
+++ b/src/mailbox-node.c	19 Aug 2004 12:47:55 -0000	1.86
@@ -525,6 +525,8 @@
 balsa_mailbox_node_new_from_config(const gchar* prefix)
 {
     BalsaMailboxNode * folder = balsa_mailbox_node_new();
+    static guint get_password_signal = 0;
+
     gnome_config_push_prefix(prefix);
 
     folder->server = LIBBALSA_SERVER(libbalsa_imap_server_new_from_config());
@@ -536,8 +538,15 @@
 		     G_CALLBACK(folder_conf_imap_node), NULL);
     g_signal_connect(G_OBJECT(folder), "append-subtree", 
 		     G_CALLBACK(imap_dir_cb), NULL);
-    g_signal_connect(G_OBJECT(folder->server), "get-password",
-                     G_CALLBACK(ask_password), NULL);
+
+    if (!get_password_signal)
+        get_password_signal =
+            g_signal_lookup("get-password", LIBBALSA_TYPE_SERVER);
+    if (!g_signal_has_handler_pending(G_OBJECT(folder->server),
+                                      get_password_signal, 0, TRUE))
+        g_signal_connect(G_OBJECT(folder->server), "get-password",
+                         G_CALLBACK(ask_password), NULL);
+
     balsa_mailbox_node_load_config(folder, prefix);
 
     folder->dir = gnome_config_get_string("Directory");


--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="03_get-password.patch"

Index: libbalsa/mailbox_imap.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/mailbox_imap.c,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -r1.215 -r1.216
--- a/libbalsa/mailbox_imap.c	19 Aug 2004 12:12:48 -0000	1.215
+++ b/libbalsa/mailbox_imap.c	19 Aug 2004 13:38:35 -0000	1.216
@@ -285,8 +285,9 @@
     g_free(mailbox->path); mailbox->path = NULL;
 
     if(remote->server) {
-        g_signal_handlers_disconnect_by_func(remote->server,
-                                             server_host_settings_changed_cb,
+        g_signal_handlers_disconnect_matched(remote->server,
+                                             G_SIGNAL_MATCH_DATA, 0,
+                                             (GQuark) 0, NULL, NULL,
                                              remote);
 	g_object_unref(G_OBJECT(remote->server));
 	remote->server = NULL;
Index: libbalsa/server.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/server.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- a/libbalsa/server.c	14 Aug 2004 19:31:15 -0000	1.33
+++ b/libbalsa/server.c	19 Aug 2004 13:38:35 -0000	1.34
@@ -417,3 +417,13 @@
     }
     va_end(alist);
 }
+
+void
+libbalsa_server_connect_signals(LibBalsaServer * server, GCallback cb,
+                                gpointer cb_data)
+{
+    if (!g_signal_has_handler_pending(server,
+                                      libbalsa_server_signals
+                                      [GET_PASSWORD], 0, TRUE))
+        g_signal_connect(server, "get-password", cb, cb_data);
+}
Index: libbalsa/server.h
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/server.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- a/libbalsa/server.h	8 May 2004 14:25:39 -0000	1.15
+++ b/libbalsa/server.h	19 Aug 2004 13:38:35 -0000	1.16
@@ -95,4 +95,7 @@
 
 
 void libbalsa_server_user_cb(ImapUserEventType ue, void *arg, ...);
+
+void libbalsa_server_connect_signals(LibBalsaServer * server, GCallback cb,
+                                     gpointer cb_data);
 #endif				/* __LIBBALSA_SERVER_H__ */
Index: src/mailbox-node.c
===================================================================
RCS file: /cvs/gnome/balsa/src/mailbox-node.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- a/src/mailbox-node.c	19 Aug 2004 12:47:55 -0000	1.86
+++ b/src/mailbox-node.c	19 Aug 2004 13:38:35 -0000	1.87
@@ -525,8 +525,6 @@
 balsa_mailbox_node_new_from_config(const gchar* prefix)
 {
     BalsaMailboxNode * folder = balsa_mailbox_node_new();
-    static guint get_password_signal = 0;
-
     gnome_config_push_prefix(prefix);
 
     folder->server = LIBBALSA_SERVER(libbalsa_imap_server_new_from_config());
@@ -538,15 +536,8 @@
 		     G_CALLBACK(folder_conf_imap_node), NULL);
     g_signal_connect(G_OBJECT(folder), "append-subtree", 
 		     G_CALLBACK(imap_dir_cb), NULL);
-
-    if (!get_password_signal)
-        get_password_signal =
-            g_signal_lookup("get-password", LIBBALSA_TYPE_SERVER);
-    if (!g_signal_has_handler_pending(G_OBJECT(folder->server),
-                                      get_password_signal, 0, TRUE))
-        g_signal_connect(G_OBJECT(folder->server), "get-password",
-                         G_CALLBACK(ask_password), NULL);
-
+    libbalsa_server_connect_signals(folder->server,
+                                    G_CALLBACK(ask_password), NULL);
     balsa_mailbox_node_load_config(folder, prefix);
 
     folder->dir = gnome_config_get_string("Directory");
Index: src/save-restore.c
===================================================================
RCS file: /cvs/gnome/balsa/src/save-restore.c,v
retrieving revision 1.289
retrieving revision 1.290
diff -u -r1.289 -r1.290
--- a/src/save-restore.c	18 Aug 2004 02:14:38 -0000	1.289
+++ b/src/save-restore.c	19 Aug 2004 13:38:35 -0000	1.290
@@ -506,9 +506,9 @@
     if (mailbox == NULL)
 	return FALSE;
     if (LIBBALSA_IS_MAILBOX_REMOTE(mailbox))
-        g_signal_connect(G_OBJECT(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox)),
-                         "get-password", G_CALLBACK(ask_password),
-                         mailbox);
+        libbalsa_server_connect_signals(LIBBALSA_MAILBOX_REMOTE_SERVER
+                                        (mailbox),
+                                        G_CALLBACK(ask_password), mailbox);
 
     if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {
         g_signal_connect(G_OBJECT(mailbox),


--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="04_config.patch"

Index: src/mailbox-node.c

===================================================================

RCS file: /cvs/gnome/balsa/src/mailbox-node.c,v

retrieving revision 1.87

diff -u -r1.87 mailbox-node.c

--- a/src/mailbox-node.c	19 Aug 2004 13:38:35 -0000	1.87

+++ b/src/mailbox-node.c	21 Aug 2004 13:46:41 -0000

@@ -217,6 +217,13 @@

     g_free(mn->dir);           mn->dir = NULL;

     g_free(mn->config_prefix); mn->config_prefix = NULL;

 

+    if (mn->server) {

+	g_signal_handlers_disconnect_matched(mn->server,

+                                             G_SIGNAL_MATCH_DATA, 0,

+					     (GQuark) 0, NULL, NULL, mn);

+	mn->server = NULL;

+    }

+

     G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(object));

 }

 

Index: src/save-restore.c

===================================================================

RCS file: /cvs/gnome/balsa/src/save-restore.c,v

retrieving revision 1.291

diff -u -r1.291 save-restore.c

--- a/src/save-restore.c	20 Aug 2004 10:35:54 -0000	1.291

+++ b/src/save-restore.c	21 Aug 2004 13:46:41 -0000

@@ -505,10 +505,14 @@

     mailbox = libbalsa_mailbox_new_from_config(prefix);

     if (mailbox == NULL)

 	return FALSE;

-    if (LIBBALSA_IS_MAILBOX_REMOTE(mailbox))

-        libbalsa_server_connect_signals(LIBBALSA_MAILBOX_REMOTE_SERVER

-                                        (mailbox),

+    if (LIBBALSA_IS_MAILBOX_REMOTE(mailbox)) {

+	LibBalsaServer *server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);

+        libbalsa_server_connect_signals(server,

                                         G_CALLBACK(ask_password), mailbox);

+	g_signal_connect_swapped(server, "set-host",

+                                 G_CALLBACK(config_mailbox_update),

+				 mailbox);

+    }

 

     if (LIBBALSA_IS_MAILBOX_POP3(mailbox)) {

         g_signal_connect(G_OBJECT(mailbox),

@@ -561,8 +565,12 @@

 

     g_return_val_if_fail(prefix != NULL, FALSE);

 

-    if( (folder = balsa_mailbox_node_new_from_config(prefix)) )

+    if( (folder = balsa_mailbox_node_new_from_config(prefix)) ) {

+	g_signal_connect_swapped(folder->server, "set-host",

+                                 G_CALLBACK(config_folder_update),

+				 folder);

 	balsa_mblist_mailbox_node_append(NULL, folder);

+    }

 

     return folder != NULL;

 }				/* config_folder_init */




--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="05_steal.patch"

Index: src/balsa-app.c

===================================================================

RCS file: /cvs/gnome/balsa/src/balsa-app.c,v

retrieving revision 1.253

diff -u -r1.253 balsa-app.c

--- a/src/balsa-app.c	20 Aug 2004 10:35:54 -0000	1.253

+++ b/src/balsa-app.c	22 Aug 2004 17:24:14 -0000

@@ -837,8 +837,8 @@

 		|| mailbox == balsa_app.sentbox

 		|| mailbox == balsa_app.draftbox

 		|| mailbox == balsa_app.trash) {

-		g_object_ref(mbnode);

-		*specials = g_slist_prepend(*specials, mbnode);

+		g_object_ref(mailbox);

+		*specials = g_slist_prepend(*specials, mailbox);

 	    }

 	    ba_remove_children_mailbox_nodes(model, &iter, specials);

 	    valid =

@@ -871,7 +871,9 @@

     ba_remove_children_mailbox_nodes(model, iter, &specials);

 

     for (l = specials; l; l = l->next)

-	balsa_mblist_mailbox_node_append(NULL, l->data);

+        balsa_mblist_mailbox_node_append(NULL,

+                                         balsa_mailbox_node_new_from_mailbox

+                                         (l->data));

     g_slist_free(specials);

 }

 

Index: src/mailbox-node.c

===================================================================

RCS file: /cvs/gnome/balsa/src/mailbox-node.c,v

retrieving revision 1.88

diff -u -r1.88 mailbox-node.c

--- a/src/mailbox-node.c	21 Aug 2004 16:34:25 -0000	1.88

+++ b/src/mailbox-node.c	22 Aug 2004 17:24:15 -0000

@@ -353,11 +353,12 @@

 imap_scan_attach_mailbox(BalsaMailboxNode * mbnode, imap_scan_item * isi)

 {

     LibBalsaMailboxImap *m;

+

+    g_signal_connect(G_OBJECT(mbnode), "show-prop-dialog",

+                     G_CALLBACK(folder_conf_imap_sub_node), NULL);

     if (LIBBALSA_IS_MAILBOX_IMAP(mbnode->mailbox))

         /* it already has a mailbox */

         return FALSE;

-    g_signal_connect(G_OBJECT(mbnode), "show-prop-dialog",

-                     G_CALLBACK(folder_conf_imap_sub_node), NULL);

     m = LIBBALSA_MAILBOX_IMAP(libbalsa_mailbox_imap_new());

     libbalsa_mailbox_remote_set_server(LIBBALSA_MAILBOX_REMOTE(m),

 				       mbnode->server);

@@ -1146,6 +1147,7 @@

     BalsaMailboxNode *parent;

     const gchar *basename;

     gchar *url = libbalsa_imap_url(root->server, isi->fn);

+    LibBalsaMailbox *mailbox = NULL;

 

     mbnode = balsa_find_url(url);

     if (mbnode) {

@@ -1158,6 +1160,8 @@

 	    return mbnode;

 	}

 	g_object_unref(mbnode);

+	mailbox = special->mailbox;

+	g_object_ref(mailbox);

 	g_object_unref(special);

     }

     g_free(url);

@@ -1171,6 +1175,7 @@

     g_free(parent_name);

 

     mbnode = balsa_mailbox_node_new_imap_node(root->server, isi->fn);

+    mbnode->mailbox = mailbox;

     basename = strrchr(isi->fn, delim);

     if (!basename)

         basename = isi->fn;




--azLHFNyN32YCQGCU--