[Commits] [SCM] claws branch, master, updated. 3.14.1-171-g2016b17

ticho at claws-mail.org ticho at claws-mail.org
Fri Feb 3 17:49:35 CET 2017


The branch, master has been updated
       via  2016b17dad8b37b72ae1678c217ed06ac12966a1 (commit)
      from  02a57d67867128a8aee4229eacaeecd42001f71c (commit)

Summary of changes:
 src/addr_compl.c                        |   27 ++++++++++++++++++++++++++-
 src/addr_compl.h                        |    1 +
 src/plugins/bogofilter/bogofilter.c     |   27 ---------------------------
 src/plugins/bsfilter/bsfilter.c         |   27 ---------------------------
 src/plugins/bsfilter/claws.def          |    4 +---
 src/plugins/dillo/dillo_viewer.c        |   27 ---------------------------
 src/plugins/spamassassin/spamassassin.c |   29 +----------------------------
 7 files changed, 29 insertions(+), 113 deletions(-)


- Log -----------------------------------------------------------------
commit 2016b17dad8b37b72ae1678c217ed06ac12966a1
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Feb 3 17:48:02 2017 +0100

    Moved found_in_addressbook() from plugins to core.
    
    Four identical copies of the same functions removed
    from four plugins and put into addr_compl.[ch].

diff --git a/src/addr_compl.c b/src/addr_compl.c
index e78d90f..f73683e 100644
--- a/src/addr_compl.c
+++ b/src/addr_compl.c
@@ -1833,8 +1833,33 @@ static gboolean addr_compl_defer_select_destruct(CompletionWindow *window)
 	return FALSE;
 }
 
+gboolean found_in_addressbook(const gchar *address)
+{
+	gchar *addr = NULL;
+	gboolean found = FALSE;
+	gint num_addr = 0;
+
+	if (!address)
+		return FALSE;
+
+	addr = g_strdup(address);
+	extract_address(addr);
+	num_addr = complete_address(addr);
+	if (num_addr > 1) {
+		/* skip first item (this is the search string itself) */
+		int i = 1;
+		for (; i < num_addr && !found; i++) {
+			gchar *caddr = get_complete_address(i);
+			extract_address(caddr);
+			if (strcasecmp(caddr, addr) == 0)
+				found = TRUE;
+			g_free(caddr);
+		}
+	}
+	g_free(addr);
+	return found;
+}
 
 /*
  * End of Source.
  */
-
diff --git a/src/addr_compl.h b/src/addr_compl.h
index de9d4b1..741fa43 100644
--- a/src/addr_compl.h
+++ b/src/addr_compl.h
@@ -42,6 +42,7 @@ guint complete_matches_found				(const gchar *str);
 gchar *get_complete_address		(gint index);
 gint invalidate_address_completion	(void);
 gint end_address_completion		(void);
+gboolean found_in_addressbook(const gchar *address);
 
 /* ui functions */
 void address_completion_start		(GtkWidget *mainwindow);
diff --git a/src/plugins/bogofilter/bogofilter.c b/src/plugins/bogofilter/bogofilter.c
index 2363848..75940df 100644
--- a/src/plugins/bogofilter/bogofilter.c
+++ b/src/plugins/bogofilter/bogofilter.c
@@ -162,33 +162,6 @@ static pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t wait_cond = PTHREAD_COND_INITIALIZER; 
 #endif
 
