+
+ bool Push(std::string prefix, std::deque<std::string> ¶ms)
+ {
+ if (params.size() < 2)
+ return true;
+ userrec* u = Srv->FindNick(params[0]);
+ if (IS_LOCAL(u))
+ {
+ // push the raw to the user
+ if (Srv->IsUlined(prefix))
+ {
+ ::Write(u->fd,"%s",params[1].c_str());
+ }
+ else
+ {
+ log(DEBUG,"PUSH from non-ulined server dropped into the bit-bucket: :%s PUSH %s :%s",prefix.c_str(),params[0].c_str(),params[1].c_str());
+ }
+ }
+ else
+ {
+ // continue the raw onwards
+ params[1] = ":" + params[1];
+ DoOneToOne(prefix,"PUSH",params,u->server);
+ }
+ return true;
+ }
+
+ bool Time(std::string prefix, std::deque<std::string> ¶ms)
+ {
+ // :source.server TIME remote.server sendernick
+ // :remote.server TIME source.server sendernick TS
+ if (params.size() == 2)
+ {
+ // someone querying our time?
+ if (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,params[0]);
+ }
+ }
+ else
+ {
+ // not us, pass it on
+ userrec* u = Srv->FindNick(params[1]);
+ if (u)
+ DoOneToOne(prefix,"TIME",params,params[0]);
+ }
+ }
+ 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].c_str());
+ struct tm * timeinfo;
+ timeinfo = localtime(&rawtime);
+ char tms[26];
+ snprintf(tms,26,"%s",asctime(timeinfo));
+ tms[24] = 0;
+ WriteServ(u->fd,"391 %s %s :%s",u->nick,prefix.c_str(),tms);
+ }
+ else
+ {
+ if (u)
+ DoOneToOne(prefix,"TIME",params,u->server);
+ }
+ }
+ return true;
+ }