From 2c226261068e8bc8d28744f144f0c769dff73e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 15 May 2023 07:57:16 +0200 Subject: trigger: use new format for IRC tags in messages --- src/plugins/trigger/trigger-callback.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/plugins') 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); } } } -- cgit v1.2.3