mirror of
https://github.com/irssi/irssi.git
synced 2024-09-29 04:45:57 -04: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:
parent
e21e289b5d
commit
aca24d1795
@ -185,6 +185,9 @@ NICK_REC *netsplit_find_channel(IRC_SERVER_REC *server, const char *nick, const
|
|||||||
return NULL;
|
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)
|
int quitmsg_is_split(const char *msg)
|
||||||
{
|
{
|
||||||
char *host1, *host2, *p;
|
char *host1, *host2, *p;
|
||||||
@ -195,7 +198,7 @@ int quitmsg_is_split(const char *msg)
|
|||||||
|
|
||||||
/* must have only two words */
|
/* must have only two words */
|
||||||
p = strchr(msg, ' ');
|
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.. */
|
/* check that it looks ok.. */
|
||||||
if (!match_wildcards("*.* *.*", msg) ||
|
if (!match_wildcards("*.* *.*", msg) ||
|
||||||
@ -203,8 +206,8 @@ int quitmsg_is_split(const char *msg)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* get the two hosts */
|
/* get the two hosts */
|
||||||
if (!cmd_get_params(msg, &free_arg, 2 | PARAM_FLAG_NOQUOTES, &host1, &host2))
|
host1 = g_strndup(msg, (int) (p-msg));
|
||||||
return FALSE;
|
host2 = p;
|
||||||
|
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
if (g_strcasecmp(host1, host2) != 0) { /* hosts can't be same.. */
|
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;
|
return ok;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user