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 channels with user mode +I */
18 /** Handles user mode +I
20 class HideChans : public ModeHandler
23 HideChans(InspIRCd* Instance) : ModeHandler(Instance, 'I', 0, 0, false, MODETYPE_USER, false) { }
25 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
27 /* Only opers can change other users modes */
29 return MODEACTION_DENY;
33 if (!dest->IsModeSet('I'))
35 dest->SetMode('I',true);
36 return MODEACTION_ALLOW;
41 if (dest->IsModeSet('I'))
43 dest->SetMode('I',false);
44 return MODEACTION_ALLOW;
48 return MODEACTION_DENY;
52 class ModuleHideChans : public Module
57 ModuleHideChans(InspIRCd* Me)
61 hm = new HideChans(ServerInstance);
62 if (!ServerInstance->AddMode(hm, 'I'))
63 throw ModuleException("Could not add new modes!");
66 void Implements(char* List)
68 List[I_OnWhoisLine] = 1;
71 virtual ~ModuleHideChans()
73 ServerInstance->Modes->DelMode(hm);
77 virtual Version GetVersion()
79 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
82 int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text)
84 /* Dont display channels if they have +I set and the
85 * person doing the WHOIS is not an oper
87 return ((user != dest) && (!IS_OPER(user)) && (numeric == 319) && dest->IsModeSet('I'));
92 MODULE_INIT(ModuleHideChans)