diff options
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 32 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.h | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-upgrade.c | 36 |
4 files changed, 80 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index b869e59d6..868e714e0 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2944,6 +2944,38 @@ IRC_PROTOCOL_CALLBACK(005) pos2[0] = ' '; } + /* save max user length */ + pos = strstr (argv_eol[3], "USERLEN="); + if (pos) + { + pos += 8; + pos2 = strchr (pos, ' '); + if (pos2) + pos2[0] = '\0'; + error = NULL; + value = strtol (pos, &error, 10); + if (error && !error[0] && (value > 0)) + server->user_max_length = (int)value; + if (pos2) + pos2[0] = ' '; + } + + /* save max host length */ + pos = strstr (argv_eol[3], "HOSTLEN="); + if (pos) + { + pos += 8; + pos2 = strchr (pos, ' '); + if (pos2) + pos2[0] = '\0'; + error = NULL; + value = strtol (pos, &error, 10); + if (error && !error[0] && (value > 0)) + server->host_max_length = (int)value; + if (pos2) + pos2[0] = ' '; + } + /* save casemapping */ pos = strstr (argv_eol[3], "CASEMAPPING="); if (pos) diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 22907d7b7..7b1945bc4 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1398,6 +1398,8 @@ irc_server_alloc (const char *name) new_server->prefix_modes = NULL; new_server->prefix_chars = NULL; new_server->nick_max_length = 0; + new_server->user_max_length = 0; + new_server->host_max_length = 0; new_server->casemapping = IRC_SERVER_CASEMAPPING_RFC1459; new_server->chantypes = NULL; new_server->chanmodes = NULL; @@ -5694,6 +5696,8 @@ irc_server_hdata_server_cb (const void *pointer, void *data, WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, user_max_length, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_irc_server, host_max_length, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, 0, NULL, NULL); @@ -5929,6 +5933,10 @@ irc_server_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_integer (ptr_item, "nick_max_length", server->nick_max_length)) return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "user_max_length", server->user_max_length)) + return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "host_max_length", server->host_max_length)) + return 0; if (!weechat_infolist_new_var_integer (ptr_item, "casemapping", server->casemapping)) return 0; if (!weechat_infolist_new_var_string (ptr_item, "casemapping_string", irc_server_casemapping_string[server->casemapping])) @@ -6312,6 +6320,8 @@ irc_server_print_log () weechat_log_printf (" prefix_modes . . . . : '%s'", ptr_server->prefix_modes); weechat_log_printf (" prefix_chars . . . . : '%s'", ptr_server->prefix_chars); weechat_log_printf (" nick_max_length. . . : %d", ptr_server->nick_max_length); + weechat_log_printf (" user_max_length. . . : %d", ptr_server->user_max_length); + weechat_log_printf (" host_max_length. . . : %d", ptr_server->host_max_length); weechat_log_printf (" casemapping. . . . . : %d (%s)", ptr_server->casemapping, irc_server_casemapping_string[ptr_server->casemapping]); diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index 62c2c3063..2f55a15cd 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -201,6 +201,8 @@ struct t_irc_server char *prefix_modes; /* prefix modes from msg 005 (eg "ohv") */ char *prefix_chars; /* prefix chars from msg 005 (eg "@%+") */ int nick_max_length; /* max length of nick (from msg 005) */ + int user_max_length; /* max length of user (from msg 005) */ + int host_max_length; /* max length of host (from msg 005) */ int casemapping; /* casemapping from msg 005 */ char *chantypes; /* chantypes from msg 005 (eg "&#") */ char *chanmodes; /* chanmodes from msg 005 */ diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index 0d2ca9883..6f4f13612 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -476,6 +476,42 @@ irc_upgrade_read_cb (const void *pointer, void *data, irc_upgrade_current_server->prefix_chars = strdup (str); } 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")) + { + irc_upgrade_current_server->user_max_length = weechat_infolist_integer (infolist, "user_max_length"); + } + else + { + /* WeeChat <= 2.5 */ + str = irc_server_get_isupport_value (irc_upgrade_current_server, + "USERLEN"); + if (str) + { + error = NULL; + number = strtol (str, &error, 10); + if (error && !error[0]) + irc_upgrade_current_server->user_max_length = (int)number; + } + } + /* "host_max_length" is new in WeeChat 2.6 */ + if (weechat_infolist_search_var (infolist, "host_max_length")) + { + irc_upgrade_current_server->host_max_length = weechat_infolist_integer (infolist, "host_max_length"); + } + else + { + /* WeeChat <= 2.5 */ + str = irc_server_get_isupport_value (irc_upgrade_current_server, + "HOSTLEN"); + if (str) + { + error = NULL; + number = strtol (str, &error, 10); + if (error && !error[0]) + irc_upgrade_current_server->host_max_length = (int)number; + } + } irc_upgrade_current_server->casemapping = weechat_infolist_integer (infolist, "casemapping"); str = weechat_infolist_string (infolist, "chantypes"); if (str) |