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 * ---------------------------------------------------
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 std::string nsource = source;
31 Channel* c = this->Instance->FindChan(params[0]);
34 if ((ts >= c->topicset) || (!*c->topic))
36 std::string oldtopic = c->topic;
37 strlcpy(c->topic,params[3].c_str(),MAXTOPIC);
38 strlcpy(c->setby,params[2].c_str(),127);
40 /* if the topic text is the same as the current topic,
41 * dont bother to send the TOPIC command out, just silently
42 * update the set time and set nick.
44 if (oldtopic != params[3])
46 User* user = this->Instance->FindNick(source);
49 c->WriteChannelWithServ(Instance->Config->ServerName, "TOPIC %s :%s", c->name, c->topic);
53 c->WriteChannel(user, "TOPIC %s :%s", c->name, c->topic);
54 nsource = user->server;
58 /* all done, send it on its way */
59 params[3] = ":" + params[3];
60 Utils->DoOneToAllButSender(source,"FTOPIC",params,nsource);