summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-01-05 21:17:19 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-01-05 21:36:58 +0100
commit57a206287a805900628a2b8f863f3f1488c6ab9a (patch)
tree335afa201bd8c7f7ed8791208f7ea63c808b2848 /src/plugins
parenteb8ca14d8373557e812f107b6c458656658345b1 (diff)
downloadweechat-57a206287a805900628a2b8f863f3f1488c6ab9a.zip
irc: fix display of self messages in case of message split failure
When the message sends inconsistent max lengths in message 005, the split of self message fails and causes a display issue: the channel name is displayed with the message: nick | #channel :this is a test instead of: nick | this is a test
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-message.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c
index 261a9359a..0b27d66e9 100644
--- a/src/plugins/irc/irc-message.c
+++ b/src/plugins/irc/irc-message.c
@@ -1055,9 +1055,6 @@ irc_message_split_string (struct t_irc_message_split_context *context,
if (suffix)
max_length -= strlen (suffix);
- if (max_length < 2)
- return 0;
-
/* debug message */
if (weechat_irc_plugin->debug >= 2)
{
@@ -1069,17 +1066,23 @@ irc_message_split_string (struct t_irc_message_split_context *context,
max_length);
}
- if (!arguments || !arguments[0])
+ if ((max_length < 2) || !arguments || !arguments[0])
{
- snprintf (message, sizeof (message), "%s%s%s %s%s%s%s",
+ /*
+ * max length is not known (server probably sent values that are not
+ * consistent), or no arguments => in this case, we just return message
+ * as-is (no split)
+ */
+ snprintf (message, sizeof (message), "%s%s%s %s%s%s%s%s",
(host) ? host : "",
(host) ? " " : "",
command,
(target) ? target : "",
(target && target[0]) ? " " : "",
(prefix) ? prefix : "",
+ (arguments) ? arguments : "",
(suffix) ? suffix : "");
- irc_message_split_add (context, tags, message, "");
+ irc_message_split_add (context, tags, message, (arguments) ? arguments : "");
(context->number)++;
return 1;
}