summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-27 19:40:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-27 19:40:47 +0000
commita1f073f66f4b985bf776b9be2015136209c0c311 (patch)
tree1413b1367e52ece46803c5d8fb57325c5ebbfd22 /src
parent98a92e20f1fa4a9c7e5749e063414483d4615c2e (diff)
Change std::pair<bool,std::string> to neater typedef "ModePair"
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4557 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp2
-rw-r--r--src/modes/cmode_b.cpp12
-rw-r--r--src/modes/cmode_h.cpp2
-rw-r--r--src/modes/cmode_k.cpp2
-rw-r--r--src/modes/cmode_l.cpp2
-rw-r--r--src/modes/cmode_o.cpp2
-rw-r--r--src/modes/cmode_v.cpp2
-rw-r--r--src/modules/m_chanprotect.cpp4
-rw-r--r--src/modules/m_joinflood.cpp8
-rw-r--r--src/modules/m_kicknorejoin.cpp8
-rw-r--r--src/modules/m_messageflood.cpp8
-rw-r--r--src/modules/m_redirect.cpp8
-rw-r--r--src/modules/m_spanningtree.cpp4
13 files changed, 50 insertions, 14 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 5b32c707a..6507c6d26 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -113,7 +113,7 @@ ModeAction ModeHandler::OnModeChange(userrec* source, userrec* dest, chanrec* ch
return MODEACTION_DENY;
}
-std::pair<bool,std::string> ModeHandler::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
+ModePair ModeHandler::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
if (dest)
{
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index ccc6bdfcf..569fb6772 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -111,6 +111,18 @@ std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *cha
return dest;
}
+ModePair ModeChannelBan::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
+{
+ for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
+ {
+ if (!strcasecmp(i->data,parameter.c_str()))
+ {
+ return std::make_pair(true, i->data);
+ }
+ }
+ return std::make_pair(false, parameter);
+}
+
std::string& ModeChannelBan::DelBan(userrec *user,std::string& dest,chanrec *chan,int status)
{
if ((!user) || (!chan))
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 4a2c5fa69..e9a74fc3e 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -26,7 +26,7 @@ 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 &parameter)
+ModePair ModeChannelHalfOp::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
userrec* x = Find(parameter);
if (x)
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index e54aa688a..e509447f3 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -8,7 +8,7 @@ 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 &parameter)
+ModePair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
if (channel->modes[CM_KEY])
{
diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp
index 89d67026c..cdbf0f58f 100644
--- a/src/modes/cmode_l.cpp
+++ b/src/modes/cmode_l.cpp
@@ -8,7 +8,7 @@ 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 &parameter)
+ModePair ModeChannelLimit::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
if (channel->limit)
{
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 853bb86e5..a24cc2af9 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -26,7 +26,7 @@ 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 &parameter)
+ModePair ModeChannelOp::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
userrec* x = Find(parameter);
if (x)
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index a72e6bf18..76978d346 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -26,7 +26,7 @@ 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 &parameter)
+ModePair ModeChannelVoice::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
userrec* x = Find(parameter);
if (x)
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 675e95e96..95bb06a13 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -31,7 +31,7 @@ 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 &parameter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
userrec* x = Find(parameter);
if (x)
@@ -135,7 +135,7 @@ 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 &parameter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
userrec* x = Find(parameter);
if (x)
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 0d038b48d..3068c5209 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -99,7 +99,7 @@ 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 &parameter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
joinfloodsettings* x;
if (channel->GetExt("joinflood",x))
@@ -108,6 +108,12 @@ class JoinFlood : public ModeHandler
return std::make_pair(false, parameter);
}
+ bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+ {
+ /* When TS is equal, the alphabetically later one wins */
+ return (their_param < our_param);
+ }
+
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
joinfloodsettings* dummy;
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 97b766e36..4f415b8a9 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -25,7 +25,7 @@ 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 &parameter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
if (channel->IsModeSet('J'))
return std::make_pair(true, channel->GetModeParameter('J'));
@@ -33,6 +33,12 @@ class KickRejoin : public ModeHandler
return std::make_pair(false, parameter);
}
+ bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+ {
+ /* When TS is equal, the alphabetically later one wins */
+ return (their_param < our_param);
+ }
+
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
if (!adding)
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 7efe8e8ec..f322a63e6 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -88,7 +88,7 @@ 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 &parameter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
floodsettings* x;
if (channel->GetExt("flood",x))
@@ -97,6 +97,12 @@ class MsgFlood : public ModeHandler
return std::make_pair(false, parameter);
}
+ bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+ {
+ /* When TS is equal, the alphabetically later one wins */
+ return (their_param < our_param);
+ }
+
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
floodsettings *f;
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index b289c1a0e..7493b5c65 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -30,7 +30,7 @@ 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 &parameter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
{
if (channel->IsModeSet('L'))
return std::make_pair(true, channel->GetModeParameter('L'));
@@ -38,6 +38,12 @@ class Redirect : public ModeHandler
return std::make_pair(false, parameter);
}
+ bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+ {
+ /* When TS is equal, the alphabetically later one wins */
+ return (their_param < our_param);
+ }
+
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
if (adding)
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 77929b382..59b82fb5a 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -980,7 +980,7 @@ class TreeSocket : public InspSocket
* modes with parameters, we are going to rewrite
* those parameters
*/
- std::pair<bool, std::string> ret;
+ ModePair ret;
adding ? cur_change = '+' : cur_change = '-';
ret = mh->ModeSet(smode ? NULL : who, dst, chan, params[paramptr]);
@@ -1167,7 +1167,7 @@ class TreeSocket : public InspSocket
*/
if (mh)
{
- std::pair<bool, std::string> ret;
+ ModePair ret;
std::string p = "";
/* Does the mode require a parameter right now?