2007-03-09 [wwp] 2.8.1cvs4
authorTristan Chabredier <wwp@claws-mail.org>
Fri, 9 Mar 2007 07:26:34 +0000 (07:26 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Fri, 9 Mar 2007 07:26:34 +0000 (07:26 +0000)
* src/addr_compl.c
* src/addr_compl.h
* src/filtering.c
Optimize matching of addresses in the addressbook
(filtering/processing 'found_in_addressbook' condition).

ChangeLog
PATCHSETS
configure.ac
src/addr_compl.c
src/addr_compl.h
src/filtering.c

index 6ea3480fd4e6abecd84757e49c2e71642ec7316b..9070a20269fe4ac900e7c21149a1481a71b407c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-03-09 [wwp]       2.8.1cvs4
+
+       * src/addr_compl.c
+       * src/addr_compl.h
+       * src/filtering.c
+               Optimize matching of addresses in the addressbook
+               (filtering/processing 'found_in_addressbook' condition).
+
 2007-03-07 [wwp]       2.8.1cvs3
 
        * src/quote_fmt.c
index 7aeee87de58020729d5b3efa4219a4e181e88bc2..948f8859e94a2f7e518da2208837c087fea8957f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.42.2.28 -r 1.42.2.29 NEWS;  cvs diff -u -r 1.8.2.32 -r 1.8.2.33 README;  cvs diff -u -r 1.1.2.17 -r 1.1.2.18 RELEASE_NOTES;  cvs diff -u -r 1.654.2.2473 -r 1.654.2.2474 configure.ac;  ) > 2.8.1cvs1.patchset
 ( cvs diff -u -r 1.5.2.54 -r 1.5.2.55 src/gtk/gtkutils.c;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/trayicon/trayicon_prefs.h;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/trayicon/trayicon_prefs.c;  cvs diff -u -r 1.14.2.52 -r 1.14.2.53 src/plugins/trayicon/trayicon.c;  cvs diff -u -r 1.39.2.32 -r 1.39.2.33 src/mainwindow.h;  cvs diff -u -r 1.274.2.176 -r 1.274.2.177 src/mainwindow.c;  ) > 2.8.1cvs2.patchset
 ( cvs diff -u -r 1.8.2.14 -r 1.8.2.15 src/quote_fmt.c;  cvs diff -u -r 1.8.2.8 -r 1.8.2.9 src/quote_fmt_lex.l;  cvs diff -u -r 1.22.2.27 -r 1.22.2.28 src/quote_fmt_parse.y;  ) > 2.8.1cvs3.patchset
+( cvs diff -u -r 1.27.2.34 -r 1.27.2.35 src/addr_compl.c;  cvs diff -u -r 1.8.2.9 -r 1.8.2.10 src/addr_compl.h;  cvs diff -u -r 1.60.2.28 -r 1.60.2.29 src/filtering.c;  ) > 2.8.1cvs4.patchset
index 832c63c5b33ad04ab64e40d4927b23a9871eefd6..fee5db46af9447b5f7065afe35269c79beffaec3 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=3
+EXTRA_VERSION=4
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 64f8b95be2694c4916880d55dbe6ae26a906afd4..f7687ccfe528b66e1c3c1c9fb18596c313f16db0 100644 (file)
@@ -545,6 +545,33 @@ guint complete_address(const gchar *str)
        return count;
 }
 
+/**
+ * complete_matches_found() returns the number of matched addresses according
+ * to the completion mechanism. Unlike complete_address(), the returned value
+ * doesn't count str itself. If there's no match, it returns 0.
+ * To get a list of completion matches, see complete_address() instead.
+ */
+guint complete_matches_found(const gchar *str)
+{
+       GList *result = NULL;
+       gchar *d = NULL;
+
+       g_return_val_if_fail(str != NULL, 0);
+
+       /* g_completion is case sensitive */
+       d = g_utf8_strdown(str, -1);
+
+       clear_completion_cache();
+       g_completion_prefix = g_strdup(str);
+
+       result = g_completion_complete(g_completion, d, NULL);
+
+       g_free(g_completion_prefix);
+       g_free(d);
+
+       return g_list_length(result);
+}
+
 /**
  * Return a complete address from the index.
  * \param index Index of entry that was found (by the previous call to
index ab9ae93e1c0d3b90a7913b19d04c97178060e1d5..218ce880a01190688e0409f634a9ca5dbe93da4c 100644 (file)
@@ -25,6 +25,7 @@
 
 gint start_address_completion          (gchar *folderpath);
 guint complete_address                 (const gchar *str);
+guint complete_matches_found                           (const gchar *str);
 gchar *get_complete_address            (gint index);
 gint invalidate_address_completion     (void);
 gint end_address_completion            (void);
index 75c25842ccf0bb066f6272e051aec994270067f6..be445adb067cf515447b091913fafa423d268c8d 100644 (file)
@@ -453,7 +453,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                                        gchar *stripped_addr = g_strdup(walk->data);
                                        extract_address(stripped_addr);
 
-                                       if (complete_address(walk->data) <= 1) {
+                                       if (complete_matches_found(walk->data) == 0) {
                                                debug_print("adding address '%s' to addressbook '%s'\n",
                                                                stripped_addr, action->destination);
                                                if (!addrbook_add_contact(abf, folder, stripped_addr, stripped_addr, NULL)) {