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 +I */
21 /** Handles user mode +I
23 class HideChans : public ModeHandler
26 HideChans(InspIRCd* Instance) : ModeHandler(Instance, 'I', 0, 0, false, MODETYPE_USER, true) { }
28 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
30 /* Only opers can change other users modes */
31 if ((source != dest) && (!*source->oper))
32 return MODEACTION_DENY;
36 if (!dest->IsModeSet('I'))
38 dest->SetMode('I',true);
39 return MODEACTION_ALLOW;
44 if (dest->IsModeSet('I'))
46 dest->SetMode('I',false);
47 return MODEACTION_ALLOW;
51 return MODEACTION_DENY;
55 class ModuleHideChans : public Module
60 ModuleHideChans(InspIRCd* Me)
64 hm = new HideChans(ServerInstance);
65 ServerInstance->AddMode(hm, 'I');
68 void Implements(char* List)
70 List[I_OnWhoisLine] = 1;
73 virtual ~ModuleHideChans()
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 channels if they have +I set and the
87 * person doing the WHOIS is not an oper
89 return ((!*user->oper) && (numeric == 319) && dest->IsModeSet('I'));
93 class ModuleHideChansFactory : public ModuleFactory
96 ModuleHideChansFactory()
100 ~ModuleHideChansFactory()
104 virtual Module * CreateModule(InspIRCd* Me)
106 return new ModuleHideChans(Me);
112 extern "C" void * init_module( void )
114 return new ModuleHideChansFactory;