1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
18 #include "modes/umode_o.h"
20 ModeUserOperator::ModeUserOperator() : ModeHandler(NULL, "oper", 'o', PARAM_NONE, MODETYPE_USER)
25 ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding)
27 /* Only opers can execute this class at all */
28 if (!ServerInstance->ULine(source->nick.c_str()) && !ServerInstance->ULine(source->server) && !IS_OPER(source))
29 return MODEACTION_DENY;
31 /* Not even opers can GIVE the +o mode, only take it away */
33 return MODEACTION_DENY;
36 * Note that oper status is only given in cmd_oper.cpp
37 * NOT here. It is impossible to directly set +o without
38 * verifying as an oper and getting an opertype assigned
41 char snomask = IS_LOCAL(dest) ? 'o' : 'O';
42 ServerInstance->SNO->WriteToSnoMask(snomask, "User %s de-opered (by %s)", dest->nick.c_str(),
43 source->nick.empty() ? source->server.c_str() : source->nick.c_str());
46 return MODEACTION_ALLOW;