[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-422-gaf51609d2
wwp at claws-mail.org
wwp at claws-mail.org
Wed Mar 9 18:23:17 CET 2022
The branch, gtk3 has been updated
via af51609d216c8449f2631646504433caf0ca8057 (commit)
from d7f5e949b86595bb4f4f2d8a400494cb5cfc7359 (commit)
Summary of changes:
src/plugins/address_keeper/address_keeper.c | 62 ++++++++++++++---------------
src/plugins/attachwarner/attachwarner.c | 40 +++++++++----------
src/plugins/keyword_warner/keyword_warner.c | 42 +++++++++----------
3 files changed, 72 insertions(+), 72 deletions(-)
- Log -----------------------------------------------------------------
commit af51609d216c8449f2631646504433caf0ca8057
Author: wwp <subscript at free.fr>
Date: Wed Mar 9 18:21:46 2022 +0100
Fix crash in attachwarner and keywordwarner plugins when regexp list
is empty. Rework a bit the logic in the addrkeeper plugin as well.
diff --git a/src/plugins/address_keeper/address_keeper.c b/src/plugins/address_keeper/address_keeper.c
index 8d6baa8ae..a7c07ebb6 100644
--- a/src/plugins/address_keeper/address_keeper.c
+++ b/src/plugins/address_keeper/address_keeper.c
@@ -196,39 +196,39 @@ static gboolean addrk_before_send_hook(gpointer source, gpointer data)
if (addkeeperprefs.block_matching_addrs != NULL
&& addkeeperprefs.block_matching_addrs[0] != '\0') {
blocked = matcherlist_new_from_lines(addkeeperprefs.block_matching_addrs, FALSE, FALSE);
- if (blocked == NULL)
- g_warning("couldn't allocate matcher");
- }
- for (cur = compose->header_list; cur != NULL; cur = cur->next) {
- gchar *header;
- gchar *entry;
- header = gtk_editable_get_chars(GTK_EDITABLE(
- gtk_bin_get_child(GTK_BIN(
- (((ComposeHeaderEntry *)cur->data)->combo)))), 0, -1);
- entry = gtk_editable_get_chars(GTK_EDITABLE(
- ((ComposeHeaderEntry *)cur->data)->entry), 0, -1);
- g_strstrip(entry);
- g_strstrip(header);
- if (*entry != '\0') {
- if (!g_ascii_strcasecmp(header, to_hdr)
- && addkeeperprefs.keep_to_addrs == TRUE) {
- keep_if_unknown(abf, folder, entry, blocked);
- }
- if (!g_ascii_strcasecmp(header, cc_hdr)
- && addkeeperprefs.keep_cc_addrs == TRUE) {
- keep_if_unknown(abf, folder, entry, blocked);
- }
- if (!g_ascii_strcasecmp(header, bcc_hdr)
- && addkeeperprefs.keep_bcc_addrs == TRUE) {
- keep_if_unknown(abf, folder, entry, blocked);
+
+ if (blocked) {
+ for (cur = compose->header_list; cur != NULL; cur = cur->next) {
+ gchar *header;
+ gchar *entry;
+ header = gtk_editable_get_chars(GTK_EDITABLE(
+ gtk_bin_get_child(GTK_BIN(
+ (((ComposeHeaderEntry *)cur->data)->combo)))), 0, -1);
+ entry = gtk_editable_get_chars(GTK_EDITABLE(
+ ((ComposeHeaderEntry *)cur->data)->entry), 0, -1);
+ g_strstrip(entry);
+ g_strstrip(header);
+ if (*entry != '\0') {
+ if (!g_ascii_strcasecmp(header, to_hdr)
+ && addkeeperprefs.keep_to_addrs == TRUE) {
+ keep_if_unknown(abf, folder, entry, blocked);
+ }
+ if (!g_ascii_strcasecmp(header, cc_hdr)
+ && addkeeperprefs.keep_cc_addrs == TRUE) {
+ keep_if_unknown(abf, folder, entry, blocked);
+ }
+ if (!g_ascii_strcasecmp(header, bcc_hdr)
+ && addkeeperprefs.keep_bcc_addrs == TRUE) {
+ keep_if_unknown(abf, folder, entry, blocked);
+ }
+ }
+ g_free(header);
+ g_free(entry);
}
- }
- g_free(header);
- g_free(entry);
+ matcherlist_free(blocked);
+ } else
+ g_warning("couldn't allocate matcher");
}
- if (blocked != NULL)
- matcherlist_free(blocked);
-
return FALSE; /* continue sending */
}
diff --git a/src/plugins/attachwarner/attachwarner.c b/src/plugins/attachwarner/attachwarner.c
index 49048319b..3a323424d 100644
--- a/src/plugins/attachwarner/attachwarner.c
+++ b/src/plugins/attachwarner/attachwarner.c
@@ -109,27 +109,27 @@ AttachWarnerMention *are_attachments_mentioned(Compose *compose)
AttachWarnerMention *mention = NULL;
MatcherList *matchers = NULL;
- matchers = matcherlist_new_from_lines(attwarnerprefs.match_strings, FALSE, attwarnerprefs.case_sensitive);
-
- if (matchers == NULL) {
- g_warning("couldn't allocate matcher");
- return FALSE;
+ if (attwarnerprefs.match_strings != NULL
+ && attwarnerprefs.match_strings[0] != '\0') {
+ matchers = matcherlist_new_from_lines(attwarnerprefs.match_strings, FALSE, attwarnerprefs.case_sensitive);
+
+ if (matchers) {
+ textview = GTK_TEXT_VIEW(compose->text);
+ textbuffer = gtk_text_view_get_buffer(textview);
+ gtk_text_buffer_get_start_iter(textbuffer, &start);
+ gtk_text_buffer_get_end_iter(textbuffer, &end);
+ text = gtk_text_buffer_get_text(textbuffer, &start, &end, FALSE);
+
+ debug_print("checking text for attachment mentions\n");
+ if (text != NULL) {
+ mention = aw_matcherlist_string_match(matchers, text, compose->account->sig_sep);
+ g_free(text);
+ }
+ matcherlist_free(matchers);
+ debug_print("done\n");
+ } else
+ g_warning("couldn't allocate matcher");
}
-
- textview = GTK_TEXT_VIEW(compose->text);
- textbuffer = gtk_text_view_get_buffer(textview);
- gtk_text_buffer_get_start_iter(textbuffer, &start);
- gtk_text_buffer_get_end_iter(textbuffer, &end);
- text = gtk_text_buffer_get_text(textbuffer, &start, &end, FALSE);
-
- debug_print("checking text for attachment mentions\n");
- if (text != NULL) {
- mention = aw_matcherlist_string_match(matchers, text, compose->account->sig_sep);
- g_free(text);
- }
- if (matchers != NULL)
- matcherlist_free(matchers);
- debug_print("done\n");
return mention;
}
diff --git a/src/plugins/keyword_warner/keyword_warner.c b/src/plugins/keyword_warner/keyword_warner.c
index 10164f607..bba53d9ff 100644
--- a/src/plugins/keyword_warner/keyword_warner.c
+++ b/src/plugins/keyword_warner/keyword_warner.c
@@ -109,27 +109,27 @@ KeywordWarnerMention *is_keyword_mentioned(Compose *compose)
KeywordWarnerMention *mention = NULL;
MatcherList *matchers = NULL;
- matchers = matcherlist_new_from_lines(kwarnerprefs.match_strings, FALSE, kwarnerprefs.case_sensitive);
-
- if (matchers == NULL) {
- g_warning("couldn't allocate matcher");
- return FALSE;
- }
-
- textview = GTK_TEXT_VIEW(compose->text);
- textbuffer = gtk_text_view_get_buffer(textview);
- gtk_text_buffer_get_start_iter(textbuffer, &start);
- gtk_text_buffer_get_end_iter(textbuffer, &end);
- text = gtk_text_buffer_get_text(textbuffer, &start, &end, FALSE);
-
- debug_print("checking text for keyword mentions\n");
- if (text != NULL) {
- mention = kw_matcherlist_string_match(matchers, text, compose->account->sig_sep);
- g_free(text);
- }
- if (matchers != NULL)
- matcherlist_free(matchers);
- debug_print("done\n");
+ if (kwarnerprefs.match_strings != NULL
+ && kwarnerprefs.match_strings[0] != '\0') {
+ matchers = matcherlist_new_from_lines(kwarnerprefs.match_strings, FALSE, kwarnerprefs.case_sensitive);
+
+ if (matchers) {
+ textview = GTK_TEXT_VIEW(compose->text);
+ textbuffer = gtk_text_view_get_buffer(textview);
+ gtk_text_buffer_get_start_iter(textbuffer, &start);
+ gtk_text_buffer_get_end_iter(textbuffer, &end);
+ text = gtk_text_buffer_get_text(textbuffer, &start, &end, FALSE);
+
+ debug_print("checking text for keyword mentions\n");
+ if (text != NULL) {
+ mention = kw_matcherlist_string_match(matchers, text, compose->account->sig_sep);
+ g_free(text);
+ }
+ matcherlist_free(matchers);
+ debug_print("done\n");
+ } else
+ g_warning("couldn't allocate matcher");
+ }
return mention;
}
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list