1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 +B
20 class HideOper : public ModeHandler
23 HideOper(InspIRCd* Instance) : ModeHandler(Instance, 'H', 0, 0, false, MODETYPE_USER, true) { }
25 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
28 return MODEACTION_DENY;
32 if (!dest->IsModeSet('H'))
34 dest->SetMode('H',true);
35 return MODEACTION_ALLOW;
40 if (dest->IsModeSet('H'))
42 dest->SetMode('H',false);
43 return MODEACTION_ALLOW;
47 return MODEACTION_DENY;
51 class ModuleHideOper : public Module
56 ModuleHideOper(InspIRCd* Me)
60 hm = new HideOper(ServerInstance);
61 if (!ServerInstance->AddMode(hm, 'H'))
62 throw ModuleException("Could not add new modes!");
65 void Implements(char* List)
67 List[I_OnWhoisLine] = 1;
70 virtual ~ModuleHideOper()
72 ServerInstance->Modes->DelMode(hm);
76 virtual Version GetVersion()
78 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
81 int OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text)
83 /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the
84 * person doing the WHOIS is not an oper
86 return ((!IS_OPER(user)) && (numeric == 313) && dest->IsModeSet('H'));
91 MODULE_INIT(ModuleHideOper)