From 6b26d9b62fd4db550e5a78d028b80a30ab38513d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 15 Feb 2009 09:20:46 +0000 Subject: Fix for bug #725, operprefix rank value conflicts with founder rank value, raise operprefix value, also get rid of some static global var craq. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11110 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_operprefix.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/modules/m_operprefix.cpp') diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index 6614b867b..127a1b46b 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -19,7 +19,7 @@ #include "inspircd.h" -static char prefixchar; +#define OPERPREFIX_VALUE 1000000 std::set* SetupExt(User* user) { @@ -51,11 +51,11 @@ void AddPrefixChan(User* user, Channel* channel) class OperPrefixMode : public ModeHandler { public: - OperPrefixMode(InspIRCd* Instance) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, prefixchar) { } + OperPrefixMode(InspIRCd* Instance, char prefix) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, prefix) { } unsigned int GetPrefixRank() { - return 40000; + return OPERPREFIX_VALUE; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode) @@ -111,11 +111,9 @@ class ModuleOperPrefixMode : public Module ModuleOperPrefixMode(InspIRCd* Me) : Module(Me) { ConfigReader Conf(ServerInstance); - std::string tmp; - tmp = Conf.ReadValue("operprefix", "prefix", "!", 0, false); - strlcpy(&prefixchar,tmp.c_str(),2); + std::string pfx = Conf.ReadValue("operprefix", "prefix", "!", 0, false); - opm = new OperPrefixMode(ServerInstance); + opm = new OperPrefixMode(ServerInstance, pfx[0]); if ((!ServerInstance->Modes->AddMode(opm))) throw ModuleException("Could not add a new mode!"); @@ -129,9 +127,9 @@ class ModuleOperPrefixMode : public Module DelPrefixChan(user, channel); else AddPrefixChan(user, channel); - char modeline[]="+y"; + char modeline[] = "+y"; if (negate) - modeline [0]='-'; + modeline[0] = '-'; std::vector modechange; modechange.push_back(channel->name); modechange.push_back(modeline); @@ -189,7 +187,7 @@ class ModuleOperPrefixMode : public Module { for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++) { - ModePair ms=opm->ModeSet(NULL, NULL , v->first, user->nick); + ModePair ms = opm->ModeSet(NULL, NULL , v->first, user->nick); if (ms.first) { PushChanMode(v->first, user, true); -- cgit v1.2.3