summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-18 10:10:48 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-18 10:10:48 +0000
commitaca24d17958b73a4299f84d96b2816d6896a1c69 (patch)
tree1dc3db823ee2fc3e38291a737e896ae8ce846490 /src
parente21e289b5d8b53be5de376c97d74bdcc35d8d219 (diff)
downloadirssi-aca24d17958b73a4299f84d96b2816d6896a1c69.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/irc/core/netsplit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c
index 0c394055..cc774ccc 100644
--- a/src/irc/core/netsplit.c
+++ b/src/irc/core/netsplit.c
@@ -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;
}