* +------------------------------------+
*
* InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
#include "inspircd.h"
-static char prefixchar;
+#define OPERPREFIX_VALUE 1000000
std::set<std::string>* SetupExt(User* user)
{
class OperPrefixMode : public ModeHandler
{
public:
- OperPrefixMode(InspIRCd* Instance) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, prefixchar) { }
+ OperPrefixMode(InspIRCd* Instance, Module* Creator, char pfx) : ModeHandler(Instance, Creator, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx, pfx, TR_NICK) { }
unsigned int GetPrefixRank()
{
- return 40000;
+ return OPERPREFIX_VALUE;
}
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode)
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
- if (servermode || (source && ServerInstance->ULine(source->server)))
+ if (IS_FAKE(source) || (source && ServerInstance->ULine(source->server)))
return MODEACTION_ALLOW;
else
{
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, this, pfx[0]);
if ((!ServerInstance->Modes->AddMode(opm)))
throw ModuleException("Could not add a new mode!");
DelPrefixChan(user, channel);
else
AddPrefixChan(user, channel);
- char modeline[]="+y";
+ char modeline[] = "+y";
if (negate)
- modeline [0]='-';
+ modeline[0] = '-';
std::vector<std::string> modechange;
modechange.push_back(channel->name);
modechange.push_back(modeline);
}
// XXX: is there a better way to do this?
- virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt, bool servermode)
+ virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt)
{
/* force event propagation to its ModeHandler */
- if (!servermode && chan && (mode == 'y'))
+ if (!IS_FAKE(user) && chan && (mode == 'y'))
return ACR_ALLOW;
return 0;
}
{
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);