2008-05-12 [wwp] 3.4.0cvs30
authorTristan Chabredier <wwp@claws-mail.org>
Mon, 12 May 2008 13:09:26 +0000 (13:09 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Mon, 12 May 2008 13:09:26 +0000 (13:09 +0000)
* src/addressbook.c
* src/addressbook_foldersel.c
* src/filtering.c
* src/matcher.c
* src/prefs_matcher.c
* src/plugins/bogofilter/bogofilter.c
* src/plugins/bogofilter/bogofilter_gtk.c
* src/plugins/dillo_viewer/dillo_prefs.c
* src/plugins/spamassassin/spamassassin.c
* src/plugins/spamassassin/spamassassin_gtk.c
Fix for bug 1604 "found_in_addressbook in Any in non English local",
based on a patch submitted by Paul CtrlAltBs. Also fix storing of
translated string "Any" in plugins (whitelisting) and
UTF8 comparisons.

13 files changed:
ChangeLog
PATCHSETS
configure.ac
src/addressbook.c
src/addressbook_foldersel.c
src/filtering.c
src/matcher.c
src/plugins/bogofilter/bogofilter.c
src/plugins/bogofilter/bogofilter_gtk.c
src/plugins/dillo_viewer/dillo_prefs.c
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin_gtk.c
src/prefs_matcher.c

index a6dd309..0362f4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-05-12 [wwp]       3.4.0cvs30
+
+       * src/addressbook.c
+       * src/addressbook_foldersel.c
+       * src/filtering.c
+       * src/matcher.c
+       * src/prefs_matcher.c
+       * src/plugins/bogofilter/bogofilter.c
+       * src/plugins/bogofilter/bogofilter_gtk.c
+       * src/plugins/dillo_viewer/dillo_prefs.c
+       * src/plugins/spamassassin/spamassassin.c
+       * src/plugins/spamassassin/spamassassin_gtk.c
+               Fix for bug 1604 "found_in_addressbook in Any in non English local",
+               based on a patch submitted by Paul CtrlAltBs. Also fix storing of
+               translated string "Any" in plugins (whitelisting) and
+               UTF8 comparisons.
+
 2008-05-07 [colin]     3.4.0cvs29
 
        * configure.ac
index a0c0787..72685dd 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.14 -r 1.1.2.15 tools/claws.i18n.status.pl;  ) > 3.4.0cvs27.patchset
 ( cvs diff -u -r 1.654.2.3384 -r 1.654.2.3385 configure.ac;  cvs diff -u -r 1.61.2.78 -r 1.61.2.79 src/account.c;  cvs diff -u -r 1.27.2.40 -r 1.27.2.41 src/addr_compl.c;  cvs diff -u -r 1.382.2.447 -r 1.382.2.448 src/compose.c;  cvs diff -u -r 1.14.2.49 -r 1.14.2.50 src/editaddress.c;  cvs diff -u -r 1.207.2.199 -r 1.207.2.200 src/folderview.c;  cvs diff -u -r 1.274.2.239 -r 1.274.2.240 src/mainwindow.c;  cvs diff -u -r 1.94.2.176 -r 1.94.2.177 src/messageview.c;  cvs diff -u -r 1.83.2.129 -r 1.83.2.130 src/mimeview.c;  cvs diff -u -r 1.105.2.130 -r 1.105.2.131 src/prefs_account.c;  cvs diff -u -r 1.204.2.168 -r 1.204.2.169 src/prefs_common.c;  cvs diff -u -r 1.16.2.34 -r 1.16.2.35 src/prefs_display_header.c;  cvs diff -u -r 1.59.2.67 -r 1.59.2.68 src/prefs_filtering.c;  cvs diff -u -r 1.1.2.51 -r 1.1.2.52 src/prefs_summaries.c;  cvs diff -u -r 1.12.2.62 -r 1.12.2.63 src/prefs_template.c;  cvs diff -u -r 1.30.2.49 -r 1.30.2.50 src/prefs_toolbar.c;  cvs diff -u -r 1.25.2.53 -r 1.25.2.54 src/stock_pixmap.c;  cvs diff -u -r 1.395.2.366 -r 1.395.2.367 src/summaryview.c;  cvs diff -u -r 1.68.2.45 -r 1.68.2.46 src/summaryview.h;  cvs diff -u -r 1.96.2.200 -r 1.96.2.201 src/textview.c;  cvs diff -u -r 1.43.2.97 -r 1.43.2.98 src/toolbar.c;  cvs diff -u -r 1.4.2.61 -r 1.4.2.62 src/gtk/about.c;  cvs diff -u -r 1.1.4.43 -r 1.1.4.44 src/gtk/gtksctree.c;  cvs diff -u -r 1.5.2.27 -r 1.5.2.28 src/gtk/menu.c;  cvs diff -u -r 1.12.2.45 -r 1.12.2.46 src/gtk/prefswindow.c;  cvs diff -u -r 1.9.2.19 -r 1.9.2.20 src/gtk/sslcertwindow.c;  ) > 3.4.0cvs28.patchset
 ( cvs diff -u -r 1.654.2.3385 -r 1.654.2.3386 configure.ac;  ) > 3.4.0cvs29.patchset
