diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-14 21:25:20 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-14 21:25:20 +0200 |
commit | bd4507e99dbbf9105d566e22e0bca8631f8016b6 (patch) | |
tree | 36c4ef7749b2791563d28957fa3eecb5cf0e5dc4 /src/plugins/irc/irc-protocol.c | |
parent | 46b9428f9ecb611ed1e07cf5c098a4c7cca54b17 (diff) | |
download | weechat-bd4507e99dbbf9105d566e22e0bca8631f8016b6.zip |
irc: fix format of IRC tags displayed in messages (closes #1929)
Changes:
- use "=" to separate key from value, add it only if value is set (any string,
including empty string)
- do not convert "_" to "-" in key
Diffstat (limited to 'src/plugins/irc/irc-protocol.c')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 239e3dbca..b0e8427fb 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -124,11 +124,15 @@ irc_protocol_tags_add_cb (void *data, const void *key, const void *value) { - char **str_tags, *str_temp, *str_temp2; + const char *ptr_key, *ptr_value; + char **str_tags, *str_temp; /* make C compiler happy */ (void) hashtable; + ptr_key = (const char *)key; + ptr_value = (const char *)value; + str_tags = (char **)data; if (*str_tags[0]) @@ -137,18 +141,17 @@ irc_protocol_tags_add_cb (void *data, weechat_string_dyn_concat (str_tags, "irc_tag_", -1); /* key */ - str_temp = weechat_string_replace ((const char *)key, ",", ";"); - str_temp2 = weechat_string_replace (str_temp, "_", "-"); - if (str_temp2) - weechat_string_dyn_concat (str_tags, str_temp2, -1); + str_temp = weechat_string_replace (ptr_key, ",", ";"); + weechat_string_dyn_concat (str_tags, str_temp, -1); if (str_temp) free (str_temp); - if (str_temp2) - free (str_temp2); - weechat_string_dyn_concat (str_tags, "_", -1); + + /* separator between key and value */ + if (ptr_value) + weechat_string_dyn_concat (str_tags, "=", -1); /* value */ - str_temp = weechat_string_replace ((const char *)value, ",", ";"); + str_temp = weechat_string_replace (ptr_value, ",", ";"); weechat_string_dyn_concat (str_tags, str_temp, -1); if (str_temp) free (str_temp); |