1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

fix wrong argument type in printformat

This commit is contained in:
Ailin Nemui 2021-09-28 13:27:56 +02:00
parent 4943cc5e58
commit 2d9c27d617
2 changed files with 11 additions and 5 deletions

View File

@ -307,12 +307,14 @@ static void cmd_server_remove(const char *data)
SERVER_SETUP_REC *rec; SERVER_SETUP_REC *rec;
char *addr, *port, *chatnet; char *addr, *port, *chatnet;
void *free_arg; void *free_arg;
int portnum;
if (!cmd_get_params(data, &free_arg, 3, &addr, &port, &chatnet)) if (!cmd_get_params(data, &free_arg, 3, &addr, &port, &chatnet))
return; return;
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*port == '\0') { if (*port == '\0') {
portnum = DEFAULT_SERVER_ADD_PORT;
if (*chatnet == '\0') if (*chatnet == '\0')
rec = server_setup_find(addr, -1, NULL); rec = server_setup_find(addr, -1, NULL);
else else
@ -320,17 +322,21 @@ static void cmd_server_remove(const char *data)
} }
else else
{ {
portnum = atoi(port);
if (*chatnet == '\0') if (*chatnet == '\0')
rec = server_setup_find(addr, atoi(port), NULL); rec = server_setup_find(addr, portnum, NULL);
else else
rec = server_setup_find(addr, atoi(port), chatnet); rec = server_setup_find(addr, portnum, chatnet);
} }
if (rec == NULL) if (rec == NULL)
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_NOT_FOUND, addr, port); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_NOT_FOUND, addr,
portnum);
else { else {
portnum = rec->port;
server_setup_remove(rec); server_setup_remove(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_REMOVED, addr, port); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_REMOVED, addr,
portnum);
} }
cmd_params_free(free_arg); cmd_params_free(free_arg);

View File

@ -88,7 +88,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ "server_reconnect_removed", "Removed reconnection to server {server $0} port {hilight $1}", 3, { 0, 1, 0 } }, { "server_reconnect_removed", "Removed reconnection to server {server $0} port {hilight $1}", 3, { 0, 1, 0 } },
{ "server_reconnect_not_found", "Reconnection tag {server $0} not found", 1, { 0 } }, { "server_reconnect_not_found", "Reconnection tag {server $0} not found", 1, { 0 } },
{ "setupserver_added", "Server {server $0} saved", 2, { 0, 1 } }, { "setupserver_added", "Server {server $0} saved", 2, { 0, 1 } },
{ "setupserver_removed", "Server {server $0} removed", 2, { 0, 1 } }, { "setupserver_removed", "Server {server $0} {hilight $1} removed", 2, { 0, 1 } },
{ "setupserver_not_found", "Server {server $0} {hilight $1} not found", 2, { 0, 1 } }, { "setupserver_not_found", "Server {server $0} {hilight $1} not found", 2, { 0, 1 } },
{ "your_nick", "Your nickname is {nick $0}", 1, { 0 } }, { "your_nick", "Your nickname is {nick $0}", 1, { 0 } },