diff options
author | Adam <Adam@anope.org> | 2013-08-01 13:16:18 +0000 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-08-01 13:39:35 +0000 |
commit | 1e625b6837fdf96616cfc49700aa28d184a7c171 (patch) | |
tree | 6b6f06deaf769dd6b1a7853f90d26183828986f1 /src/modes.cpp | |
parent | 402c624e455d13cc811bef2e8d1639846e892a34 (diff) |
Use MessageSource as the source for many IRCDProto funcs
Keep track of what user modes are oper only/server only/etc
Diffstat (limited to 'src/modes.cpp')
-rw-r--r-- | src/modes.cpp | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/src/modes.cpp b/src/modes.cpp index fc343c0d2..41c2ac663 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -13,6 +13,7 @@ #include "sockets.h" #include "protocol.h" #include "channels.h" +#include "uplink.h" struct StackerInfo; @@ -40,7 +41,7 @@ struct StackerInfo /* Modes to be deleted */ std::list<std::pair<Mode *, Anope::string> > DelModes; /* Bot this is sent from */ - const BotInfo *bi; + BotInfo *bi; StackerInfo() : bi(NULL) { } @@ -116,11 +117,12 @@ Mode::~Mode() { } -UserMode::UserMode(const Anope::string &un, char mch) : Mode(un, MC_USER, mch, MODE_REGULAR) +bool Mode::CanSet(User *u) const { + return true; } -UserMode::~UserMode() +UserMode::UserMode(const Anope::string &un, char mch) : Mode(un, MC_USER, mch, MODE_REGULAR) { } @@ -133,10 +135,6 @@ ChannelMode::ChannelMode(const Anope::string &cm, char mch) : Mode(cm, MC_CHANNE { } -ChannelMode::~ChannelMode() -{ -} - bool ChannelMode::CanSet(User *u) const { EventReturn MOD_RESULT; @@ -149,53 +147,40 @@ ChannelModeList::ChannelModeList(const Anope::string &cm, char mch) : ChannelMod this->type = MODE_LIST; } -ChannelModeList::~ChannelModeList() -{ -} - ChannelModeParam::ChannelModeParam(const Anope::string &cm, char mch, bool ma) : ChannelMode(cm, mch), minus_no_arg(ma) { this->type = MODE_PARAM; } -ChannelModeParam::~ChannelModeParam() -{ -} - ChannelModeStatus::ChannelModeStatus(const Anope::string &mname, char modeChar, char msymbol, short mlevel) : ChannelMode(mname, modeChar), symbol(msymbol), level(mlevel) { this->type = MODE_STATUS; } -ChannelModeStatus::~ChannelModeStatus() +bool UserModeOperOnly::CanSet(User *u) const { + return u && u->HasMode("OPER"); } -bool ChannelModeKey::IsValid(const Anope::string &value) const +bool UserModeNoone::CanSet(User *u) const { - if (!value.empty() && value.find(':') == Anope::string::npos && value.find(',') == Anope::string::npos) - return true; - return false; } -bool ChannelModeAdmin::CanSet(User *u) const +bool ChannelModeKey::IsValid(const Anope::string &value) const { - if (u && u->HasMode("OPER")) + if (!value.empty() && value.find(':') == Anope::string::npos && value.find(',') == Anope::string::npos) return true; return false; } -bool ChannelModeOper::CanSet(User *u) const +bool ChannelModeOperOnly::CanSet(User *u) const { - if (u && u->HasMode("OPER")) - return true; - - return false; + return u && u->HasMode("OPER"); } -bool ChannelModeRegistered::CanSet(User *u) const +bool ChannelModeNoone::CanSet(User *u) const { return false; } @@ -526,7 +511,7 @@ void ModeManager::RebuildStatusModes() std::sort(ChannelModesByStatus.begin(), ChannelModesByStatus.end(), statuscmp); } -void ModeManager::StackerAdd(const BotInfo *bi, Channel *c, ChannelMode *cm, bool Set, const Anope::string &Param) +void ModeManager::StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool Set, const Anope::string &Param) { StackerInfo *s = GetInfo(ChannelStackerObjects, c); s->AddMode(cm, Set, Param); @@ -540,7 +525,7 @@ void ModeManager::StackerAdd(const BotInfo *bi, Channel *c, ChannelMode *cm, boo modePipe->Notify(); } -void ModeManager::StackerAdd(const BotInfo *bi, User *u, UserMode *um, bool Set, const Anope::string &Param) +void ModeManager::StackerAdd(BotInfo *bi, User *u, UserMode *um, bool Set, const Anope::string &Param) { StackerInfo *s = GetInfo(UserStackerObjects, u); s->AddMode(um, Set, Param); |