From fe6791615901d26fda5992f851fb2dc41e6c7424 Mon Sep 17 00:00:00 2001 From: jantje_85 Date: Tue, 23 Dec 2008 23:27:37 +0000 Subject: [PATCH] Fixed problem with unreal protocol module not storing usermode changes. Not the nicest patch, but should do the job. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1862 5417fbe8-f217-4b02-8779-1006273d7864 --- src/protocol/unreal32.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 5d574c3ba..f5ec00397 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -534,12 +534,22 @@ class UnrealIRCdProto : public IRCDProto { void ProcessUsermodes(User *user, int ac, const char **av) { - int add = 1; /* 1 if adding modes, 0 if deleting */ + int backup, add = 1; /* 1 if adding modes, 0 if deleting */ const char *modes = av[0]; --ac; if (!user || !modes) return; /* Prevent NULLs from doing bad things */ if (debug) alog("debug: Changing mode for %s to %s", user->nick, modes); + while (*modes) { + uint32 backup = user->mode; + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD */ + if (add) + user->mode |= umodes[static_cast(*modes)]; + else + user->mode &= ~umodes[static_cast(*modes)]; + switch (*modes++) { case '+': @@ -554,6 +564,7 @@ class UnrealIRCdProto : public IRCDProto if (isdigit(*av[1])) { user->svid = strtoul(av[1], NULL, 0); + user->mode = backup; /* Ugly fix, but should do the job ~ Viper */ continue; // +d was setting a service stamp, ignore the usermode +-d. } break; @@ -575,12 +586,7 @@ class UnrealIRCdProto : public IRCDProto update_host(user); break; default: - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD */ - if (add) - user->mode |= umodes[static_cast(*modes)]; - else - user->mode &= ~umodes[static_cast(*modes)]; + break; } } }