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 +I */
24 /** Handles user mode +I
26 class HideChans : public ModeHandler
29 HideChans(InspIRCd* Instance) : ModeHandler(Instance, 'I', 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('I'))
41 dest->SetMode('I',true);
42 return MODEACTION_ALLOW;
47 if (dest->IsModeSet('I'))
49 dest->SetMode('I',false);
50 return MODEACTION_ALLOW;
54 return MODEACTION_DENY;
58 class ModuleHideChans : public Module
63 ModuleHideChans(InspIRCd* Me)
67 hm = new HideChans(ServerInstance);
68 ServerInstance->AddMode(hm, 'I');
71 void Implements(char* List)
73 List[I_OnWhoisLine] = 1;
76 virtual ~ModuleHideChans()
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 channels if they have +I set and the
90 * person doing the WHOIS is not an oper
92 return ((!*user->oper) && (numeric == 319) && dest->IsModeSet('I'));
96 class ModuleHideChansFactory : public ModuleFactory
99 ModuleHideChansFactory()
103 ~ModuleHideChansFactory()
107 virtual Module * CreateModule(InspIRCd* Me)
109 return new ModuleHideChans(Me);
115 extern "C" void * init_module( void )
117 return new ModuleHideChansFactory;