diff options
Diffstat (limited to 'src/modes')
-rw-r--r-- | src/modes/cmode_h.cpp | 17 | ||||
-rw-r--r-- | src/modes/cmode_k.cpp | 13 | ||||
-rw-r--r-- | src/modes/cmode_l.cpp | 12 | ||||
-rw-r--r-- | src/modes/cmode_o.cpp | 17 | ||||
-rw-r--r-- | src/modes/cmode_v.cpp | 17 |
5 files changed, 76 insertions, 0 deletions
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 2c96b4224..4a2c5fa69 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -26,6 +26,23 @@ ModeChannelHalfOp::ModeChannelHalfOp() : ModeHandler('h', 1, 1, true, MODETYPE_C { } +std::pair<bool,std::string> ModeChannelHalfOp::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +{ + userrec* x = Find(parameter); + if (x) + { + if (cstatus(x, channel) == STATUS_HOP) + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } + } + return std::make_pair(false, parameter); +} + ModeAction ModeChannelHalfOp::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { /* If halfops are not enabled in the conf, we don't execute diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 9e69ed13b..2f06ba55c 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -8,6 +8,19 @@ ModeChannelKey::ModeChannelKey() : ModeHandler('k', 1, 1, false, MODETYPE_CHANNE { } +std::pair<bool,std::string> ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +{ + if (channel->modes[CM_KEY]) + { + return std::make_pair(true, channel->key); + } + else + { + return std::make_pair(false, parameter); + } +} + + ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { if (channel->modes[CM_KEY] != adding) diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp index 10ff3135a..a5fa5329b 100644 --- a/src/modes/cmode_l.cpp +++ b/src/modes/cmode_l.cpp @@ -8,6 +8,18 @@ ModeChannelLimit::ModeChannelLimit() : ModeHandler('l', 1, 0, false, MODETYPE_CH { } +std::pair<bool,std::string> ModeChannelLimit::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +{ + if (channel->limit) + { + return std::make_pair(true, ConvToStr(channel->limit)); + } + else + { + return std::make_pair(false, parameter); + } +} + ModeAction ModeChannelLimit::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { if (adding) diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index dfa3a1a10..853bb86e5 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -26,6 +26,23 @@ ModeChannelOp::ModeChannelOp() : ModeHandler('o', 1, 1, true, MODETYPE_CHANNEL, { } +std::pair<bool,std::string> ModeChannelOp::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +{ + userrec* x = Find(parameter); + if (x) + { + if (cstatus(x, channel) == STATUS_OP) + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } + } + return std::make_pair(false, parameter); +} + ModeAction ModeChannelOp::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { int status = cstatus(source, channel); diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 87d391109..a72e6bf18 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -26,6 +26,23 @@ ModeChannelVoice::ModeChannelVoice() : ModeHandler('v', 1, 1, true, MODETYPE_CHA { } +std::pair<bool,std::string> ModeChannelVoice::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) +{ + userrec* x = Find(parameter); + if (x) + { + if (cstatus(x, channel) == STATUS_VOICE) + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } + } + return std::make_pair(false, parameter); +} + ModeAction ModeChannelVoice::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { int status = cstatus(source, channel); |