]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/utils.h
m_spanningtree Remove duplicate code for sending channel messages from RouteCommand()
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / utils.h
index f65b07c436c755d5fd0384a137aff3fb925bb87d..345b62b099b3c9edb8872eff781d516ed95814cb 100644 (file)
@@ -40,8 +40,6 @@ extern SpanningTreeUtilities* Utils;
  */
 typedef TR1NS::unordered_map<std::string, TreeServer*, irc::insensitive, irc::StrHashComp> server_hash;
 
-typedef std::set<TreeServer*> TreeServerList;
-
 /** Contains helper functions and variables for this module,
  * and keeps them out of the global namespace
  */
@@ -54,6 +52,8 @@ class SpanningTreeUtilities : public classbase
        CacheRefreshTimer RefreshTimer;
 
  public:
+       typedef std::set<TreeSocket*> TreeSocketSet;
+
        /** Creator module
         */
        ModuleSpanningTree* Creator;
@@ -134,11 +134,11 @@ class SpanningTreeUtilities : public classbase
 
        /** Send a message from this server to all but one other, local or remote
         */
-       bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist& params, const std::string& omit);
+       void DoOneToAllButSender(const std::string& prefix, const std::string& command, const parameterlist& params, TreeServer* omit);
 
        /** Send a message from this server to all others
         */
-       bool DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist &params);
+       void DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist &params);
 
        /** Read the spanningtree module's tags from the config file
         */
@@ -150,7 +150,7 @@ class SpanningTreeUtilities : public classbase
 
        /** Compile a list of servers which contain members of channel c
         */
-       void GetListOfServersForChannel(Channel* c, TreeServerList &list, char status, const CUList &exempt_list);
+       void GetListOfServersForChannel(Channel* c, TreeSocketSet& list, char status, const CUList& exempt_list);
 
        /** Find a server by name
         */
@@ -178,5 +178,10 @@ class SpanningTreeUtilities : public classbase
 
        /** 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);
+       void SendChannelMessage(const std::string& prefix, Channel* target, const std::string& text, char status, const CUList& exempt_list, const char* message_type, TreeSocket* omit = NULL);
 };
+
+inline void SpanningTreeUtilities::DoOneToMany(const std::string& prefix, const std::string& command, const parameterlist& params)
+{
+       DoOneToAllButSender(prefix, command, params, NULL);
+}