1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
17 #include "m_spanningtree/treesocket.h"
18 #include "m_spanningtree/treeserver.h"
19 #include "m_spanningtree/utils.h"
21 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
25 bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> ¶ms)
27 if (params.size() != 4)
29 time_t ts = atoi(params[1].c_str());
30 Channel* c = this->ServerInstance->FindChan(params[0]);
33 if ((ts >= c->topicset) || (c->topic.empty()))
35 if (c->topic != params[3])
37 User* user = this->ServerInstance->FindNick(source);
38 // Update topic only when it differs from current topic
39 c->topic.assign(params[3], 0, ServerInstance->Config->Limits.MaxTopic);
42 c->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
46 c->WriteChannel(user, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
50 // Always update setter and settime.
51 c->setby.assign(params[2], 0, 127);
54 /* all done, send it on its way */
55 params[3] = ":" + params[3];
56 Utils->DoOneToAllButSender(source,"FTOPIC",params,source);