[PATCH] Re: Reply to Group?



The solution to various problems with `Reply to Group' seems to be:
- get all the headers from IMAP servers; and
- look for the RFC 2639 standard `list-post:' header before any 
nonstandard `x-*' headers.
The attached patch implements the second of these. Two patches 
submitted to Bugzilla take care of the first; I'd include links, but 
the gnome site won't talk to me right now--look for Toralf's report on 
problems with View->All Headers.

This doesn't amount to full-blown implementation of RFC 2639, as that 
document describes other standard headers that Balsa could exploit. It 
does, however, recognize the RFC's existence.

Comments, suggestions, and improvements welcome, as always!

Peter
diff -dNru --exclude-from=excl balsa-cvs/src/sendmsg-window.c balsa-lists/src/sendmsg-window.c
--- balsa-cvs/src/sendmsg-window.c	Tue Nov 13 16:30:41 2001
+++ balsa-lists/src/sendmsg-window.c	Wed Nov 14 11:42:36 2001
@@ -2238,13 +2238,47 @@
 	    GList *lst, *p;
 	    gchar **pair;
 	    
+            printf("Looking for list post address:");
 	    lst = libbalsa_message_user_hdrs(message);
+            /* RFC 2369: look for "list-post": */
 	    for (p = g_list_first(lst); p; p = g_list_next(p)) {
 		pair = p->data;
-		if ( libbalsa_find_word(pair[0], "x-beenthere x-mailing-list to") )
-		    gtk_entry_set_text(GTK_ENTRY(msg->to[1]), pair[1]);
-		g_strfreev(pair);
+                if (libbalsa_find_word(pair[0], "list-post")) {
+                    printf(" found \"%s:%s\"\n", pair[0], pair[1]);
+                    if (g_strncasecmp(pair[1], "<mailto:";, 8))
+                        /* allow for broken list-post header with
+                         * an address instead of a mailto: url */
+                        gtk_entry_set_text(GTK_ENTRY(msg->to[1]), pair[1]);
+                    else {
+                        gchar *url = pair[1] + 8;
+                        if (*url)
+                            /* zap the closing `>' */
+                            url[strlen(url) - 1] = '\0';
+                        sendmsg_window_process_url(url,
+                                                   sendmsg_window_set_field,
+                                                   msg);
+                    }
+                    break;
+                }
+            }
+
+            if (!p) {
+                /* we didn't find "list-post", so try some nonstandard
+                 * alternatives: */
+                printf(" no list-post, ");
+                for (p = g_list_first(lst); p; p = g_list_next(p)) {
+		    pair = p->data;
+		    if ( libbalsa_find_word(pair[0],
+                                            "x-beenthere x-mailing-list") ){
+                        printf(" found \"%s:%s\"\n", pair[0], pair[1]);
+		        gtk_entry_set_text(GTK_ENTRY(msg->to[1]), pair[1]);
+                        break;
+                    }
+                }
+                if (!p)
+                    printf(" no useful x-* headers either!\n");
 	    }
+            g_list_foreach(lst, (GFunc) g_strfreev, NULL);
 	    g_list_free(lst);
 	}
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]