1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 09:13:14 +02:00

irc: use util functions to parse integers

This commit is contained in:
Sébastien Helleu
2026-06-20 11:09:20 +02:00
parent 9b418b4dc2
commit b49eac6f2d
11 changed files with 93 additions and 185 deletions
+12 -23
View File
@@ -4061,9 +4061,8 @@ IRC_PROTOCOL_CALLBACK(001)
IRC_PROTOCOL_CALLBACK(005)
{
char *str_info, *error, *isupport2;
int i, arg_last, length_isupport, length, casemapping, utf8mapping;
long value;
char *str_info, *isupport2;
int i, arg_last, length_isupport, length, casemapping, utf8mapping, value;
IRC_PROTOCOL_MIN_PARAMS(2);
@@ -4081,34 +4080,26 @@ IRC_PROTOCOL_CALLBACK(005)
else if (strncmp (ctxt->params[i], "LINELEN=", 8) == 0)
{
/* save max message length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->msg_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->msg_max_length = value;
}
else if (strncmp (ctxt->params[i], "NICKLEN=", 8) == 0)
{
/* save max nick length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->nick_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->nick_max_length = value;
}
else if (strncmp (ctxt->params[i], "USERLEN=", 8) == 0)
{
/* save max user length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->user_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->user_max_length = value;
}
else if (strncmp (ctxt->params[i], "HOSTLEN=", 8) == 0)
{
/* save max host length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->host_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->host_max_length = value;
}
else if (strncmp (ctxt->params[i], "CASEMAPPING=", 12) == 0)
{
@@ -4144,10 +4135,8 @@ IRC_PROTOCOL_CALLBACK(005)
else if (strncmp (ctxt->params[i], "MONITOR=", 8) == 0)
{
/* save monitor (limit) */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->monitor = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->monitor = value;
}
else if (strncmp (ctxt->params[i], "CLIENTTAGDENY=", 14) == 0)
{