summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-17 21:03:44 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-17 21:03:44 +0200
commitfbf68dcc14cb7a61d25fe0a744105c0d2b77f8bf (patch)
tree8845c952fd394bd4aebf7fb9e8e79a02660ed901 /src/plugins/irc
parent359ec5d2dbe23d4b79cfb44e37ee2b965c5e3756 (diff)
downloadweechat-fbf68dcc14cb7a61d25fe0a744105c0d2b77f8bf.zip
irc: get value of "msg_max_length" from isupport token "LINELEN" on upgrade from WeeChat < 4.0.0 (issue #1927)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-upgrade.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index b717418ca..0ca19852d 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -501,7 +501,24 @@ irc_upgrade_read_cb (const void *pointer, void *data,
free (irc_upgrade_current_server->prefix_chars);
irc_upgrade_current_server->prefix_chars = strdup (str);
}
- irc_upgrade_current_server->msg_max_length = weechat_infolist_integer (infolist, "msg_max_length");
+ /* "msg_max_length" is new in WeeChat 4.0.0 */
+ if (weechat_infolist_search_var (infolist, "msg_max_length"))
+ {
+ irc_upgrade_current_server->msg_max_length = weechat_infolist_integer (infolist, "msg_max_length");
+ }
+ else
+ {
+ /* WeeChat <= 3.8 */
+ str = irc_server_get_isupport_value (irc_upgrade_current_server,
+ "LINELEN");
+ if (str)
+ {
+ error = NULL;
+ number = strtol (str, &error, 10);
+ if (error && !error[0])
+ irc_upgrade_current_server->msg_max_length = (int)number;
+ }
+ }
irc_upgrade_current_server->nick_max_length = weechat_infolist_integer (infolist, "nick_max_length");
/* "user_max_length" is new in WeeChat 2.6 */
if (weechat_infolist_search_var (infolist, "user_max_length"))