+( cvs diff -u -r 1.60.2.115 -r 1.60.2.116 src/addressbook.c;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/addressbook_foldersel.c;  cvs diff -u -r 1.60.2.43 -r 1.60.2.44 src/filtering.c;  cvs diff -u -r 1.75.2.58 -r 1.75.2.59 src/matcher.c;  cvs diff -u -r 1.43.2.71 -r 1.43.2.72 src/prefs_matcher.c;  cvs diff -u -r 1.1.2.37 -r 1.1.2.38 src/plugins/bogofilter/bogofilter.c;  cvs diff -u -r 1.1.2.31 -r 1.1.2.32 src/plugins/bogofilter/bogofilter_gtk.c;  cvs diff -u -r 1.5.2.21 -r 1.5.2.22 src/plugins/dillo_viewer/dillo_prefs.c;  cvs diff -u -r 1.18.2.59 -r 1.18.2.60 src/plugins/spamassassin/spamassassin.c;  cvs diff -u -r 1.23.2.47 -r 1.23.2.48 src/plugins/spamassassin/spamassassin_gtk.c;  ) > 3.4.0cvs30.patchset
index 4ec85e1..c880038 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=29
+EXTRA_VERSION=30
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index de591dd..0470b16 100644 (file)
@@ -5181,7 +5181,7 @@ gboolean addressbook_peek_folder_exists( gchar *folderpath,
        if ( folderpath == NULL )
                return FALSE;
 
-       if ( strcasecmp(folderpath, _("Any")) == 0 || *folderpath == '\0' )
+       if ( strcasecmp(folderpath, "Any") == 0 || *folderpath == '\0' )
                return TRUE;
 
        /* split the folder path we've received, we'll try to match this path, subpath by
index c2976db..76b22a1 100644 (file)
@@ -388,8 +388,9 @@ gboolean addressbook_foldersel_selection( AddressIndex *addrIndex,
        corresponds to what we received */
 
        if ( path != NULL ) {
-               if ( strcasecmp(path, _("Any")) == 0 || *path == '\0' )
-                       /* consider "Any" and "" as valid addressbook root */
+               if ( g_utf8_collate(path, _("Any")) == 0 || strcasecmp(path, "Any") || *path == '\0' )
+                       /* consider "Any" (both translated or untranslated forms) and ""
+                          as valid addressbook roots */
                        folder_path_match.matched = TRUE;
                else
                        folder_path_match.folder_path = g_strsplit( path, "/", 256 );
index 8ecd6a5..732d2f9 100644 (file)
@@ -489,7 +489,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                                gchar *path = NULL;
 
                                if (action->destination == NULL ||
-                                               strcasecmp(action->destination, _("Any")) == 0 ||
+                                               strcasecmp(action->destination, "Any") == 0 ||
                                                *(action->destination) == '\0')
                                        path = NULL;
                                else
index 844ff32..00c4734 100644 (file)
@@ -357,7 +357,7 @@ static gboolean match_with_addresses_in_addressbook
                                g_slist_length(address_list), folderpath?folderpath:"(null)");
 
        if (folderpath == NULL ||
-               strcasecmp(folderpath, _("Any")) == 0 ||
+               strcasecmp(folderpath, "Any") == 0 ||
                *folderpath == '\0')
                path = NULL;
        else
@@ -1274,9 +1274,9 @@ static gboolean matcherprop_match_one_header(MatcherProp *matcher,
                        gboolean found = FALSE;
 
                        /* how many address headers are me trying to mach? */
-                       if (strcasecmp(matcher->header, _("Any")) == 0)
+                       if (strcasecmp(matcher->header, "Any") == 0)
                                match = MATCH_ANY;
-                       else if (strcasecmp(matcher->header, Q_("Filtering Matcher Menu|All")) == 0)
+                       else if (strcasecmp(matcher->header, "All") == 0)
                                        match = MATCH_ALL;
 
                        if (match == MATCH_ONE) {
@@ -1407,9 +1407,9 @@ static gboolean matcherlist_match_headers(MatcherList *matchers, FILE *fp)
                                         procheader_headername_equal(header->name, "Reply-To") ||
                                         procheader_headername_equal(header->name, "Sender"))) {
 
-                                       if (strcasecmp(matcher->header, _("Any")) == 0)
+                                       if (strcasecmp(matcher->header, "Any") == 0)
                                                match = MATCH_ANY;
-                                       else if (strcasecmp(matcher->header, Q_("Filtering Matcher Menu|All")) == 0)
+                                       else if (strcasecmp(matcher->header, "All") == 0)
                                                match = MATCH_ALL;
                                        else
                                                match = MATCH_ONE;
index e659d51..a1e843f 100644 (file)
@@ -216,7 +216,7 @@ static void bogofilter_do_filter(BogoFilterData *data)
                        gchar *ab_folderpath;
 
                        if (*config.whitelist_ab_folder == '\0' ||
-                               strcasecmp(config.whitelist_ab_folder, _("Any")) == 0) {
+                               strcasecmp(config.whitelist_ab_folder, "Any") == 0) {
                                /* match the whole addressbook */
                                ab_folderpath = NULL;
                        } else {
index dd1d962..4198bff 100644 (file)
@@ -299,9 +299,20 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(insert_header_checkbtn), config->insert_header);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), config->whitelist_ab);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(learn_from_whitelist_chkbtn), config->learn_from_whitelist);
-       if (config->whitelist_ab_folder != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
-                               config->whitelist_ab_folder);
+       if (config->whitelist_ab_folder != NULL) {
+               /* translate "Any" (stored UNtranslated) */
+               if (strcasecmp(config->whitelist_ab_folder, "Any") == 0)
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       config->whitelist_ab_folder);
+               else
+               /* backward compatibility (when translated "Any" was stored) */
+               if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0)
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       config->whitelist_ab_folder);
+               else
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       config->whitelist_ab_folder);
+       }
        if (config->save_folder != NULL)
                gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
        if (config->save_unsure_folder != NULL)
