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_filter.cpp | 7 +++- src/modules/m_spanningtree/idle.cpp | 78 ++++++++++++++++++++++++++++++++++++ src/modules/m_spanningtree/link.h | 1 - src/modules/m_spanningtree/whois.cpp | 78 ------------------------------------ src/modules/m_watch.cpp | 2 +- 5 files changed, 84 insertions(+), 82 deletions(-) create mode 100644 src/modules/m_spanningtree/idle.cpp delete mode 100644 src/modules/m_spanningtree/whois.cpp (limited to 'src/modules') diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 69117ae55..e4b2645f9 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -165,7 +165,8 @@ CmdResult CommandFilter::Handle(const std::vector ¶meters, User if (parameters.size() == 1) { /* Deleting a filter */ - if (static_cast(*creator).DeleteFilter(parameters[0])) + Module *me = creator; + if (static_cast(me)->DeleteFilter(parameters[0])) { user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str()); ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'"); @@ -212,7 +213,9 @@ CmdResult CommandFilter::Handle(const std::vector ¶meters, User { reason = parameters[3]; } - std::pair result = static_cast(*creator).AddFilter(freeform, type, reason, duration, flags); + + Module *me = creator; + std::pair result = static_cast(me)->AddFilter(freeform, type, reason, duration, flags); if (result.first) { user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(), 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; -} - - diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 78da2799b..9a9e12bb1 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -90,7 +90,7 @@ #if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED) typedef nspace::hash_map, nspace::hash_compare > > watchentries; #else - typedef nspace::hash_map, nspace::hash > watchentries; + typedef nspace::hash_map, irc::hash> watchentries; #endif typedef std::map watchlist; -- cgit v1.2.3