]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/umode_i.cpp
5a93273757e0a7e7f8323f5e31e9c1404149ab92
[user/henk/code/inspircd.git] / src / modes / umode_i.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "mode.h"
16 #include "channels.h"
17 #include "users.h"
18 #include "modes/umode_i.h"
19
20 ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : ModeHandler(Instance, 'i', 0, 0, false, MODETYPE_USER, false)
21 {
22 }
23
24 ModeAction ModeUserInvisible::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
25 {
26         /* Only opers can change other users modes */
27         if ((source != dest) && (!*source->oper))
28                 return MODEACTION_DENY;
29
30         /* Set the bitfields */
31         if (dest->modes[UM_INVISIBLE] != adding)
32         {
33                 dest->modes[UM_INVISIBLE] = adding;
34                 this->count += (adding ? 1: -1);
35                 return MODEACTION_ALLOW;
36         }
37
38         /* Allow the change */
39         return MODEACTION_DENY;
40 }
41
42 unsigned int ModeUserInvisible::GetCount()
43 {
44         return count;
45 }