2009-12-02 [pawel] 3.7.3cvs27
authorPaweł Pękala <c0rn@gazeta.pl>
Wed, 2 Dec 2009 15:20:55 +0000 (15:20 +0000)
committerPaweł Pękala <c0rn@gazeta.pl>
Wed, 2 Dec 2009 15:20:55 +0000 (15:20 +0000)
* src/compose.c
* src/compose.h
Fix Bug 1850 "Reply All" duplicates "To" user in "CC" if original
email had user in "From" and "CC"
Don't allow duplicate addresses in compose window headers

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/compose.h

index dc227acbd61cf60eab3596f9b621160129ed8b3e..911252e8d1091d0884997bc53bf9baac0f2fb283 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-02 [pawel]     3.7.3cvs27
+
+       * src/compose.c
+       * src/compose.h
+               Fix Bug 1850 "Reply All" duplicates "To" user in "CC" if original
+               email had user in "From" and "CC"
+               Don't allow duplicate addresses in compose window headers
+
 2009-12-02 [mones]     3.7.3cvs26
 
        * manual/intro.xml
index 7e6c75f1fde434c60016d3c7a33b7c6ee74a3402..d4002ff3754a4af2892dcf4c62567c42ccd79526 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.525 -r 1.382.2.526 src/compose.c;  ) > 3.7.3cvs24.patchset
 ( cvs diff -u -r 1.395.2.415 -r 1.395.2.416 src/summaryview.c;  cvs diff -u -r 1.68.2.52 -r 1.68.2.53 src/summaryview.h;  ) > 3.7.3cvs25.patchset
 ( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 manual/intro.xml;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 manual/es/intro.xml;  cvs diff -u -r 1.1.2.5 -r 1.1.2.6 manual/fr/intro.xml;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/it/intro.xml;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 manual/pl/intro.xml;  ) > 3.7.3cvs26.patchset
+( cvs diff -u -r 1.382.2.526 -r 1.382.2.527 src/compose.c;  cvs diff -u -r 1.50.2.56 -r 1.50.2.57 src/compose.h;  ) > 3.7.3cvs27.patchset
index b041e62b94120c87393804d830052e13a89a273c..578211898db731871a3feba9f86f15811b96ecc4 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=26
+EXTRA_VERSION=27
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 3cd2f2d40a73b124636ff489ad61b4514457e175..a49870c3029dfe972f628e63c8962b2f13e075c8 100644 (file)
@@ -6545,17 +6545,41 @@ static void compose_create_header_entry(Compose *compose)
 static void compose_add_header_entry(Compose *compose, const gchar *header,
                                gchar *text, ComposePrefType pref_type) 
 {
-       ComposeHeaderEntry *last_header;
+       ComposeHeaderEntry *last_header = compose->header_last;
+       gchar *tmp = g_strdup(text), *email;
+       
+       extract_address(tmp);
+       email = g_utf8_strdown(tmp, -1);
+       
+       if (g_hash_table_lookup(compose->email_hashtable, email) != NULL) {
+               debug_print("Ignoring duplicate address - %s %s, pref_type: %d\n",
+                               header, text, (gint) pref_type);
+               g_free(email);
+               g_free(tmp);
+               return;
+       }
        
-       last_header = compose->header_last;
-
        combobox_select_by_text(GTK_COMBO_BOX(last_header->combo), header);
        gtk_entry_set_text(GTK_ENTRY(last_header->entry), text);
        last_header->type = pref_type;
+
+       g_hash_table_insert(compose->email_hashtable, email,
+                               GUINT_TO_POINTER(1));
+       g_free(tmp);
 }
 
-static void compose_destroy_headerentry(ComposeHeaderEntry *headerentry)
+static void compose_destroy_headerentry(Compose *compose, 
+                                       ComposeHeaderEntry *headerentry)
 {
+       gchar *text = gtk_editable_get_chars(GTK_EDITABLE(headerentry->entry), 0, -1);
+       gchar *email;
+
+       extract_address(text);
+       email = g_utf8_strdown(text, -1);
+       g_hash_table_remove(compose->email_hashtable, email);
+       g_free(text);
+       g_free(email);
+       
        gtk_widget_destroy(headerentry->combo);
        gtk_widget_destroy(headerentry->entry);
        gtk_widget_destroy(headerentry->button);
@@ -6567,7 +6591,7 @@ static void compose_remove_header_entries(Compose *compose)
 {
        GSList *list;
        for (list = compose->header_list; list; list = list->next)
-               compose_destroy_headerentry((ComposeHeaderEntry *)list->data);
+               compose_destroy_headerentry(compose, (ComposeHeaderEntry *)list->data);
 
        compose->header_last = NULL;
        g_slist_free(compose->header_list);
@@ -7447,6 +7471,9 @@ static Compose *compose_create(PrefsAccount *account,
        compose->replyinfo  = NULL;
        compose->fwdinfo    = NULL;
 
+       compose->email_hashtable = g_hash_table_new_full(g_str_hash,
+                               g_str_equal, (GDestroyNotify) g_free, NULL);
+       
        compose->replyto     = NULL;
        compose->cc          = NULL;
        compose->bcc         = NULL;
@@ -8227,6 +8254,8 @@ static void compose_destroy(Compose *compose)
        slist_free_strings(compose->header_list);
        g_slist_free(compose->header_list);
 
+       g_hash_table_destroy(compose->email_hashtable);
+
        procmsg_msginfo_free(compose->targetinfo);
        procmsg_msginfo_free(compose->replyinfo);
        procmsg_msginfo_free(compose->fwdinfo);
@@ -9037,7 +9066,7 @@ static void account_activated(GtkComboBox *optmenu, gpointer data)
                        ComposeHeaderEntry *hentry=(ComposeHeaderEntry *)list->data;
                        
                        if (hentry->type == PREF_ACCOUNT || !list->next) {
-                               compose_destroy_headerentry(hentry);
+                               compose_destroy_headerentry(compose, hentry);
                                continue;
                        }
                        
@@ -9060,7 +9089,7 @@ static void account_activated(GtkComboBox *optmenu, gpointer data)
                                                &style->base[GTK_STATE_NORMAL]);
 
                        saved_list = g_slist_append(saved_list, state);
-                       compose_destroy_headerentry(hentry);
+                       compose_destroy_headerentry(compose, hentry);
                }
 
                compose->header_last = NULL;
index 0980d6016be3a3acf0bcc4c11bf4caf67966d311..48c5f67390ee765773671ae4e5dd6f888c904adf 100644 (file)
@@ -156,6 +156,8 @@ struct _Compose
        guint      header_nextrow;
        ComposeHeaderEntry *header_last;
 
+       GHashTable *email_hashtable;
+
        gchar   *replyto;
        gchar   *cc;
        gchar   *bcc;