1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
22 /* $ModDesc: Provides support for hiding oper status with user mode +H */
24 /** Handles user mode +B
26 class HideOper : public ModeHandler
29 HideOper(InspIRCd* Instance) : ModeHandler(Instance, 'H', 0, 0, false, MODETYPE_USER, true) { }
31 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
33 /* Only opers can change other users modes */
34 if ((source != dest) && (!*source->oper))
35 return MODEACTION_DENY;
39 if (!dest->IsModeSet('H'))
41 dest->SetMode('H',true);
42 return MODEACTION_ALLOW;
47 if (dest->IsModeSet('H'))
49 dest->SetMode('H',false);
50 return MODEACTION_ALLOW;
54 return MODEACTION_DENY;
58 class ModuleHideOper : public Module
63 ModuleHideOper(InspIRCd* Me)
67 hm = new HideOper(ServerInstance);
68 ServerInstance->AddMode(hm, 'H');
71 void Implements(char* List)
73 List[I_OnWhoisLine] = 1;
76 virtual ~ModuleHideOper()
78 ServerInstance->Modes->DelMode(hm);
82 virtual Version GetVersion()
84 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
87 int OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text)
89 /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the
90 * person doing the WHOIS is not an oper
92 return ((!*user->oper) && (numeric == 313) && dest->IsModeSet('H'));
96 class ModuleHideOperFactory : public ModuleFactory
99 ModuleHideOperFactory()
103 ~ModuleHideOperFactory()
107 virtual Module * CreateModule(InspIRCd* Me)
109 return new ModuleHideOper(Me);
115 extern "C" void * init_module( void )
117 return new ModuleHideOperFactory;