diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_chanprotect.cpp | 51 | ||||
-rw-r--r-- | src/modules/m_joinflood.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_messageflood.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_redirect.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 5 |
6 files changed, 90 insertions, 0 deletions
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 208dc8362..675e95e96 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -31,6 +31,32 @@ class ChanFounder : public ModeHandler public: ChanFounder(Server* s) : ModeHandler('q', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } + std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + userrec* x = Find(parameter); + if (x) + { + if (!channel->HasUser(x)) + { + return std::make_pair(false, parameter); + } + else + { + std::string founder = "cm_founder_"+std::string(channel->name); + if (x->GetExt(founder,dummyptr)) + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } + } + } + return std::make_pair(false, parameter); + } + + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { userrec* theuser = Srv->FindNick(parameter); @@ -109,6 +135,31 @@ class ChanProtect : public ModeHandler public: ChanProtect(Server* s) : ModeHandler('a', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } + std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + userrec* x = Find(parameter); + if (x) + { + if (!channel->HasUser(x)) + { + return std::make_pair(false, parameter); + } + else + { + std::string founder = "cm_protect_"+std::string(channel->name); + if (x->GetExt(founder,dummyptr)) + { + return std::make_pair(true, x->nick); + } + else + { + return std::make_pair(false, parameter); + } + } + } + return std::make_pair(false, parameter); + } + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { userrec* theuser = Srv->FindNick(parameter); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 33b6b8b61..0d038b48d 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -99,6 +99,15 @@ class JoinFlood : public ModeHandler public: JoinFlood() : ModeHandler('j', 1, 0, false, MODETYPE_CHANNEL, false) { } + std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + joinfloodsettings* x; + if (channel->GetExt("joinflood",x)) + return std::make_pair(true, ConvToStr(x->joins)+":"+ConvToStr(x->secs)); + else + return std::make_pair(false, parameter); + } + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { joinfloodsettings* dummy; diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 80e1fb8d0..97b766e36 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -25,6 +25,14 @@ class KickRejoin : public ModeHandler public: KickRejoin() : ModeHandler('J', 1, 0, false, MODETYPE_CHANNEL, false) { } + std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + if (channel->IsModeSet('J')) + return std::make_pair(true, channel->GetModeParameter('J')); + else + return std::make_pair(false, parameter); + } + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { if (!adding) diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 52fed00f0..7efe8e8ec 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -88,6 +88,15 @@ class MsgFlood : public ModeHandler public: MsgFlood() : ModeHandler('f', 1, 0, false, MODETYPE_CHANNEL, false) { } + std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + floodsettings* x; + if (channel->GetExt("flood",x)) + return std::make_pair(true, (x->ban ? "*" : "")+ConvToStr(x->lines)+":"+ConvToStr(x->secs)); + else + return std::make_pair(false, parameter); + } + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { floodsettings *f; diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 6e239cb08..b289c1a0e 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -30,6 +30,14 @@ class Redirect : public ModeHandler public: Redirect(Server* s) : ModeHandler('L', 1, 0, false, MODETYPE_CHANNEL, false), Srv(s) { } + std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + if (channel->IsModeSet('L')) + return std::make_pair(true, channel->GetModeParameter('L')); + else + return std::make_pair(false, parameter); + } + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { if (adding) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index f14cc69de..e1834721d 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -945,6 +945,11 @@ class TreeSocket : public InspSocket } } DoOneToOne(source,"FMODE",params,source); + /* XXX: We should check that we arent bouncing anything thats already set at this end. + * If we are, bounce +ourmode. + * + * E.G. They send +l 50, we have +l 10 set. rather than bounce -l 50, we bounce +l 10. + */ log(DEBUG,"Mode bounced, our TS less than theirs"); } else |