From 566b2a8b00d1b0d251f72c9351998d5c300ada46 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 27 Apr 2004 12:54:58 +0000 Subject: Added m_services.so, must be loaded to give services-needed modes such as +r git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@742 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_services.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/modules/m_services.cpp diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp new file mode 100644 index 000000000..e44b08bc1 --- /dev/null +++ b/src/modules/m_services.cpp @@ -0,0 +1,99 @@ +#include + +#include "users.h" +#include "channels.h" +#include "modules.h" +#include + + +/* $ModDesc: Povides support for services +r user/chan modes and more */ + +Server *Srv; + + +class ModuleServices : public Module +{ + public: + ModuleServices() + { + Srv = new Server; + + Srv->AddExtendedMode('r',MT_CHANNEL,false,0,0); + Srv->AddExtendedMode('r',MT_CLIENT,false,0,0); + } + + virtual bool OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) + { + + if (modechar != 'r') { + return 0; + } + + if (type == MT_CHANNEL) + { + // only a u-lined server may add or remove the +r mode. + if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server))) + { + return 1; + } + else + { + Srv->SendServ(user->fd,"500 "+std::string(user->nick)+" :Only a U-Lined server may modify the +r channel mode"); + } + } + else + { + if (!strcmp(user->server,"")) + { + return 1; + } + else + { + Srv->SendServ(user->fd,"500 "+std::string(user->nick)+" :Only a server may modify the +r user mode"); + } + } + + return 0; + } + + virtual ~ModuleServices() + { + delete Srv; + } + + virtual Version GetVersion() + { + return Version(1,0,0,0); + } + + virtual void OnUserConnect(userrec* user) + { + } + +}; + + +class ModuleServicesFactory : public ModuleFactory +{ + public: + ModuleServicesFactory() + { + } + + ~ModuleServicesFactory() + { + } + + virtual Module * CreateModule() + { + return new ModuleServices; + } + +}; + + +extern "C" void * init_module( void ) +{ + return new ModuleServicesFactory; +} + -- cgit v1.2.3