ftopic.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "inspircd.h"
00015 #include "xline.h"
00016
00017 #include "m_spanningtree/treesocket.h"
00018 #include "m_spanningtree/treeserver.h"
00019 #include "m_spanningtree/utils.h"
00020
00021
00022
00023
00025 bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> ¶ms)
00026 {
00027 if (params.size() != 4)
00028 return true;
00029 time_t ts = atoi(params[1].c_str());
00030 Channel* c = this->ServerInstance->FindChan(params[0]);
00031 if (c)
00032 {
00033 if ((ts >= c->topicset) || (c->topic.empty()))
00034 {
00035 if (c->topic != params[3])
00036 {
00037 User* user = this->ServerInstance->FindNick(source);
00038
00039 c->topic.assign(params[3], 0, ServerInstance->Config->Limits.MaxTopic);
00040 if (!user)
00041 {
00042 c->WriteChannelWithServ(ServerInstance->Config->ServerName, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
00043 }
00044 else
00045 {
00046 c->WriteChannel(user, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
00047 }
00048 }
00049
00050
00051 c->setby.assign(params[2], 0, 127);
00052 c->topicset = ts;
00053
00054
00055 params[3] = ":" + params[3];
00056 Utils->DoOneToAllButSender(source,"FTOPIC",params,source);
00057 }
00058
00059 }
00060 return true;
00061 }
00062