summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2008-12-17 23:57:18 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2008-12-17 23:57:18 +0000
commit6db8824d0bc94fbfc89cd98ec0ff3e5a89ae01f5 (patch)
tree5f89469f6688dc36296a691d83a0ad130116e313
parenta5c031382e4d9dafdf263ba9650af1f513d46980 (diff)
Fix umode +d bug slightly more properly.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1844 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--src/protocol/unreal32.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index acfcc8c73..5d574c3ba 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -540,11 +540,8 @@ class UnrealIRCdProto : public IRCDProto
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) {
- /* 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<int>(*modes)];
- else user->mode &= ~umodes[static_cast<int>(*modes)];
- switch (*modes++) {
+ switch (*modes++)
+ {
case '+':
add = 1;
break;
@@ -552,18 +549,13 @@ class UnrealIRCdProto : public IRCDProto
add = 0;
break;
case 'd':
- if (ac <= 0) break;
- --ac;
- ++av;
- if (av)
- user->svid = strtoul(*av, NULL, 0);
-
- /* Unreal annoyingly uses +d for deaf as well as svid, so if a svid was set, unset +d (this actually means that
- * in practice, we could lose someone's svid if they set +d after identifying, so this fix is crap)
- * XXX: fix it better
- */
- if (user->svid)
- user->mode &= ~UMODE_d;
+ if (ac <= 0)
+ break;
+ if (isdigit(*av[1]))
+ {
+ user->svid = strtoul(av[1], NULL, 0);
+ continue; // +d was setting a service stamp, ignore the usermode +-d.
+ }
break;
case 'o':
if (add) {
@@ -581,6 +573,14 @@ class UnrealIRCdProto : public IRCDProto
break;
case 'x':
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<int>(*modes)];
+ else
+ user->mode &= ~umodes[static_cast<int>(*modes)];
}
}
}