[Commits] [SCM] claws branch, master, updated. 4.1.1-37-g681b0766c

paul at claws-mail.org paul at claws-mail.org
Mon Feb 6 14:08:07 UTC 2023


The branch, master has been updated
       via  681b0766cfd81b748d09b8239726ade553e7deea (commit)
      from  eba27f8d59cfae9090e275cf57e5bb9ac9247dbf (commit)

Summary of changes:
 src/gtk/about.c                         | 5 +++++
 src/main.h                              | 3 ++-
 src/plugins/bogofilter/bogofilter.c     | 7 +++++--
 src/plugins/bsfilter/bsfilter.c         | 6 +++++-
 src/plugins/spamassassin/spamassassin.c | 6 +++++-
 5 files changed, 22 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 681b0766cfd81b748d09b8239726ade553e7deea
Author: Paul <paul at claws-mail.org>
Date:   Mon Feb 6 14:08:03 2023 +0000

    add spam stats to session stats

diff --git a/src/gtk/about.c b/src/gtk/about.c
index 54f9f897f..79b957440 100644
--- a/src/gtk/about.c
+++ b/src/gtk/about.c
@@ -760,6 +760,11 @@ static void about_update_stats(void)
 					session_stats.received);
 		gtk_text_buffer_insert_with_tags_by_name(stats_text_buffer, &iter, buf, -1,
 				"indented-list-item", "bold", NULL);
+		if (session_stats.spam > 0) {
+			g_snprintf(buf, sizeof(buf), _("Spam messages: %d\n"), session_stats.spam);
+			gtk_text_buffer_insert_with_tags_by_name(stats_text_buffer, &iter, buf, -1,
+								 "indented-list-item", NULL);
+		}
 
 		gtk_text_buffer_insert(stats_text_buffer, &iter, "\n", 1);
 		gtk_text_buffer_insert_with_tags_by_name(stats_text_buffer, &iter,
diff --git a/src/main.h b/src/main.h
index 53b973211..901430b3d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2023 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,6 +32,7 @@ typedef struct _SessionStats SessionStats;
 struct _SessionStats
 {
 	gint received;
+	gint spam;
 	gint sent;
 	gint replied;
 	gint forwarded;
diff --git a/src/plugins/bogofilter/bogofilter.c b/src/plugins/bogofilter/bogofilter.c
index 8e4e7fc1f..03d037ee6 100644
--- a/src/plugins/bogofilter/bogofilter.c
+++ b/src/plugins/bogofilter/bogofilter.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2021 the Claws Mail team and Colin Leroy
+ * Copyright (C) 1999-2023 the Claws Mail team and Colin Leroy
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -45,6 +45,7 @@
 #include "prefs_gtk.h"
 
 #include "bogofilter.h"
+#include "main.h"
 #include "inc.h"
 #include "log.h"
 #include "prefs_common.h"
@@ -84,6 +85,8 @@ static MessageCallback message_callback;
 
 static BogofilterConfig config;
 
+extern SessionStats session_stats;
+
 static PrefParam param[] = {
 	{"process_emails", "TRUE", &config.process_emails, P_BOOL,
 	 NULL, NULL, NULL},
@@ -303,7 +306,7 @@ static void bogofilter_do_filter(BogoFilterData *data)
 								data->mail_filtering_data->filtered, msginfo);
 						}
 						data->new_spams = g_slist_prepend(data->new_spams, msginfo);
-
+						session_stats.spam++;
 					} else if (whitelisted && parts && parts[0] && parts[1] && 
 							(*parts[1] == 'S' || *parts[1] == 'U')) {
 
diff --git a/src/plugins/bsfilter/bsfilter.c b/src/plugins/bsfilter/bsfilter.c
index b4d59cb11..d7972cbe9 100644
--- a/src/plugins/bsfilter/bsfilter.c
+++ b/src/plugins/bsfilter/bsfilter.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2021 the Claws Mail team and
+ * Copyright (C) 1999-2023 the Claws Mail team and
  * Colin Leroy <colin at colino.net>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -48,6 +48,7 @@
 #include "utils.h"
 
 #include "bsfilter.h"
+#include "main.h"
 #include "inc.h"
 #include "log.h"
 #include "prefs_common.h"
@@ -83,6 +84,8 @@ static MessageCallback message_callback;
 
 static BsfilterConfig config;
 
+extern SessionStats session_stats;
+
 static PrefParam param[] = {
 	{"process_emails", "TRUE", &config.process_emails, P_BOOL,
 	 NULL, NULL, NULL},
@@ -340,6 +343,7 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
 	} else {
 		if (!whitelisted || (whitelisted && !config.learn_from_whitelist)) {
 			procmsg_msginfo_set_flags(msginfo, MSG_SPAM, 0);
+			session_stats.spam++;
 			debug_print("flagging spam: %d\n", msginfo->msgnum);
 			filtered = TRUE;
 		}
diff --git a/src/plugins/spamassassin/spamassassin.c b/src/plugins/spamassassin/spamassassin.c
index 19a188968..5ab8aa787 100644
--- a/src/plugins/spamassassin/spamassassin.c
+++ b/src/plugins/spamassassin/spamassassin.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2021 the Claws Mail Team
+ * Copyright (C) 1999-2023 the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,6 +46,7 @@
 
 #include "libspamc.h"
 #include "spamassassin.h"
+#include "main.h"
 #include "inc.h"
 #include "log.h"
 #include "prefs_common.h"
@@ -88,6 +89,8 @@ static MessageCallback message_callback;
 
 static SpamAssassinConfig config;
 
+extern SessionStats session_stats;
+
 static PrefParam param[] = {
 	{"enable", "FALSE", &config.enable, P_BOOL,
 	NULL, NULL, NULL},
@@ -297,6 +300,7 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
 	if (is_spam) {
 		debug_print("message is spam\n");
 		procmsg_msginfo_set_flags(msginfo, MSG_SPAM, 0);
+		session_stats.spam++;
 		if (config.receive_spam) {
 			FolderItem *save_folder = NULL;
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list