[Commits] [SCM] claws branch, gtk2, updated. 3.19.1-31-ga50dcf478

paul at claws-mail.org paul at claws-mail.org
Tue Feb 7 10:11:59 UTC 2023


The branch, gtk2 has been updated
       via  a50dcf4781345bfb24769af86b842d33b051870b (commit)
      from  77725587c7b8add1b250dc1da4adf2aa3b0f0fe0 (commit)

Summary of changes:
 src/gtk/about.c                         | 5 +++++
 src/main.h                              | 5 +++--
 src/plugins/bogofilter/bogofilter.c     | 9 ++++++---
 src/plugins/bsfilter/bsfilter.c         | 8 ++++++--
 src/plugins/spamassassin/spamassassin.c | 8 ++++++--
 5 files changed, 26 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit a50dcf4781345bfb24769af86b842d33b051870b
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 12a79ce6c..ae96ec0df 100644
--- a/src/gtk/about.c
+++ b/src/gtk/about.c
@@ -756,6 +756,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 b1fb2fd70..901430b3d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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 678d2d6c4..aeaaebe7d 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
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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 c52e89e0c..86f25444a 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
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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 dedbe96e4..00a81ab34 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
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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