[Commits] [SCM] claws branch, master, updated. 3.18.0-48-gc66ece0bb
wwp at claws-mail.org
wwp at claws-mail.org
Wed Sep 1 09:47:21 UTC 2021
The branch, master has been updated
via c66ece0bb1e4e2de82a09e97ea83ae0775704533 (commit)
from d17d5e5ac3106bfd2fd5280bf345af76f4418e35 (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 c66ece0bb1e4e2de82a09e97ea83ae0775704533
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 37b8e88ae..17fa43167 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -757,12 +757,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) },
@@ -1820,12 +1822,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)
@@ -5047,6 +5051,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);
}
@@ -5060,6 +5065,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 01024f9ff..7892aa538 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) },
@@ -646,12 +648,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)
@@ -2891,6 +2895,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,
@@ -2910,6 +2915,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 7375c99fa..a641a70f5 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -781,6 +781,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 */
@@ -788,6 +789,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