diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-27 12:54:58 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-27 12:54:58 +0000 |
commit | 566b2a8b00d1b0d251f72c9351998d5c300ada46 (patch) | |
tree | 387d6168aacccf8884b7cdd6d835ca4d2dcc5d2a /src/modules/m_services.cpp | |
parent | a8185fe0d335e983af2e9e54c8ca0024aa862a0d (diff) |
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
Diffstat (limited to 'src/modules/m_services.cpp')
-rw-r--r-- | src/modules/m_services.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
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 <stdio.h> + +#include "users.h" +#include "channels.h" +#include "modules.h" +#include <string> + + +/* $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; +} + |