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

Don't use cmd_get_params() to split the two hosts, it's a lot easier to

use strchr()..


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@368 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-18 10:10:48 +00:00 committed by cras
parent e21e289b5d
commit aca24d1795

View File

@ -185,6 +185,9 @@ NICK_REC *netsplit_find_channel(IRC_SERVER_REC *server, const char *nick, const
return NULL;
}
/* check if quit message is a netsplit message - there's some paranoia
checks which are probably a bit useless since nowadays IRC servers
add space after quit message if it looks like a netsplit message. */
int quitmsg_is_split(const char *msg)
{
char *host1, *host2, *p;
@ -195,7 +198,7 @@ int quitmsg_is_split(const char *msg)
/* must have only two words */
p = strchr(msg, ' ');
if (p == NULL || strchr(p+1, ' ') != NULL) return FALSE;
if (p == NULL || p == msg || strchr(p+1, ' ') != NULL) return FALSE;
/* check that it looks ok.. */
if (!match_wildcards("*.* *.*", msg) ||
@ -203,8 +206,8 @@ int quitmsg_is_split(const char *msg)
return FALSE;
/* get the two hosts */
if (!cmd_get_params(msg, &free_arg, 2 | PARAM_FLAG_NOQUOTES, &host1, &host2))
return FALSE;
host1 = g_strndup(msg, (int) (p-msg));
host2 = p;
ok = FALSE;
if (g_strcasecmp(host1, host2) != 0) { /* hosts can't be same.. */
@ -218,7 +221,7 @@ int quitmsg_is_split(const char *msg)
}
}
}
cmd_params_free(free_arg);
g_free(host1);
return ok;
}