@@ -371,6 +382,11 @@ static void bogofilter_save_func(PrefsPage *_page)
        g_free(config->whitelist_ab_folder);
        config->whitelist_ab_folder = gtk_editable_get_chars(
                                GTK_EDITABLE(GTK_BIN(page->whitelist_ab_folder_combo)->child), 0, -1);
+       /* store UNtranslated "Any" */
+       if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0) {
+               g_free(config->whitelist_ab_folder);
+               config->whitelist_ab_folder = g_strdup("Any");
+       }
 
        /* learn_from_whitelist_chkbtn */
        config->learn_from_whitelist = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->learn_from_whitelist_chkbtn));
index 3763ae1..6602b3b 100644 (file)
@@ -205,9 +205,20 @@ static void create_dillo_prefs_page(PrefsPage *page,
        gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_select_btn, FALSE, FALSE, 0);
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), dillo_prefs.whitelist_ab);
-       if (dillo_prefs.whitelist_ab_folder != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
-                               dillo_prefs.whitelist_ab_folder);
+       if (dillo_prefs.whitelist_ab_folder != NULL) {
+               /* translate "Any" (stored UNtranslated) */
+               if (strcasecmp(dillo_prefs.whitelist_ab_folder, "Any") == 0)
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       _("Any"));
+               else
+               /* backward compatibility (when translated "Any" was stored) */
+               if (g_utf8_collate(dillo_prefs.whitelist_ab_folder, _("Any")) == 0)
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       dillo_prefs.whitelist_ab_folder);
+               else
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       dillo_prefs.whitelist_ab_folder);
+       }
 
        full_tooltip = gtk_tooltips_new();
         full_checkbox = gtk_check_button_new_with_label
@@ -265,7 +276,12 @@ static void save_dillo_prefs(PrefsPage *page)
        g_free(dillo_prefs.whitelist_ab_folder);
        dillo_prefs.whitelist_ab_folder = gtk_editable_get_chars(
                                GTK_EDITABLE(GTK_BIN(prefs_page->whitelist_ab_folder_combo)->child), 0, -1);
