1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for hiding oper status with user mode +H */
18 /** Handles user mode +H
20 class HideOper : public ModeHandler
23 HideOper(InspIRCd* Instance) : ModeHandler(Instance, 'H', 0, 0, false, MODETYPE_USER, true) { }
25 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool)
29 if (!dest->IsModeSet('H'))
31 dest->SetMode('H',true);
32 return MODEACTION_ALLOW;
37 if (dest->IsModeSet('H'))
39 dest->SetMode('H',false);
40 return MODEACTION_ALLOW;
44 return MODEACTION_DENY;
48 class ModuleHideOper : public Module
53 ModuleHideOper(InspIRCd* Me)
57 hm = new HideOper(ServerInstance);
58 if (!ServerInstance->Modes->AddMode(hm))
59 throw ModuleException("Could not add new modes!");
60 Implementation eventlist[] = { I_OnWhoisLine };
61 ServerInstance->Modules->Attach(eventlist, this, 1);
65 virtual ~ModuleHideOper()
67 ServerInstance->Modes->DelMode(hm);
71 virtual Version GetVersion()
73 return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
76 int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
78 /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the
79 * person doing the WHOIS is not an oper
81 return ((!IS_OPER(user)) && (numeric == 313) && dest->IsModeSet('H'));
86 MODULE_INIT(ModuleHideOper)