* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
- *
- * Written by Craig Edwards, Craig McLure, and others.
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
int end;
char* dummyptr;
protected:
- bool remove_own_privs;
+ bool& remove_own_privs;
public:
- FounderProtectBase(InspIRCd* Instance, const std::string &ext, const std::string &mtype, int l, int e, bool remove_own) :
+ FounderProtectBase(InspIRCd* Instance, const std::string &ext, const std::string &mtype, int l, int e, bool &remove_own) :
MyInstance(Instance), extend(ext), type(mtype), list(l), end(e), remove_own_privs(remove_own)
{
}
{
char* dummyptr;
public:
- ChanFounder(InspIRCd* Instance, bool using_prefixes, bool depriv_self)
+ ChanFounder(InspIRCd* Instance, bool using_prefixes, bool &depriv_self)
: ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false, using_prefixes ? '~' : 0),
FounderProtectBase(Instance, "cm_founder_", "founder", 386, 387, depriv_self) { }
}
// source is a server, or ulined, we'll let them +-q the user.
- if ((unload_kludge) || ((source == theuser) && (FounderProtectBase::remove_own_privs)) || (ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server) || (!IS_LOCAL(source)))
+ if ((unload_kludge) || ((source == theuser) && (!adding) && (FounderProtectBase::remove_own_privs)) || (ServerInstance->ULine(source->nick)) || (ServerInstance->ULine(source->server)) || (!*source->server) || (!IS_LOCAL(source)))
{
return FounderProtectBase::HandleChange(source, theuser, adding, channel, parameter);
}
{
char* dummyptr;
public:
- ChanProtect(InspIRCd* Instance, bool using_prefixes, bool depriv_self)
+ ChanProtect(InspIRCd* Instance, bool using_prefixes, bool &depriv_self)
: ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false, using_prefixes ? '&' : 0),
FounderProtectBase(Instance,"cm_protect_","protected user", 388, 389, depriv_self) { }
: Module::Module(Me), FirstInGetsFounder(false), QAPrefixes(false), DeprivSelf(false), booting(true)
{
/* Load config stuff */
- OnRehash("");
+ OnRehash(NULL,"");
booting = false;
/* Initialise module variables */
cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf);
cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf);
- ServerInstance->AddMode(cp, 'a');
- ServerInstance->AddMode(cf, 'q');
+ if (!ServerInstance->AddMode(cp, 'a') || !ServerInstance->AddMode(cf, 'q'))
+ throw ModuleException("Could not add new modes!");
}
void Implements(char* List)
user->Shrink("cm_protect_"+std::string(channel->name));
}
- virtual void OnRehash(const std::string ¶meter)
+ virtual void OnRehash(userrec* user, const std::string ¶meter)
{
/* Create a configreader class and read our flag,
* in old versions this was heap-allocated and the
DELETE(cf);
cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf);
cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf);
+ /* These wont fail, we already owned the mode characters before */
ServerInstance->AddMode(cp, 'a');
ServerInstance->AddMode(cf, 'q');
ServerInstance->WriteOpers("*** WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change.");