From b56565eac2d7207c88c53054cb1096519ec7fba9 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 8 Apr 2011 03:48:43 -0400 Subject: Fixed Windows build on VS 2010 --- src/modules/m_spanningtree/idle.cpp | 78 ++++++++++++++++++++++++++++++++++++ src/modules/m_spanningtree/link.h | 1 - src/modules/m_spanningtree/whois.cpp | 78 ------------------------------------ 3 files changed, 78 insertions(+), 79 deletions(-) create mode 100644 src/modules/m_spanningtree/idle.cpp delete mode 100644 src/modules/m_spanningtree/whois.cpp (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp new file mode 100644 index 000000000..59dc83985 --- /dev/null +++ b/src/modules/m_spanningtree/idle.cpp @@ -0,0 +1,78 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2010 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" +#include "socket.h" +#include "xline.h" +#include "socketengine.h" + +#include "main.h" +#include "utils.h" +#include "treeserver.h" +#include "treesocket.h" + +bool TreeSocket::Whois(const std::string &prefix, parameterlist ¶ms) +{ + if (params.size() < 1) + return true; + User* u = ServerInstance->FindNick(prefix); + if (u) + { + // an incoming request + if (params.size() == 1) + { + User* x = ServerInstance->FindNick(params[0]); + if ((x) && (IS_LOCAL(x))) + { + long idle = abs((long)((x->idle_lastmsg) - ServerInstance->Time())); + parameterlist par; + par.push_back(prefix); + par.push_back(ConvToStr(x->signon)); + par.push_back(ConvToStr(idle)); + // ours, we're done, pass it BACK + Utils->DoOneToOne(params[0], "IDLE", par, u->server); + } + else + { + // not ours pass it on + if (x) + Utils->DoOneToOne(prefix, "IDLE", params, x->server); + } + } + else if (params.size() == 3) + { + std::string who_did_the_whois = params[0]; + User* who_to_send_to = ServerInstance->FindNick(who_did_the_whois); + if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) + { + // an incoming reply to a whois we sent out + std::string nick_whoised = prefix; + unsigned long signon = atoi(params[1].c_str()); + unsigned long idle = atoi(params[2].c_str()); + if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) + { + ServerInstance->DoWhois(who_to_send_to, u, signon, idle, nick_whoised.c_str()); + } + } + else + { + // not ours, pass it on + if (who_to_send_to) + Utils->DoOneToOne(prefix, "IDLE", params, who_to_send_to->server); + } + } + } + return true; +} + + diff --git a/src/modules/m_spanningtree/link.h b/src/modules/m_spanningtree/link.h index 0ff2593cc..c60cb0bb7 100644 --- a/src/modules/m_spanningtree/link.h +++ b/src/modules/m_spanningtree/link.h @@ -45,5 +45,4 @@ class Autoconnect : public refcountbase Autoconnect(ConfigTag* Tag) : tag(Tag) {} }; - #endif diff --git a/src/modules/m_spanningtree/whois.cpp b/src/modules/m_spanningtree/whois.cpp deleted file mode 100644 index 59dc83985..000000000 --- a/src/modules/m_spanningtree/whois.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" -#include "socket.h" -#include "xline.h" -#include "socketengine.h" - -#include "main.h" -#include "utils.h" -#include "treeserver.h" -#include "treesocket.h" - -bool TreeSocket::Whois(const std::string &prefix, parameterlist ¶ms) -{ - if (params.size() < 1) - return true; - User* u = ServerInstance->FindNick(prefix); - if (u) - { - // an incoming request - if (params.size() == 1) - { - User* x = ServerInstance->FindNick(params[0]); - if ((x) && (IS_LOCAL(x))) - { - long idle = abs((long)((x->idle_lastmsg) - ServerInstance->Time())); - parameterlist par; - par.push_back(prefix); - par.push_back(ConvToStr(x->signon)); - par.push_back(ConvToStr(idle)); - // ours, we're done, pass it BACK - Utils->DoOneToOne(params[0], "IDLE", par, u->server); - } - else - { - // not ours pass it on - if (x) - Utils->DoOneToOne(prefix, "IDLE", params, x->server); - } - } - else if (params.size() == 3) - { - std::string who_did_the_whois = params[0]; - User* who_to_send_to = ServerInstance->FindNick(who_did_the_whois); - if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) - { - // an incoming reply to a whois we sent out - std::string nick_whoised = prefix; - unsigned long signon = atoi(params[1].c_str()); - unsigned long idle = atoi(params[2].c_str()); - if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) - { - ServerInstance->DoWhois(who_to_send_to, u, signon, idle, nick_whoised.c_str()); - } - } - else - { - // not ours, pass it on - if (who_to_send_to) - Utils->DoOneToOne(prefix, "IDLE", params, who_to_send_to->server); - } - } - } - return true; -} - - -- cgit v1.2.3