[Commits] [SCM] claws branch, gtk2, updated. 3.19.1-70-g3254def95
wwp at claws-mail.org
wwp at claws-mail.org
Thu Sep 21 12:33:55 UTC 2023
The branch, gtk2 has been updated
via 3254def958e43e02f586ef663c09471171776d05 (commit)
from a6acce707207d677af16eac0131fdcd4824f9f45 (commit)
Summary of changes:
src/advsearch.c | 113 ++++++++++++++++++++++++++++++--------------------
src/gtk/quicksearch.c | 5 ++-
2 files changed, 70 insertions(+), 48 deletions(-)
- Log -----------------------------------------------------------------
commit 3254def958e43e02f586ef663c09471171776d05
Author: wwp <subscript at free.fr>
Date: Thu Sep 21 14:32:02 2023 +0200
fix bug 4700, 'Add v H V search shortcut'
patch by Thomas Orgis
diff --git a/src/advsearch.c b/src/advsearch.c
index 85dc3cc2d..73cc7acf5 100644
--- a/src/advsearch.c
+++ b/src/advsearch.c
@@ -1,6 +1,6 @@
/*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2012-2014 the Claws Mail team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 2012-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
@@ -14,7 +14,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#ifdef HAVE_CONFIG_H
@@ -130,11 +129,68 @@ void advsearch_abort(AdvancedSearch *search)
search->search_aborted = TRUE;
}
+
+static void advsearch_extract_param(GString *matcherstr, gchar **cmd_start_, gchar **cmd_end_, gboolean quotes, gboolean qualifier, gboolean casesens, gboolean regex)
+{
+ gchar *cmd_start, *cmd_end;
+ gchar term_char, save_char;
+
+ cmd_start = *cmd_start_;
+ cmd_end = *cmd_end_;
+
+ /* extract a parameter, allow quotes */
+ while (*cmd_end && isspace((guchar)*cmd_end))
+ cmd_end++;
+
+ cmd_start = cmd_end;
+ if (*cmd_start == '"') {
+ term_char = '"';
+ cmd_end++;
+ }
+ else
+ term_char = ' ';
+
+ /* extract actual parameter */
+ while ((*cmd_end) && (*cmd_end != term_char))
+ cmd_end++;
+
+ if (*cmd_end == '"')
+ cmd_end++;
+
+ save_char = *cmd_end;
+ *cmd_end = '\0';
+
+ if (qualifier) {
+ if (casesens)
+ g_string_append(matcherstr, regex ? "regexp " : "match ");
+ else
+ g_string_append(matcherstr, regex ? "regexpcase " : "matchcase ");
+ }
+
+ /* do we need to add quotes ? */
+ if (quotes && term_char != '"')
+ g_string_append(matcherstr, "\"");
+
+ /* copy actual parameter */
+ g_string_append(matcherstr, cmd_start);
+
+ /* do we need to add quotes ? */
+ if (quotes && term_char != '"')
+ g_string_append(matcherstr, "\"");
+
+ /* restore original character */
+ *cmd_end = save_char;
+
+ *cmd_end_ = cmd_end;
+ *cmd_start_ = cmd_start;
+ return;
+}
+
gchar *advsearch_expand_search_string(const gchar *search_string)
{
int i = 0;
- gchar term_char, save_char;
gchar *cmd_start, *cmd_end;
+ gchar save_char;
GString *matcherstr;
gchar *returnstr = NULL;
gchar *copy_str;
@@ -190,6 +246,7 @@ gchar *advsearch_expand_search_string(const gchar *search_string)
{ "x", "references", 1, TRUE, TRUE },
{ "X", "test", 1, FALSE, FALSE },
{ "y", "header \"X-Label\"", 1, TRUE, TRUE },
+ { "v", "header", 2, TRUE, TRUE },
{ "&", "&", 0, FALSE, FALSE },
{ "|", "|", 0, FALSE, FALSE },
{ "p", "partial", 0, FALSE, FALSE },
@@ -258,49 +315,13 @@ gchar *advsearch_expand_search_string(const gchar *search_string)
if (cmds[i].numparams == 0)
break;
- /* extract a parameter, allow quotes */
- while (*cmd_end && isspace((guchar)*cmd_end))
- cmd_end++;
-
- cmd_start = cmd_end;
- if (*cmd_start == '"') {
- term_char = '"';
- cmd_end++;
- }
- else
- term_char = ' ';
-
- /* extract actual parameter */
- while ((*cmd_end) && (*cmd_end != term_char))
- cmd_end++;
-
- if (*cmd_end == '"')
- cmd_end++;
-
- save_char = *cmd_end;
- *cmd_end = '\0';
-
- if (cmds[i].qualifier) {
- if (casesens)
- g_string_append(matcherstr, regex ? "regexp " : "match ");
- else
- g_string_append(matcherstr, regex ? "regexpcase " : "matchcase ");
+ /* extract a first parameter before the final matched one */
+ if (cmds[i].numparams == 2)
+ {
+ advsearch_extract_param(matcherstr, &cmd_start, &cmd_end, cmds[i].quotes, FALSE, casesens, regex);
+ g_string_append(matcherstr, " ");
}
-
- /* do we need to add quotes ? */
- if (cmds[i].quotes && term_char != '"')
- g_string_append(matcherstr, "\"");
-
- /* copy actual parameter */
- g_string_append(matcherstr, cmd_start);
-
- /* do we need to add quotes ? */
- if (cmds[i].quotes && term_char != '"')
- g_string_append(matcherstr, "\"");
-
- /* restore original character */
- *cmd_end = save_char;
-
+ advsearch_extract_param(matcherstr, &cmd_start, &cmd_end, cmds[i].quotes, cmds[i].qualifier, casesens, regex);
break;
}
}
diff --git a/src/gtk/quicksearch.c b/src/gtk/quicksearch.c
index 3b2cfce99..5d1976105 100644
--- a/src/gtk/quicksearch.c
+++ b/src/gtk/quicksearch.c
@@ -1,6 +1,6 @@
/*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2020 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
@@ -512,6 +512,7 @@ static gchar *search_descr_strings[] = {
"tagged",N_("messages which have tag(s)"),
"T", N_("marked messages"),
"U", N_("unread messages"),
+ "v H V", N_("messages which contain V in header H"),
"x S", N_("messages which contain S in References header"),
"X \"cmd args\"", N_("messages returning 0 when passed to command - %F is message file"),
"y S", N_("messages which contain S in X-Label header"),
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list