summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-11 17:51:06 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-11 17:51:06 +0000
commitcf2b0d0e480c5b88dddf8905101815161e33f0da (patch)
tree45d79093836506a0ad4157c55cbec8ec383d241f /src
parent26704bd222c52995bd1d23be50ac40022f88d57a (diff)
Added remote TIME (do not use yet)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3156 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index d2e583d39..2577bdb18 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1690,6 +1690,45 @@ class TreeSocket : public InspSocket
}
return true;
}
+
+ bool Time(std::string prefix, std::deque<std::string> &params)
+ {
+ // :source.server TIME remote.server sendernick
+ // :remote.server TIME source.server sendernick TS
+ if (params.size() == 2)
+ {
+ // someone querying our time?
+ if (Srv->MatchText(Srv->GetServerName(),params[0]))
+ {
+ userrec* u = Srv->FindNick(params[1]);
+ if (u)
+ {
+ char curtime[256];
+ snprintf(curtime,256,"%lu",(unsigned long)time(NULL));
+ params.push_back(curtime);
+ params[0] = prefix;
+ DoOneToOne(Srv->GetServerName(),"TIME",params,u->server);
+ }
+ }
+ }
+ else if (params.size() == 3)
+ {
+ // a response to a previous TIME
+ userrec* u = Srv->FindNick(params[1]);
+ if ((u) && (IS_LOCAL(u)))
+ {
+ time_t rawtime = atol(params[2]);
+ struct tm * timeinfo;
+ timeinfo = localtime(&rawtime);
+ WriteServ(u->fd,"391 %s %s :%s",u->nick,source,asctime(timeinfo));
+ }
+ else
+ {
+ DoOneToOne(source,"TIME",params,u->server);
+ }
+ }
+ return true;
+ }
bool LocalPing(std::string prefix, std::deque<std::string> &params)
{
@@ -2144,6 +2183,10 @@ class TreeSocket : public InspSocket
{
return this->Push(prefix,params);
}
+ else if (command == "TIME")
+ {
+ return this->Time(prefix,params);
+ }
else if (command == "SVSJOIN")
{
if (prefix == "")