X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Futils.h;h=36c161287932e2ecb72ff3116a2eaeccd34774bd;hb=e9e75e50bc25e67af22dd88b39b12217a553d5cb;hp=eb0df03ffe22cbe5296ea2a1851b519fc00e5674;hpb=cd712c40e1b352c05e7ae0f72e0a5e84cdf64323;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index eb0df03ff..36c161287 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -1,18 +1,26 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2008 Robin Burchell + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2007 Craig Edwards * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ -#ifndef __ST__UTIL__ -#define __ST__UTIL__ + +#pragma once #include "inspircd.h" @@ -27,23 +35,19 @@ class SpanningTreeUtilities; /* This hash_map holds the hash equivalent of the server * tree, used for rapid linear lookups. */ -#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED) - typedef nspace::hash_map > > server_hash; -#else - #ifdef HASHCOMP_DEPRECATED - typedef nspace::hash_map server_hash; - #else - typedef nspace::hash_map, irc::StrHashComp> server_hash; - #endif -#endif - -typedef std::map TreeServerList; +typedef TR1NS::unordered_map server_hash; + +typedef std::set TreeServerList; /** Contains helper functions and variables for this module, * and keeps them out of the global namespace */ class SpanningTreeUtilities : public classbase { + /** Creates a line in the : [] format + */ + std::string ConstructLine(const std::string& prefix, const std::string& command, const parameterlist& params); + public: /** Creator module */ @@ -124,36 +128,20 @@ class SpanningTreeUtilities : public classbase /** Send a message from this server to one other local or remote */ - bool DoOneToOne(const std::string &prefix, const std::string &command, parameterlist ¶ms, std::string target); + bool DoOneToOne(const std::string& prefix, const std::string& command, const parameterlist& params, const std::string& target); /** Send a message from this server to all but one other, local or remote */ - bool DoOneToAllButSender(const std::string &prefix, const std::string &command, parameterlist ¶ms, std::string omit); - - /** Send a message from this server to all but one other, local or remote - */ - bool DoOneToAllButSender(const char* prefix, const char* command, parameterlist ¶ms, std::string omit); - - /** Send a message from this server to all others - */ - bool DoOneToMany(const std::string &prefix, const std::string &command, parameterlist ¶ms); + bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist& params, const std::string& omit); /** Send a message from this server to all others */ - bool DoOneToMany(const char* prefix, const char* command, parameterlist ¶ms); - - /** Send a message from this server to all others, without doing any processing on the command (e.g. send it as-is with colons and all) - */ - bool DoOneToAllButSenderRaw(const std::string &data, const std::string &omit, const std::string &prefix, const irc::string &command, parameterlist ¶ms); + bool DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist ¶ms); /** Read the spanningtree module's tags from the config file */ void ReadConfiguration(); - /** Add a server to the server list for GetListOfServersForChannel - */ - void AddThisServer(TreeServer* server, TreeServerList &list); - /** Compile a list of servers which contain members of channel c */ void GetListOfServersForChannel(Channel* c, TreeServerList &list, char status, const CUList &exempt_list); @@ -174,10 +162,6 @@ class SpanningTreeUtilities : public classbase */ TreeServer* FindServerMask(const std::string &ServerName); - /** Returns true if this is a server name we recognise - */ - bool IsServer(const std::string &ServerName); - /** Find a link tag from a server name */ Link* FindLink(const std::string& name); @@ -185,6 +169,8 @@ class SpanningTreeUtilities : public classbase /** Refresh the IP cache used for allowing inbound connections */ void RefreshIPCache(); -}; -#endif + /** Sends a PRIVMSG or a NOTICE to a channel obeying an exempt list and an optional prefix + */ + void SendChannelMessage(const std::string& prefix, Channel* target, const std::string &text, char status, const CUList& exempt_list, const char* message_type); +};