summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-upgrade.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc/irc-upgrade.c')
-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"))