-static gboolean found_in_addressbook(const gchar *address)
-{
-	gchar *addr = NULL;
-	gboolean found = FALSE;
-	gint num_addr = 0;
-	
-	if (!address)
-		return FALSE;
-	
-	addr = g_strdup(address);
-	extract_address(addr);
-	num_addr = complete_address(addr);
-	if (num_addr > 1) {
-		/* skip first item (this is the search string itself) */
-		int i = 1;
-		for (; i < num_addr && !found; i++) {
-			gchar *caddr = get_complete_address(i);
-			extract_address(caddr);
-			if (strcasecmp(caddr, addr) == 0)
-				found = TRUE;
-			g_free(caddr);
-		}
-	}
-	g_free(addr);
-	return found;
-}
-
 static void bogofilter_do_filter(BogoFilterData *data)
 {
 	GPid bogo_pid;
diff --git a/src/plugins/bsfilter/bsfilter.c b/src/plugins/bsfilter/bsfilter.c
index 374c1dd..07c55a2 100644
--- a/src/plugins/bsfilter/bsfilter.c
+++ b/src/plugins/bsfilter/bsfilter.c
@@ -132,33 +132,6 @@ static pthread_mutex_t wait_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t wait_cond = PTHREAD_COND_INITIALIZER; 
 #endif
 
-static gboolean found_in_addressbook(const gchar *address)
-{
-	gchar *addr = NULL;
-	gboolean found = FALSE;
-	gint num_addr = 0;
-	
-	if (!address)
-		return FALSE;
-	
-	addr = g_strdup(address);
-	extract_address(addr);
-	num_addr = complete_address(addr);
-	if (num_addr > 1) {
-		/* skip first item (this is the search string itself) */
-		int i = 1;
-		for (; i < num_addr && !found; i++) {
-			gchar *caddr = get_complete_address(i);
-			extract_address(caddr);
-			if (strcasecmp(caddr, addr) == 0)
-				found = TRUE;
-			g_free(caddr);
-		}
-	}
-	g_free(addr);
-	return found;
-}
-
 static void bsfilter_do_filter(BsFilterData *data)
 {
 	int status = 0;
diff --git a/src/plugins/bsfilter/claws.def b/src/plugins/bsfilter/claws.def
index b326632..9512ffc 100644
--- a/src/plugins/bsfilter/claws.def
+++ b/src/plugins/bsfilter/claws.def
@@ -31,17 +31,15 @@ prefs_common_get_prefs
 addressbook_folder_selection
 alertpanel_error
 combobox_text_new
-complete_address
 end_address_completion
 execute_command_line
-extract_address
 folder_find_item_from_identifier
 folder_get_default_trash
 folder_item_get_identifier
 folder_item_get_path
 folder_item_remove_msg
 foldersel_folder_sel
-get_complete_address
+found_in_addressbook
 gtkut_get_browse_directory_btn
 log_error
 prefs_button_toggled
diff --git a/src/plugins/dillo/dillo_viewer.c b/src/plugins/dillo/dillo_viewer.c
index 1c63fa3..6c820f0 100644
--- a/src/plugins/dillo/dillo_viewer.c
+++ b/src/plugins/dillo/dillo_viewer.c
@@ -76,33 +76,6 @@ static gboolean socket_destroy_cb(GtkObject *object, gpointer data)
 	return FALSE;
 }
 
-static gboolean found_in_addressbook(const gchar *address)
-{
-	gchar *addr = NULL;
-	gboolean found = FALSE;
-	gint num_addr = 0;
-	
-	if (!address)
-		return FALSE;
-	
-	addr = g_strdup(address);
-	extract_address(addr);
-	num_addr = complete_address(addr);
-	if (num_addr > 1) {
-		/* skip first item (this is the search string itself) */
-		int i = 1;
-		for (; i < num_addr && !found; i++) {
-			gchar *caddr = get_complete_address(i);
-			extract_address(caddr);
-			if (strcasecmp(caddr, addr) == 0)
-				found = TRUE;
-			g_free(caddr);
-		}
-	}
-	g_free(addr);
-	return found;
-}
-
 static gboolean load_images(DilloViewer *viewer)
 {
 	MessageView *messageview = ((MimeViewer *)viewer)->mimeview 
diff --git a/src/plugins/spamassassin/spamassassin.c b/src/plugins/spamassassin/spamassassin.c
index d75c72a..59fd92a 100644
--- a/src/plugins/spamassassin/spamassassin.c
+++ b/src/plugins/spamassassin/spamassassin.c
@@ -196,33 +196,6 @@ static MsgStatus msg_is_spam(FILE *fp)
 	return is_spam ? MSG_IS_SPAM:MSG_IS_HAM;
 }
 
-static gboolean sa_found_in_addressbook(const gchar *address)
-{
-	gchar *addr = NULL;
-	gboolean found = FALSE;
-	gint num_addr = 0;
-	
-	if (!address)
-		return FALSE;
-	
-	addr = g_strdup(address);
-	extract_address(addr);
-	num_addr = complete_address(addr);
-	if (num_addr > 1) {
-		/* skip first item (this is the search string itself) */
-		int i = 1;
-		for (; i < num_addr && !found; i++) {
-			gchar *caddr = get_complete_address(i);
-			extract_address(caddr);
-			if (strcasecmp(caddr, addr) == 0)
-				found = TRUE;
-			g_free(caddr);
-		}
-	}
-	g_free(addr);
-	return found;
-}
-
 static gboolean mail_filtering_hook(gpointer source, gpointer data)
 {
 	MailFilteringData *mail_filtering_data = (MailFilteringData *) source;
@@ -262,7 +235,7 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
 
 		start_address_completion(ab_folderpath);
 		if (msginfo->from && 
-		    sa_found_in_addressbook(msginfo->from))
+		    found_in_addressbook(msginfo->from))
 				whitelisted = TRUE;
 		end_address_completion();
 		

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list