From 567135a702979c714a89b7fc986f929ea810ad07 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 30 Nov 2005 12:15:34 +0000 Subject: Added ForceTopic stuff git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2046 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 63f9a487f..46683202d 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -449,6 +449,36 @@ class TreeSocket : public InspSocket return true; } + bool ForceTopic(std::string source, std::deque params) + { + // FTOPIC %s %lu %s :%s + if (params.size() != 4) + return true; + std::string channel = params[0]; + time_t ts = atoi(params[1].c_str()); + std::string setby = params[2]; + std::string topic = params[3]; + + chanrec* c = Srv->FindChannel(channel); + if (c) + { + if ((ts >= c->topicset) || (!*c->topic)) + { + strlcpy(c->topic,topic.c_str(),MAXTOPIC); + strlcpy(c->setby,setby.c_str(),NICKMAX); + c->topicset = ts; + WriteChannelWithServ(source.c_str(), c, "TOPIC %s :%s", c->name, c->topic) + } + + } + + // all done, send it on its way + params[3] = ":" + params[3]; + DoOneToAllButSender(source,"FTOPIC",params,source); + + return true; + } + bool ForceJoin(std::string source, std::deque params) { if (params.size() < 1) @@ -942,6 +972,10 @@ class TreeSocket : public InspSocket { return this->RemoteKill(prefix,params); } + else if (command == "FTOPIC") + { + return this->ForceTopic(prefix,params); + } else if (command == "SQUIT") { if (params.size() == 2) @@ -1344,6 +1378,10 @@ class ModuleSpanningTree : public Module virtual void OnPostLocalTopicChange(userrec* user, chanrec* chan, std::string topic) { + std::deque params; + params.push_back(chan->name); + params.push_back(":"+topic); + DoOneToMany(user->nick,"TOPIC",params); } virtual void OnUserNotice(userrec* user, void* dest, int target_type, std::string text) -- cgit v1.2.3