summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-30 12:15:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-30 12:15:34 +0000
commit567135a702979c714a89b7fc986f929ea810ad07 (patch)
tree0e27262f76c8042c9a3e8952da3496d3c9a8ad14 /src/modules
parentf7eb967d964cc089e5c7dc14079b03904e2f5a05 (diff)
Added ForceTopic stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2046 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree.cpp38
1 files changed, 38 insertions, 0 deletions
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<std::string> 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<std::string> 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<std::string> 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)