From 771b2af59db960fbc37bf0ebfc4b510b3be395b1 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 19 Sep 2009 14:24:15 +0000 Subject: [PATCH] Fixed two places where the client compared the source of a numeric against get_server_name(from_server) instead of get_server_itsname(from_server) - this meant that if the client had a different idea of the local server name from the server (say, if you used a round-robin to connect), then the client would incorrectly assume the numeric came from a remote server. The symptoms were: * If your local server sent you a "you're not op" type message, BitchX would report the channel had desynched. * If your local server send you a "channel doesn't exist" numeric (eg. if you typed /mode #nosuchchannel to see if it existed), BitchX would not show it. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@71 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 5 +++++ source/numbers.c | 25 +++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Changelog b/Changelog index 29a24da..3324ab0 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,10 @@ [Changes 1.2c01 ] +* Fixed two cases where the client was incorrectly deciding that a numeric + originated from a remote server rather than the local server - this caused + BitchX to falsely report channel desynch and incorrectly hide some + numerics. (caf) + * Fixed $servernum() scripting function, it was returning the wrong server reference in most cases. (caf) diff --git a/source/numbers.c b/source/numbers.c index 0464b83..bf5712c 100644 --- a/source/numbers.c +++ b/source/numbers.c @@ -222,18 +222,18 @@ char *rest = PasteArgs(ArgList, 0); static int check_server_sync(char *from, char **ArgList) { -static char *desync = NULL; + static char *desync = NULL; - - if (!desync || (desync && !wild_match(desync, from))) + /* If we get a "permission denied" type numeric from a _remote_ server, + * then it means the network is desyched. + */ + if (my_stricmp(from, get_server_itsname(from_server)) && + (!desync || my_stricmp(desync, from))) { - if (!wild_match(from, get_server_name(from_server))) - { - malloc_strcpy(&desync, from); - if (do_hook(DESYNC_MESSAGE_LIST, "%s %s", from, ArgList[0])) - put_it("%s", convert_output_format(fget_string_var(FORMAT_DESYNC_FSET), "%s %s %s", update_clock(GET_TIME), ArgList[0], from)); - return 1; - } + malloc_strcpy(&desync, from); + if (do_hook(DESYNC_MESSAGE_LIST, "%s %s", from, ArgList[0])) + put_it("%s", convert_output_format(fget_string_var(FORMAT_DESYNC_FSET), "%s %s %s", update_clock(GET_TIME), ArgList[0], from)); + return 1; } return 0; } @@ -307,14 +307,11 @@ static void channel_topic(char *from, char **ArgList, int what) static void not_valid_channel(char *from, char **ArgList) { char *channel; - char *s; - if (!(channel = ArgList[0]) || !ArgList[1]) return; PasteArgs(ArgList, 1); - s = get_server_name(from_server); - if (!my_strnicmp(s, from, strlen(s))) + if (!my_stricmp(from, get_server_itsname(from_server))) { if (strcmp(channel, "*")) remove_channel(channel, from_server);