summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp2
-rw-r--r--src/modules/m_spanningtree.cpp38
2 files changed, 39 insertions, 1 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 205528be8..518ecd71e 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -525,7 +525,7 @@ void handle_topic(char **parameters, int pcnt, userrec *user)
return;
}
- strlcpy(Ptr->topic,topic,MAXBUF);
+ strlcpy(Ptr->topic,topic,MAXTOPIC);
strlcpy(Ptr->setby,user->nick,NICKMAX);
Ptr->topicset = TIME;
WriteChannel(Ptr,user,"TOPIC %s :%s",Ptr->name, Ptr->topic);
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)