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 "treesocket.h"
18 #include "treeserver.h"
21 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
25 bool TreeSocket::ForceTopic(const std::string &source, parameterlist ¶ms)
27 if (params.size() != 4)
29 time_t ts = atoi(params[1].c_str());
30 Channel* c = ServerInstance->FindChan(params[0]);
33 if ((ts >= c->topicset) || (c->topic.empty()))
35 if (c->topic != params[3])
37 User* user = 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 std::string sourceserv = Utils->FindServer(source)->GetName();
43 c->WriteChannelWithServ(sourceserv.c_str(), "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
47 c->WriteChannel(user, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
51 // Always update setter and settime.
52 c->setby.assign(params[2], 0, 127);
55 /* all done, send it on its way */
56 params[3] = ":" + params[3];
57 Utils->DoOneToAllButSender(source,"FTOPIC",params,source);