irc: add variables "user_max_length" and "host_max_length" in server structure (issue #1387)
parent
4fa62a83f1
commit
0bf5a5ae9c
|
@ -25,6 +25,7 @@ New features::
|
|||
* api: add argument "strip_items" in function string_split
|
||||
* buflist: add infolist "buflist" with list of buffer pointers (issue #1375)
|
||||
* exec: evaluate option exec.command.shell, change default value to "${env:SHELL}" (issue #1356)
|
||||
* irc: add variables "user_max_length" and "host_max_length" in server structure (issue #1387)
|
||||
|
||||
Bug fixes::
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue