summaryrefslogtreecommitdiff
path: root/src/commands/cmd_topic.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-06-18 18:30:10 +0200
committerattilamolnar <attilamolnar@hush.com>2013-07-19 19:40:03 +0200
commitb954283ccc4253a6881513bbe7f743c39886d3b7 (patch)
tree56386d71e6132d06e8e4e786fba867a4945114b1 /src/commands/cmd_topic.cpp
parent5288eb159451aea53168c1a812a72594801f6421 (diff)
Replace hardcoded mode letters, part 2
This changes all remaining Channel::IsModeSet() and Channel::GetModeParameter() calls to use ModeReferences for modes that were created by other modules or the core
Diffstat (limited to 'src/commands/cmd_topic.cpp')
-rw-r--r--src/commands/cmd_topic.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp
index e8c555e90..997fb6a91 100644
--- a/src/commands/cmd_topic.cpp
+++ b/src/commands/cmd_topic.cpp
@@ -29,10 +29,21 @@
*/
class CommandTopic : public Command
{
+ ChanModeReference secretmode;
+ ChanModeReference topiclockmode;
+
public:
/** Constructor for topic.
*/
- CommandTopic ( Module* parent) : Command(parent,"TOPIC",1, 2) { syntax = "<channel> [<topic>]"; Penalty = 2; }
+ CommandTopic(Module* parent)
+ : Command(parent, "TOPIC", 1, 2)
+ , secretmode(parent, "secret")
+ , topiclockmode(parent, "topiclock")
+ {
+ syntax = "<channel> [<topic>]";
+ Penalty = 2;
+ }
+
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
@@ -59,7 +70,7 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
{
if (c)
{
- if ((c->IsModeSet('s')) && (!c->HasUser(user)))
+ if ((c->IsModeSet(secretmode)) && (!c->HasUser(user)))
{
user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str());
return CMD_FAILURE;
@@ -98,7 +109,7 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
user->WriteNumeric(442, "%s %s :You're not on that channel!", user->nick.c_str(), c->name.c_str());
return CMD_FAILURE;
}
- if (c->IsModeSet('t') && !ServerInstance->OnCheckExemption(user, c, "topiclock").check(c->GetPrefixValue(user) >= HALFOP_VALUE))
+ if (c->IsModeSet(topiclockmode) && !ServerInstance->OnCheckExemption(user, c, "topiclock").check(c->GetPrefixValue(user) >= HALFOP_VALUE))
{
user->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", user->nick.c_str(), c->name.c_str());
return CMD_FAILURE;