diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-15 07:57:16 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-15 07:57:16 +0200 |
commit | 2c226261068e8bc8d28744f144f0c769dff73e19 (patch) | |
tree | 4889333a62adec6952124d3221f1435024e6e46c /src/plugins | |
parent | bd4507e99dbbf9105d566e22e0bca8631f8016b6 (diff) | |
download | weechat-2c226261068e8bc8d28744f144f0c769dff73e19.zip |
trigger: use new format for IRC tags in messages
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/trigger/trigger-callback.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index a4ed0e0dd..9e7fdbe2d 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -210,21 +210,32 @@ trigger_callback_set_tags (struct t_gui_buffer *buffer, { /* * example: - * tag: "irc_tag_time_2021-12-30T21:02:50.038Z" + * tag: "irc_tag_time=2021-12-30T21:02:50.038Z" * is added in the hashtable like this: * key : "tg_tag_irc_time" * value: "2021-12-30T21:02:50.038Z" */ - pos = strchr (tags[i] + 8, '_'); - if (pos && pos > tags[i] + 8) + pos = strchr (tags[i] + 8, '='); + if (!pos || (pos > tags[i] + 8)) { - key = weechat_strndup (tags[i] + 8, pos - tags[i] - 8); - if (key) + if (pos) + { + /* tag with value */ + key = weechat_strndup (tags[i] + 8, pos - tags[i] - 8); + if (key) + { + snprintf (str_temp, sizeof (str_temp), + "tg_tag_irc_%s", key); + weechat_hashtable_set (extra_vars, str_temp, pos + 1); + free (key); + } + } + else { + /* tag without value */ snprintf (str_temp, sizeof (str_temp), - "tg_tag_irc_%s", key); - weechat_hashtable_set (extra_vars, str_temp, pos + 1); - free (key); + "tg_tag_irc_%s", tags[i] + 8); + weechat_hashtable_set (extra_vars, str_temp, NULL); } } } |