summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-08 10:20:56 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-08 10:20:56 +0000
commitf571a318d69a7dd441afb62182507619f8fe7dd8 (patch)
treebf5b623e1ae74a124a35bfce93949a695130a2c0
parentc30f0ef741528231aefaa3b284f3ac161b1ca86c (diff)
*YOINK* Add jamie's patch for parameterized usermodes in m_opermodes (thanks)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5157 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_opermodes.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 4526b05d3..e0ae8209f 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -17,6 +17,7 @@
using namespace std;
#include <stdio.h>
+#include <vector>
#include "users.h"
#include "channels.h"
#include "inspircd.h"
@@ -76,10 +77,34 @@ class ModuleModesOnOper : public Module
ThisOpersModes = "+" + ThisOpersModes;
if (ThisOpersModes != "")
{
- const char* modes[2];
+ std::string buf;
+ stringstream ss(ThisOpersModes);
+
+ vector<string> tokens;
+
+ // split ThisOperModes into modes and mode params
+ while (ss >> buf)
+ tokens.push_back(buf);
+
+ int size = tokens.size() + 1;
+ const char* modes[size];
modes[0] = user->nick;
- modes[1] = ThisOpersModes.c_str();
- ServerInstance->SendMode(modes,2,user);
+ modes[1] = (char*)tokens[0].c_str();
+
+ if (tokens.size() > 1)
+ {
+ // process mode params
+ int i = 2;
+ for (unsigned int k = 1; k < tokens.size(); k++)
+ {
+ modes[i] = (char*)tokens[k].c_str();
+ ServerInstance->Log(DEBUG, "m_opermodes.so: got mode param: %s", modes[i]);
+ i++;
+ }
+ }
+
+ ServerInstance->Log(DEBUG, "m_opermodes.so: new modes for %s: %s", modes[0], modes[1]);
+ ServerInstance->SendMode(modes, size, user);
}
break;
}