summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_blockcolor.cpp13
-rw-r--r--src/modules/m_knock.cpp4
-rw-r--r--src/modules/m_noctcp.cpp13
-rw-r--r--src/modules/m_nokicks.cpp15
-rw-r--r--src/modules/m_nonicks.cpp92
-rw-r--r--src/modules/m_nonotice.cpp13
6 files changed, 147 insertions, 3 deletions
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 4d1a3500d..58ee4da8b 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -55,6 +55,19 @@ class ModuleBlockColor : public Module
return 0;
}
+ virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
+ {
+ // check if this is our mode character...
+ if ((modechar == 'c') && (type == MT_CHANNEL))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
virtual ~ModuleBlockColor()
{
delete Srv;
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 12ad69b13..2569214df 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -4,7 +4,7 @@
#include "channels.h"
#include "modules.h"
-/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
+/* $ModDesc: Provides support for /KNOCK and mode +K */
Server *Srv;
@@ -26,7 +26,7 @@ void handle_knock(char **parameters, int pcnt, userrec *user)
}
if (c->inviteonly)
{
- WriteChannelWithServ(Srv->GetServerName().c_str(),c,user,"NOTICE %s :User %s is KNOCKing on %s (%s)",c->name,user->nick,c->name,line.c_str());
+ WriteChannelWithServ((char*)Srv->GetServerName().c_str(),c,user,"NOTICE %s :User %s is KNOCKing on %s (%s)",c->name,user->nick,c->name,line.c_str());
WriteServ(user->fd,"NOTICE %s :KNOCKing on %s",user->nick,c->name);
return;
}
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 1b1f56397..a5d472d45 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -58,6 +58,19 @@ class ModuleNoCTCP : public Module
return 0;
}
+ virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
+ {
+ // check if this is our mode character...
+ if ((modechar == 'C') && (type == MT_CHANNEL))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
virtual ~ModuleNoCTCP()
{
delete Srv;
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index b90932e6c..582b3209a 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -17,7 +17,7 @@ class ModuleNoKicks : public Module
Srv = new Server;
Srv->AddExtendedMode('Q',MT_CHANNEL,false,0,0);
}
-
+
virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
{
if (access_type == AC_KICK)
@@ -40,6 +40,19 @@ class ModuleNoKicks : public Module
return ACR_DEFAULT;
}
+ virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
+ {
+ // check if this is our mode character...
+ if ((modechar == 'Q') && (type == MT_CHANNEL))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
virtual ~ModuleNoKicks()
{
delete Srv;
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
new file mode 100644
index 000000000..d46525152
--- /dev/null
+++ b/src/modules/m_nonicks.cpp
@@ -0,0 +1,92 @@
+#include <stdio.h>
+#include <string>
+#include "users.h"
+#include "channels.h"
+#include "modules.h"
+
+/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
+
+Server *Srv;
+
+class ModuleNoNickChange : public Module
+{
+ public:
+ ModuleNoNickChange()
+ {
+ Srv = new Server;
+
+ Srv->AddExtendedMode('N',MT_CHANNEL,false,0,0);
+ }
+
+ virtual ~ModuleNoNickChange()
+ {
+ delete Srv;
+ }
+
+ virtual Version GetVersion()
+ {
+ return Version(1,0,0,1);
+ }
+
+ virtual int OnUserPreNick(userrec* user, std::string newnick)
+ {
+ if (!strcasecmp(user->server,Srv->GetServerName().c_str()))
+ {
+ for (int i =0; i != MAXCHANS; i++)
+ {
+ if (user->chans[i].channel != NULL)
+ {
+ chanrec* curr = user->chans[i].channel;
+ if (curr->IsCustomModeSet('N'))
+ {
+ // don't allow the nickchange, theyre on at least one channel with +N set
+ WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name);
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+ }
+
+ virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
+ {
+ // check if this is our mode character...
+ if ((modechar == 'N') && (type == MT_CHANNEL))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+};
+
+// stuff down here is the module-factory stuff. For basic modules you can ignore this.
+
+class ModuleNoNickChangeFactory : public ModuleFactory
+{
+ public:
+ ModuleNoNickChangeFactory()
+ {
+ }
+
+ ~ModuleNoNickChangeFactory()
+ {
+ }
+
+ virtual Module * CreateModule()
+ {
+ return new ModuleNoNickChange;
+ }
+
+};
+
+
+extern "C" void * init_module( void )
+{
+ return new ModuleNoNickChangeFactory;
+}
+
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 23c529bfc..f501cc307 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -38,6 +38,19 @@ class ModuleNoNotice : public Module
}
return 0;
}
+
+ virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
+ {
+ // check if this is our mode character...
+ if ((modechar == 'T') && (type == MT_CHANNEL))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
virtual ~ModuleNoNotice()
{