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 * ---------------------------------------------------
19 /* $ModDesc: Provides support for hiding oper status with user mode +H */
21 /** Handles user mode +B
23 class HideOper : public ModeHandler
26 HideOper(InspIRCd* Instance) : ModeHandler(Instance, 'H', 0, 0, false, MODETYPE_USER, true) { }
28 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
31 return MODEACTION_DENY;
35 if (!dest->IsModeSet('H'))
37 dest->SetMode('H',true);
38 return MODEACTION_ALLOW;
43 if (dest->IsModeSet('H'))
45 dest->SetMode('H',false);
46 return MODEACTION_ALLOW;
50 return MODEACTION_DENY;
54 class ModuleHideOper : public Module
59 ModuleHideOper(InspIRCd* Me)
63 hm = new HideOper(ServerInstance);
64 if (!ServerInstance->AddMode(hm, 'H'))
65 throw ModuleException("Could not add new modes!");
68 void Implements(char* List)
70 List[I_OnWhoisLine] = 1;
73 virtual ~ModuleHideOper()
75 ServerInstance->Modes->DelMode(hm);
79 virtual Version GetVersion()
81 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
84 int OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text)
86 /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the
87 * person doing the WHOIS is not an oper
89 return ((!IS_OPER(user)) && (numeric == 313) && dest->IsModeSet('H'));
94 MODULE_INIT(ModuleHideOper)