1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "commands/cmd_topic.h"
18 extern "C" DllExport Command* init_command(InspIRCd* Instance)
20 return new CommandTopic(Instance);
23 CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User *user)
27 c = ServerInstance->FindChan(parameters[0]);
30 user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str());
34 if (parameters.size() == 1)
38 if ((c->IsModeSet('s')) && (!c->HasUser(user)))
40 user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str());
44 if (c->topic.length())
46 user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), c->name.c_str(), c->topic.c_str());
47 user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset);
51 user->WriteNumeric(331, "%s %s :No topic is set.", user->nick.c_str(), c->name.c_str());
56 else if (parameters.size()>1)
58 std::string t = parameters[1]; // needed, in case a module wants to change it