1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Sébastien Helleu 6a98f747e6 Version 3.7.1 2022-10-21 13:01:44 +02:00
Sébastien Helleu dc034e2685 trigger: execute trigger command on appropriate buffer (issue #1841)
This affects the following hook types:

- command
- command_run
- line
- modifier
- print

This fixes a regression introduced in WeeChat 3.7 by commit
0f67f55098.
2022-10-20 20:39:39 +02:00
Sébastien Helleu a0bba1325a Version 3.7.1-dev 2022-10-20 20:39:09 +02:00
5 changed files with 33 additions and 15 deletions
+7
View File
@@ -15,6 +15,13 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
(file _ReleaseNotes.adoc_ in sources). (file _ReleaseNotes.adoc_ in sources).
[[v3.7.1]]
== Version 3.7.1 (2022-10-21)
Bug fixes::
* trigger: execute trigger command on appropriate buffer for hooks command, command_run, line, modifier and print (issue #1841)
[[v3.7]] [[v3.7]]
== Version 3.7 (2022-10-09) == Version 3.7 (2022-10-09)
+5
View File
@@ -17,6 +17,11 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
(file _ChangeLog.adoc_ in sources). (file _ChangeLog.adoc_ in sources).
[[v3.7.1]]
== Version 3.7.1 (2022-10-21)
Bug fix and maintenance release.
[[v3.7]] [[v3.7]]
== Version 3.7 (2022-10-09) == Version 3.7 (2022-10-09)
+15 -11
View File
@@ -720,7 +720,6 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
const char *modifier, const char *modifier_data, const char *modifier, const char *modifier_data,
const char *string) const char *string)
{ {
struct t_gui_buffer *buffer;
const char *ptr_string; const char *ptr_string;
char *string_modified, *pos, *buffer_pointer; char *string_modified, *pos, *buffer_pointer;
char *str_tags, **tags, *prefix, *string_no_color; char *str_tags, **tags, *prefix, *string_no_color;
@@ -730,7 +729,7 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
TRIGGER_CALLBACK_CB_INIT(NULL); TRIGGER_CALLBACK_CB_INIT(NULL);
buffer = NULL; ctx.buffer = NULL;
tags = NULL; tags = NULL;
num_tags = 0; num_tags = 0;
string_no_color = NULL; string_no_color = NULL;
@@ -842,15 +841,15 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
rc = sscanf (buffer_pointer, "0x%lx", &value); rc = sscanf (buffer_pointer, "0x%lx", &value);
if ((rc != EOF) && (rc != 0)) if ((rc != EOF) && (rc != 0))
{ {
buffer = (struct t_gui_buffer *)value; ctx.buffer = (struct t_gui_buffer *)value;
weechat_hashtable_set ( weechat_hashtable_set (
ctx.extra_vars, ctx.extra_vars,
"tg_plugin", "tg_plugin",
weechat_buffer_get_string (buffer, "plugin")); weechat_buffer_get_string (ctx.buffer, "plugin"));
weechat_hashtable_set ( weechat_hashtable_set (
ctx.extra_vars, ctx.extra_vars,
"tg_buffer", "tg_buffer",
weechat_buffer_get_string (buffer, "full_name")); weechat_buffer_get_string (ctx.buffer, "full_name"));
pos++; pos++;
if (pos[0]) if (pos[0])
{ {
@@ -877,12 +876,12 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
free (buffer_pointer); free (buffer_pointer);
} }
} }
weechat_hashtable_set (ctx.pointers, "buffer", buffer); weechat_hashtable_set (ctx.pointers, "buffer", ctx.buffer);
} }
if (tags) if (tags)
{ {
if (!trigger_callback_set_tags (buffer, (const char **)tags, num_tags, if (!trigger_callback_set_tags (ctx.buffer, (const char **)tags, num_tags,
ctx.extra_vars)) ctx.extra_vars))
{ {
goto end; goto end;
@@ -914,7 +913,6 @@ trigger_callback_line_cb (const void *pointer, void *data,
struct t_hashtable *line) struct t_hashtable *line)
{ {
struct t_hashtable *hashtable; struct t_hashtable *hashtable;
struct t_gui_buffer *buffer;
struct t_weelist_item *ptr_item; struct t_weelist_item *ptr_item;
unsigned long value; unsigned long value;
const char *ptr_key, *ptr_value; const char *ptr_key, *ptr_value;
@@ -943,9 +941,9 @@ trigger_callback_line_cb (const void *pointer, void *data,
rc = sscanf (ptr_value + 2, "%lx", &value); rc = sscanf (ptr_value + 2, "%lx", &value);
if ((rc == EOF) || (rc < 1)) if ((rc == EOF) || (rc < 1))
goto end; goto end;
buffer = (void *)value; ctx.buffer = (void *)value;
weechat_hashtable_set (ctx.pointers, "buffer", buffer); weechat_hashtable_set (ctx.pointers, "buffer", ctx.buffer);
ptr_value = weechat_hashtable_get (line, "tags"); ptr_value = weechat_hashtable_get (line, "tags");
tags = weechat_string_split ((ptr_value) ? ptr_value : "", tags = weechat_string_split ((ptr_value) ? ptr_value : "",
",", ",",
@@ -981,7 +979,7 @@ trigger_callback_line_cb (const void *pointer, void *data,
if (string_no_color) if (string_no_color)
free (string_no_color); free (string_no_color);
if (!trigger_callback_set_tags (buffer, (const char **)tags, num_tags, if (!trigger_callback_set_tags (ctx.buffer, (const char **)tags, num_tags,
ctx.extra_vars)) ctx.extra_vars))
{ {
goto end; goto end;
@@ -1063,6 +1061,8 @@ trigger_callback_print_cb (const void *pointer, void *data,
TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK); TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK);
ctx.buffer = buffer;
/* do nothing if the buffer does not match buffers defined in the trigger */ /* do nothing if the buffer does not match buffers defined in the trigger */
if (trigger->hook_print_buffers if (trigger->hook_print_buffers
&& !weechat_buffer_match_list (buffer, trigger->hook_print_buffers)) && !weechat_buffer_match_list (buffer, trigger->hook_print_buffers))
@@ -1143,6 +1143,8 @@ trigger_callback_command_cb (const void *pointer, void *data,
TRIGGER_CALLBACK_CB_NEW_POINTERS; TRIGGER_CALLBACK_CB_NEW_POINTERS;
TRIGGER_CALLBACK_CB_NEW_EXTRA_VARS; TRIGGER_CALLBACK_CB_NEW_EXTRA_VARS;
ctx.buffer = buffer;
/* add data in hashtables used for conditions/replace/command */ /* add data in hashtables used for conditions/replace/command */
trigger_callback_set_common_vars (trigger, ctx.extra_vars); trigger_callback_set_common_vars (trigger, ctx.extra_vars);
weechat_hashtable_set (ctx.pointers, "buffer", buffer); weechat_hashtable_set (ctx.pointers, "buffer", buffer);
@@ -1194,6 +1196,8 @@ trigger_callback_command_run_cb (const void *pointer, void *data,
TRIGGER_CALLBACK_CB_NEW_POINTERS; TRIGGER_CALLBACK_CB_NEW_POINTERS;
TRIGGER_CALLBACK_CB_NEW_EXTRA_VARS; TRIGGER_CALLBACK_CB_NEW_EXTRA_VARS;
ctx.buffer = buffer;
/* add data in hashtables used for conditions/replace/command */ /* add data in hashtables used for conditions/replace/command */
trigger_callback_set_common_vars (trigger, ctx.extra_vars); trigger_callback_set_common_vars (trigger, ctx.extra_vars);
weechat_hashtable_set (ctx.pointers, "buffer", buffer); weechat_hashtable_set (ctx.pointers, "buffer", buffer);
+3 -3
View File
@@ -32,9 +32,9 @@
# devel-patch the patch version of devel (e.g. 2 for version 1.4.2) # devel-patch the patch version of devel (e.g. 2 for version 1.4.2)
# #
WEECHAT_STABLE=3.7 WEECHAT_STABLE=3.7.1
WEECHAT_DEVEL=3.7 WEECHAT_DEVEL=3.7.1
WEECHAT_DEVEL_FULL=3.7 WEECHAT_DEVEL_FULL=3.7.1
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo >&2 "Syntax: $0 stable|devel|devel-full|devel-major|devel-minor|devel-patch" echo >&2 "Syntax: $0 stable|devel|devel-full|devel-major|devel-minor|devel-patch"
+3 -1
View File
@@ -23,7 +23,7 @@
# #
%define name weechat %define name weechat
%define version 3.7 %define version 3.7.1
%define release 1 %define release 1
Name: %{name} Name: %{name}
@@ -82,6 +82,8 @@ rm -rf $RPM_BUILD_ROOT
%{_prefix}/share/icons/hicolor/512x512/apps/weechat.png %{_prefix}/share/icons/hicolor/512x512/apps/weechat.png
%changelog %changelog
* Fri Oct 21 2022 Sébastien Helleu <flashcode@flashtux.org> 3.7.1-1
- Released version 3.7.1
* Sun Oct 09 2022 Sébastien Helleu <flashcode@flashtux.org> 3.7-1 * Sun Oct 09 2022 Sébastien Helleu <flashcode@flashtux.org> 3.7-1
- Released version 3.7 - Released version 3.7
* Sun Jul 10 2022 Sébastien Helleu <flashcode@flashtux.org> 3.6-1 * Sun Jul 10 2022 Sébastien Helleu <flashcode@flashtux.org> 3.6-1