summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-09 16:40:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-09 16:40:58 +0000
commit49ef1162a51906e7444bb7e38736bd816c317db6 (patch)
tree4092360d44d2c8d88b243b4d37bc873fd964dde2 /src
parenta339562253004e861633c67e011d3101ec4588ba (diff)
Alter SetModeParam to take const char* to save on casts, notice a load of modules that arent setting the param or the mode inside the handler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4231 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp2
-rw-r--r--src/modules/m_joinflood.cpp3
-rw-r--r--src/modules/m_kicknorejoin.cpp2
-rw-r--r--src/modules/m_messageflood.cpp3
-rw-r--r--src/modules/m_redirect.cpp36
5 files changed, 45 insertions, 1 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index a25b2927c..632e198e5 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -65,7 +65,7 @@ void chanrec::SetMode(char mode,bool mode_on)
}
-void chanrec::SetModeParam(char mode,char* parameter,bool mode_on)
+void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on)
{
log(DEBUG,"SetModeParam called");
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 6cc54db68..43b45be69 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -136,6 +136,8 @@ class JoinFlood : public ModeHandler
{
joinfloodsettings *f = new joinfloodsettings(nsecs,njoins);
channel->Extend("joinflood",(char*)f);
+ channel->SetMode('j', true);
+ channel->SetModeParam('j', parameter.c_str(), true);
return MODEACTION_ALLOW;
}
}
@@ -153,6 +155,7 @@ class JoinFlood : public ModeHandler
joinfloodsettings *f = (joinfloodsettings*)channel->GetExt("joinflood");
DELETE(f);
channel->Shrink("joinflood");
+ channel->SetMode('j', false);
return MODEACTION_ALLOW;
}
}
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 770b79db3..1c5333def 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -40,6 +40,8 @@ class KickRejoin : public ModeHandler
}
if ((!adding) || (atoi(parameter.c_str()) > 0))
{
+ channel->SetModeParam('J', parameter.c_str(), adding);
+ channel->SetMode('J', adding);
return MODEACTION_ALLOW;
}
else
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 2cbecfdac..bcec8248b 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -135,6 +135,8 @@ class MsgFlood : public ModeHandler
{
floodsettings *f = new floodsettings(ban,nsecs,nlines);
channel->Extend("flood",(char*)f);
+ channel->SetMode('f', true);
+ channel->SetModeParam('f', parameter.c_str(), true);
return MODEACTION_ALLOW;
}
}
@@ -153,6 +155,7 @@ class MsgFlood : public ModeHandler
floodsettings *f = (floodsettings*)channel->GetExt("flood");
DELETE(f);
channel->Shrink("flood");
+ channel->SetMode('f', false);
return MODEACTION_ALLOW;
}
}
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 799eb25de..e3da4622f 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -24,6 +24,42 @@ using namespace std;
/* $ModDesc: Provides channel mode +L (limit redirection) */
+class Redirect : public ModeHandler
+{
+ public:
+ Redirect() : ModeHandler('L', 1, 0, false, MODETYPE_CHANNEL, false) { }
+
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+ {
+ if (adding)
+ {
+ chanrec* c = NULL;
+
+ if (!IsValidChannelName(parameter.c_str()))
+ {
+ WriteServ(user->fd,"403 %s %s :Invalid channel name",user->nick, parameter.c_str());
+ parameter = "";
+ return MODEACTION_DENY;
+ }
+
+ c = Srv->FindChannel(parameter);
+ if (c)
+ {
+ /* Fix by brain: Dont let a channel be linked to *itself* either */
+ if ((c == target) || (c->IsModeSet('L')))
+ {
+ WriteServ(user->fd,"690 %s :Circular redirection, mode +L to %s not allowed.",user->nick,parameter.c_str());
+ parameter = "";
+ return MODEACTION_DENY;
+ }
+ }
+
+ c->SetMode('L', true);
+ c->SetModeParam('L', parameter);
+ return MODEACTION_ALLOW;
+ }
+ }
+};
class ModuleRedirect : public Module
{