summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-27 20:20:15 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-27 20:20:15 +0000
commit28c82e83802100a2b7b6dadf5333a199c9fbe663 (patch)
tree8cbc6288a51f6baeb9b06f4ca7c40185fbcfa3d2
parentaea30280acf0a8faaca910815cad4e9530565685 (diff)
Added 005 numeric handling to most of the modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@921 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_censor.cpp19
-rw-r--r--src/modules/m_chanprotect.cpp18
-rw-r--r--src/modules/m_knock.cpp20
-rw-r--r--src/modules/m_noctcp.cpp18
-rw-r--r--src/modules/m_noinvite.cpp18
-rw-r--r--src/modules/m_nokicks.cpp18
-rw-r--r--src/modules/m_nonicks.cpp18
-rw-r--r--src/modules/m_nonotice.cpp18
-rw-r--r--src/modules/m_operchans.cpp18
-rw-r--r--src/modules/m_override.cpp5
-rw-r--r--src/modules/m_redirect.cpp19
-rw-r--r--src/modules/m_remove.cpp5
-rw-r--r--src/modules/m_services.cpp18
-rw-r--r--src/modules/m_stripcolor.cpp18
14 files changed, 229 insertions, 1 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index 769e6e493..8a0bc4d9e 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -49,6 +49,25 @@ class ModuleCensor : public Module
Srv->AddExtendedMode('G',MT_CLIENT,false,0,0);
}
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "G";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
+
+
virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
{
// check if this is our mode character...
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index a357e8983..c762fb6a4 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -50,6 +50,24 @@ class ModuleChanProtect : public Module
FirstInGetsFounder = Conf->ReadFlag("options","noservices",0);
}
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=qa" + temp1;
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
+
virtual void OnRehash()
{
// on a rehash we delete our classes for good measure and create them again.
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index dc4263335..474dd4014 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -64,7 +64,25 @@ class ModuleKnock : public Module
Srv->AddExtendedMode('K',MT_CHANNEL,false,0,0);
Srv->AddCommand("KNOCK",handle_knock,0,2);
}
-
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "K";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1) + std::string(" KNOCK");
+ }
+
virtual ~ModuleKnock()
{
delete Srv;
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 73b991f7c..a5b8832af 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -32,6 +32,24 @@ class ModuleNoCTCP : public Module
Srv = new Server;
Srv->AddExtendedMode('C',MT_CHANNEL,false,0,0);
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "C";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{
diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp
index 7bd76d95c..463d5a5b9 100644
--- a/src/modules/m_noinvite.cpp
+++ b/src/modules/m_noinvite.cpp
@@ -33,6 +33,24 @@ class ModuleNoInvite : public Module
Srv->AddExtendedMode('V',MT_CHANNEL,false,0,0);
}
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "V";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
+
virtual int OnUserPreInvite(userrec* user,userrec* dest,chanrec* channel)
{
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index d2f6b8da5..e049512f9 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -33,6 +33,24 @@ class ModuleNoKicks : public Module
Srv->AddExtendedMode('Q',MT_CHANNEL,false,0,0);
}
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "Q";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
+
virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
{
if (access_type == AC_KICK)
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index 24540c1d4..dfdf86b61 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -43,6 +43,24 @@ class ModuleNoNickChange : public Module
{
return Version(1,0,0,1);
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "N";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual int OnUserPreNick(userrec* user, std::string newnick)
{
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 89a619590..6d8e8a401 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -54,6 +54,24 @@ class ModuleNoNotice : public Module
return 0;
}
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "T";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
+
virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
{
// check if this is our mode character...
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 430411289..e5eefe0cf 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -58,6 +58,24 @@ class ModuleOperChans : public Module
return 0;
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "O";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
{
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 2c3adfa9a..cd9cfba0f 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -52,6 +52,11 @@ class ModuleOverride : public Module
// re-read our config options on a rehash
NoisyOverride = Conf->ReadFlag("override","noisy",0);
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ output = output + std::string(" OVERRIDE");
+ }
virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
{
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 7b4fe81de..e81864565 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -55,6 +55,25 @@ class ModuleRedirect : public Module
}
return 0;
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // By doing this we're *assuming* no other module has fucked up the CHANMODES=
+ // section of the 005 numeric. If they have, we're going DOWN in a blaze of glory,
+ // with a honking great EXCEPTION :)
+ temp1.insert(temp1.find(",")+1,"L");
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
{
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 94ca1e5d2..873bdb25e 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -115,6 +115,11 @@ class ModuleRemove : public Module
Srv = new Server;
Srv->AddCommand("REMOVE", handle_remove, 0, 3);
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ output = output + std::string(" REMOVE");
+ }
virtual ~ModuleRemove()
{
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index dd1506717..d3e9066e8 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -37,6 +37,24 @@ class ModuleServices : public Module
Srv->AddExtendedMode('R',MT_CLIENT,false,0,0);
Srv->AddExtendedMode('M',MT_CHANNEL,false,0,0);
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "rRM";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
{
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index ec7a57720..ba914c75e 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -48,6 +48,24 @@ class ModuleStripColor : public Module
return 0;
}
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "S";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual ~ModuleStripColor()
{