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_whois.h"
16 #include "commands/cmd_stats.h"
20 #include "transport.h"
22 #include "socketengine.h"
24 #include "m_spanningtree/main.h"
25 #include "m_spanningtree/utils.h"
26 #include "m_spanningtree/treeserver.h"
27 #include "m_spanningtree/link.h"
28 #include "m_spanningtree/treesocket.h"
29 #include "m_spanningtree/resolvers.h"
30 #include "m_spanningtree/handshaketimer.h"
32 /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_hash.h */
35 bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> ¶ms)
37 if (params.size() != 4)
39 time_t ts = atoi(params[1].c_str());
40 std::string nsource = source;
41 Channel* c = this->Instance->FindChan(params[0]);
44 if ((ts >= c->topicset) || (!*c->topic))
46 std::string oldtopic = c->topic;
47 strlcpy(c->topic,params[3].c_str(),MAXTOPIC);
48 strlcpy(c->setby,params[2].c_str(),127);
50 /* if the topic text is the same as the current topic,
51 * dont bother to send the TOPIC command out, just silently
52 * update the set time and set nick.
54 if (oldtopic != params[3])
56 User* user = this->Instance->FindNick(source);
59 c->WriteChannelWithServ(Instance->Config->ServerName, "TOPIC %s :%s", c->name, c->topic);
63 c->WriteChannel(user, "TOPIC %s :%s", c->name, c->topic);
64 nsource = user->server;
68 /* all done, send it on its way */
69 params[3] = ":" + params[3];
70 Utils->DoOneToAllButSender(source,"FTOPIC",params,nsource);