4 #include "helperfuncs.h"
6 /* $ModDesc: Provides support for unreal-style channel mode +z */
8 class ModuleSSLModes : public Module
13 ModuleSSLModes(Server* Me)
17 Srv->AddExtendedMode('z', MT_CHANNEL, false, 0, 0);
20 void Implements(char* List)
22 List[I_OnExtendedMode] = List[I_On005Numeric] = List[I_OnUserPreJoin] = 1;
25 virtual void On005Numeric(std::string &output)
27 InsertMode(output, "z", 4);
30 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
32 if(chan && chan->IsCustomModeSet('z'))
34 if(user->GetExt("ssl"))
42 WriteServ(user->fd, "489 %s %s :Cannot join channel (+z)", user->nick, cname);
50 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
52 // check if this is our mode character...
53 if ((modechar == 'z') && (type == MT_CHANNEL))
55 chanrec* chan = (chanrec*)target;
57 chanuserlist userlist = Srv->GetUsers(chan);
59 for(unsigned int i = 0; i < userlist.size(); i++)
61 if(!userlist[i]->GetExt("ssl"))
63 WriteServ(user->fd, "490 %s %s :all members of the channel must be connected via SSL", user->nick, chan->name);
76 virtual ~ModuleSSLModes()
80 virtual Version GetVersion()
82 return Version(1, 0, 0, 0, VF_STATIC | VF_VENDOR);
87 class ModuleSSLModesFactory : public ModuleFactory
90 ModuleSSLModesFactory()
94 ~ModuleSSLModesFactory()
98 virtual Module* CreateModule(Server* Me)
100 return new ModuleSSLModes(Me);
106 extern "C" void * init_module( void )
108 return new ModuleSSLModesFactory;