[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-89-gffddaa73d
wwp at claws-mail.org
wwp at claws-mail.org
Wed Sep 1 09:48:03 UTC 2021
The branch, gtk3 has been updated
via ffddaa73d93f318eb1bc2f82d10cba737e7a1e1e (commit)
from 62b64faeb9b22e7e3c0b2bf9a5a3506bd0b852f3 (commit)
Summary of changes:
src/mainwindow.c | 6 ++++++
src/messageview.c | 6 ++++++
src/prefs_filtering.h | 3 ++-
src/procmsg.c | 26 ++++++++++++++++++++++++--
src/summaryview.c | 2 ++
5 files changed, 40 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit ffddaa73d93f318eb1bc2f82d10cba737e7a1e1e
Author: wwp <subscript at free.fr>
Date: Wed Sep 1 11:47:00 2021 +0200
Allow creating a filtering rule based on the Sender header value.
diff --git a/src/mainwindow.c b/src/mainwindow.c
index adb127e0f..aa01220a0 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -751,12 +751,14 @@ static GtkActionEntry mainwin_entries[] =
{"Tools/CreateFilterRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
{"Tools/CreateFilterRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO */
{"Tools/CreateFilterRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
+ {"Tools/CreateFilterRule/BySender", NULL, N_("By S_ender"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SENDER */
{"Tools/CreateProcessingRule", NULL, N_("Create processing rule"), NULL, NULL, NULL },
{"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) },
+ {"Tools/CreateProcessingRule/BySender", NULL, N_("By S_ender"), NULL, NULL, G_CALLBACK(create_processing_cb) },
/* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
{"Tools/ListUrls", NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) },
@@ -1810,12 +1812,14 @@ MainWindow *main_window_create()
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateFilterRule", "BySender", "Tools/CreateFilterRule/BySender", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "CreateProcessingRule", "Tools/CreateProcessingRule", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "Automatically", "Tools/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySender", "Tools/CreateProcessingRule/BySender", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator2", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ListUrls", "Tools/ListUrls", GTK_UI_MANAGER_MENUITEM)
@@ -4999,6 +5003,7 @@ static void create_filter_cb(GtkAction *gaction, gpointer data)
DO_ACTION("Tools/CreateFilterRule/ByFrom", FILTER_BY_FROM);
DO_ACTION("Tools/CreateFilterRule/ByTo", FILTER_BY_TO);
DO_ACTION("Tools/CreateFilterRule/BySubject", FILTER_BY_SUBJECT);
+ DO_ACTION("Tools/CreateFilterRule/BySender", FILTER_BY_SENDER);
summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 0);
}
@@ -5012,6 +5017,7 @@ static void create_processing_cb(GtkAction *gaction, gpointer data)
DO_ACTION("Tools/CreateProcessingRule/ByFrom", FILTER_BY_FROM);
DO_ACTION("Tools/CreateProcessingRule/ByTo", FILTER_BY_TO);
DO_ACTION("Tools/CreateProcessingRule/BySubject", FILTER_BY_SUBJECT);
+ DO_ACTION("Tools/CreateProcessingRule/BySender", FILTER_BY_SENDER);
summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 1);
}
diff --git a/src/messageview.c b/src/messageview.c
index 094ec0498..1921b6612 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -322,12 +322,14 @@ static GtkActionEntry msgview_entries[] =
{"Tools/CreateFilterRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
{"Tools/CreateFilterRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO */
{"Tools/CreateFilterRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
+ {"Tools/CreateFilterRule/BySender", NULL, N_("By S_ender"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SENDER */
{"Tools/CreateProcessingRule", NULL, N_("Create processing rule"), NULL, NULL, NULL },
{"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) },
{"Tools/CreateProcessingRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) },
+ {"Tools/CreateProcessingRule/BySender", NULL, N_("By S_ender"), NULL, NULL, G_CALLBACK(create_processing_cb) },
/* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */
{"Tools/ListUrls", NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) },
@@ -647,12 +649,14 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "BySender", "Tools/CreateFilterRule/BySender", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "CreateProcessingRule", "Tools/CreateProcessingRule", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "Automatically", "Tools/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySender", "Tools/CreateProcessingRule/BySender", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "Separator2", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "ListUrls", "Tools/ListUrls", GTK_UI_MANAGER_MENUITEM)
@@ -2889,6 +2893,7 @@ static void create_filter_cb(GtkAction *gaction, gpointer data)
DO_ACTION("Tools/CreateFilterRule/ByFrom", FILTER_BY_FROM);
DO_ACTION("Tools/CreateFilterRule/ByTo", FILTER_BY_TO);
DO_ACTION("Tools/CreateFilterRule/BySubject", FILTER_BY_SUBJECT);
+ DO_ACTION("Tools/CreateFilterRule/BySender", FILTER_BY_SENDER);
item = messageview->msginfo->folder;
summary_msginfo_filter_open(item, messageview->msginfo,
@@ -2908,6 +2913,7 @@ static void create_processing_cb(GtkAction *gaction, gpointer data)
DO_ACTION("Tools/CreateProcessingRule/ByFrom", FILTER_BY_FROM);
DO_ACTION("Tools/CreateProcessingRule/ByTo", FILTER_BY_TO);
DO_ACTION("Tools/CreateProcessingRule/BySubject", FILTER_BY_SUBJECT);
+ DO_ACTION("Tools/CreateProcessingRule/BySender", FILTER_BY_SENDER);
item = messageview->msginfo->folder;
summary_msginfo_filter_open(item, messageview->msginfo,
diff --git a/src/prefs_filtering.h b/src/prefs_filtering.h
index d5ab1d092..de53a5270 100644
--- a/src/prefs_filtering.h
+++ b/src/prefs_filtering.h
@@ -33,7 +33,8 @@ typedef enum
FILTER_BY_AUTO,
FILTER_BY_FROM,
FILTER_BY_TO,
- FILTER_BY_SUBJECT
+ FILTER_BY_SUBJECT,
+ FILTER_BY_SENDER
} PrefsFilterType;
#include "folder.h"
diff --git a/src/procmsg.c b/src/procmsg.c
index fee027da9..fdc8017d0 100644
--- a/src/procmsg.c
+++ b/src/procmsg.c
@@ -628,8 +628,6 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
*key = g_strdup(msginfo->subject);
}
-#undef SET_FILTER_KEY
-
g_free(hentry[H_X_BEENTHERE].body);
hentry[H_X_BEENTHERE].body = NULL;
g_free(hentry[H_X_ML_NAME].body);
@@ -658,6 +656,30 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
*header = g_strdup("subject");
*key = g_strdup(msginfo->subject);
break;
+ case FILTER_BY_SENDER:
+ if ((fp = procmsg_open_message(msginfo, FALSE)) == NULL)
+ return;
+ procheader_get_header_fields(fp, hentry);
+ fclose(fp);
+
+ if (hentry[H_SENDER].body != NULL)
+ SET_FILTER_KEY("header \"Sender\"", H_SENDER);
+
+ g_free(hentry[H_X_BEENTHERE].body);
+ hentry[H_X_BEENTHERE].body = NULL;
+ g_free(hentry[H_X_ML_NAME].body);
+ hentry[H_X_ML_NAME].body = NULL;
+ g_free(hentry[H_X_LIST].body);
+ hentry[H_X_LIST].body = NULL;
+ g_free(hentry[H_X_MAILING_LIST].body);
+ hentry[H_X_MAILING_LIST].body = NULL;
+ g_free(hentry[H_LIST_ID].body);
+ hentry[H_LIST_ID].body = NULL;
+ g_free(hentry[H_SENDER].body);
+ hentry[H_SENDER].body = NULL;
+
+#undef SET_FILTER_KEY
+ break;
default:
break;
}
diff --git a/src/summaryview.c b/src/summaryview.c
index 3437dbed9..4387d8057 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -774,6 +774,7 @@ SummaryView *summary_create(MainWindow *mainwin)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "BySender", "Tools/CreateFilterRule/BySender", GTK_UI_MANAGER_MENUITEM)
#ifndef GENERIC_UMPC
/* submenus - createprocessingrule */
@@ -781,6 +782,7 @@ SummaryView *summary_create(MainWindow *mainwin)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "BySender", "Tools/CreateProcessingRule/BySender", GTK_UI_MANAGER_MENUITEM)
#endif
/* submenus - view */
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list