-        
+       /* store UNtranslated "Any" */
+       if (g_utf8_collate(dillo_prefs.whitelist_ab_folder, _("Any")) == 0) {
+               g_free(dillo_prefs.whitelist_ab_folder);
+               dillo_prefs.whitelist_ab_folder = g_strdup("Any");
+       }
+    
         pref_file = prefs_write_open(rc_file_path);
         g_free(rc_file_path);
         
index 969fc24..2bde5a9 100644 (file)
@@ -251,7 +251,7 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
                gboolean whitelisted = FALSE;
 
                if (*config.whitelist_ab_folder == '\0' ||
-                       strcasecmp(config.whitelist_ab_folder, _("Any")) == 0) {
+                       strcasecmp(config.whitelist_ab_folder, "Any") == 0) {
                        /* match the whole addressbook */
                        ab_folderpath = NULL;
                } else {
index c90744f..f9adeb3 100644 (file)
@@ -482,9 +482,20 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
                gtk_entry_set_text(GTK_ENTRY(spamd_hostname_entry), config->hostname);
        if (config->socket != NULL)
                gtk_entry_set_text(GTK_ENTRY(spamd_socket_entry), config->socket);
-       if (config->whitelist_ab_folder != NULL)
-               gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
-                               config->whitelist_ab_folder);
+       if (config->whitelist_ab_folder != NULL) {
+               /* translate "Any" (stored UNtranslated) */
+               if (strcasecmp(config->whitelist_ab_folder, "Any") == 0)
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       config->whitelist_ab_folder);
+               else
+               /* backward compatibility (when translated "Any" was stored) */
+               if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0)
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       config->whitelist_ab_folder);
+               else
+                       gtk_entry_set_text(GTK_ENTRY(GTK_BIN(whitelist_ab_folder_combo)->child),
+                                       config->whitelist_ab_folder);
+       }
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(spamd_port_spinbtn), (float) config->port);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spinbtn), (float) config->timeout);
@@ -600,6 +611,11 @@ static void spamassassin_save_func(PrefsPage *_page)
        g_free(config->whitelist_ab_folder);
        config->whitelist_ab_folder = gtk_editable_get_chars(
                                GTK_EDITABLE(GTK_BIN(page->whitelist_ab_folder_combo)->child), 0, -1);
+       /* store UNtranslated "Any" */
+       if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0) {
+               g_free(config->whitelist_ab_folder);
+               config->whitelist_ab_folder = g_strdup("Any");
+       }
 
        if (config->process_emails) {
                spamassassin_register_hook();
index 017872d..378ffe9 100644 (file)
@@ -1454,27 +1454,27 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
                if (*expr == '\0') {
                        gchar *tmp;
 
-                       if (strcasecmp(header, Q_("Filtering Matcher Menu|All")) == 0)
+                       if (g_utf8_collate(header, Q_("Filtering Matcher Menu|All")) == 0)
                                tmp = g_strdup(_("all addresses in all headers"));
                        else
-                       if (strcasecmp(header, _("Any")) == 0)
+                       if (g_utf8_collate(header, _("Any")) == 0)
                                tmp = g_strdup(_("any address in any header"));
                        else
                                tmp = g_strdup_printf(_("the address(es) in header '%s'"), header);
                        alertpanel_error(_("Book/folder path is not set.\n\n"
                                                "If you want to match %s against the whole address book, "
-                                               "you have to select 'Any' from the book/folder drop-down list."),
-                                               tmp);
+                                               "you have to select '%s' from the book/folder drop-down list."),
+                                               tmp, _("Any"));
                        g_free(tmp);
                    return NULL;
                }
-               /* don't store translated "Any"/"All" in matcher expressions */
-               if (strcasecmp(header, Q_("Filtering Matcher Menu|All")) == 0)
+               /* store UNtranslated "Any"/"All" in matcher expressions */
+               if (g_utf8_collate(header, Q_("Filtering Matcher Menu|All")) == 0)
                        header = "All";
                else
-                       if (strcasecmp(header, _("Any")) == 0)
+                       if (g_utf8_collate(header, _("Any")) == 0)
                                header = "Any";
-               if (strcasecmp(expr, _("Any")) == 0)
+               if (g_utf8_collate(expr, _("Any")) == 0)
                        expr = "Any";
                break;
        }