summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-05 04:53:44 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-05 04:53:44 +0000
commitf208e9477f08d5780038782c7a2b0cd506058994 (patch)
treefae55b9b23f65eb985c4e314ae408555f29de11c
parented022ecb624c81d23a5f2780aa061f80b5d221b4 (diff)
Don't enforce access control on remote users for topic changes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12376 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/channels.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 7c60b54f0..0b9eb1cc4 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -81,29 +81,26 @@ std::string Channel::GetModeParameter(ModeHandler* mode)
int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
{
- if (u)
+ if (!u)
+ u = ServerInstance->FakeClient;
+ if (IS_LOCAL(u) && !forceset)
{
- if(!forceset)
- {
- ModResult res;
- /* 0: check status, 1: don't, -1: disallow change silently */
-
- FIRST_MOD_RESULT(OnPreTopicChange, res, (u,this,ntopic));
+ ModResult res;
+ FIRST_MOD_RESULT(OnPreTopicChange, res, (u,this,ntopic));
- if (res == MOD_RES_DENY)
+ if (res == MOD_RES_DENY)
+ return CMD_FAILURE;
+ if (res != MOD_RES_ALLOW)
+ {
+ if (!this->HasUser(u))
+ {
+ u->WriteNumeric(442, "%s %s :You're not on that channel!",u->nick.c_str(), this->name.c_str());
return CMD_FAILURE;
- if (res != MOD_RES_ALLOW)
+ }
+ if ((this->IsModeSet('t')) && (this->GetPrefixValue(u) < HALFOP_VALUE))
{
- if (!this->HasUser(u))
- {
- u->WriteNumeric(442, "%s %s :You're not on that channel!",u->nick.c_str(), this->name.c_str());
- return CMD_FAILURE;
- }
- if ((this->IsModeSet('t')) && (this->GetPrefixValue(u) < HALFOP_VALUE))
- {
- u->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", u->nick.c_str(), this->name.c_str());
- return CMD_FAILURE;
- }
+ u->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", u->nick.c_str(), this->name.c_str());
+ return CMD_FAILURE;
}
}
}
@@ -122,11 +119,7 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
this->topicset = ServerInstance->Time();
- // XXX: this check for 'u' is probably pre-fake-user, and it fucking sucks anyway. we need to change this.
- if (u)
- {
- FOREACH_MOD(I_OnPostTopicChange,OnPostTopicChange(u, this, this->topic));
- }
+ FOREACH_MOD(I_OnPostTopicChange,OnPostTopicChange(u, this, this->topic));
return CMD_SUCCESS;
}