X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fumode_i.cpp;h=5a93273757e0a7e7f8323f5e31e9c1404149ab92;hb=ce533b67e6c58c02f25b2f26214ab9cd2c7c99b6;hp=08af105cabbc3a05d0565dfdf2eab8f15fa3a808;hpb=d40e1e5b0b8c4b94359637921387cd80e9de991b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp index 08af105ca..5a9327375 100644 --- a/src/modes/umode_i.cpp +++ b/src/modes/umode_i.cpp @@ -1,10 +1,23 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + #include "inspircd.h" #include "mode.h" #include "channels.h" #include "users.h" #include "modes/umode_i.h" -ModeUserInvisible::ModeUserInvisible() : ModeHandler('i', 0, 0, false, MODETYPE_USER, false) +ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : ModeHandler(Instance, 'i', 0, 0, false, MODETYPE_USER, false) { } @@ -12,14 +25,21 @@ ModeAction ModeUserInvisible::OnModeChange(userrec* source, userrec* dest, chanr { /* Only opers can change other users modes */ if ((source != dest) && (!*source->oper)) - return MODEACTION_ALLOW; + return MODEACTION_DENY; /* Set the bitfields */ - adding ? dest->modebits |= UM_INVISIBLE : dest->modebits &= ~UM_INVISIBLE; - - /* Use the bitfields to build the user's mode string */ - ModeParser::BuildModeString(dest); + if (dest->modes[UM_INVISIBLE] != adding) + { + dest->modes[UM_INVISIBLE] = adding; + this->count += (adding ? 1: -1); + return MODEACTION_ALLOW; + } /* Allow the change */ - return MODEACTION_ALLOW; + return MODEACTION_DENY; +} + +unsigned int ModeUserInvisible::GetCount() +{ + return count; }