]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_watch.cpp
Include explicit routing information in Command, will replace CMD_LOCALONLY return...
[user/henk/code/inspircd.git] / src / modules / m_watch.cpp
index 42a4b8705ef7a7a93cdcf6bfb92c3df51999306f..9b98ca83badedc4b958e6ab5f3301e89b55b1b08 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  * Before you start screaming, this definition is only used here, so moving it to a header is pointless.
  * Yes, it's horrid. Blame cl for being different. -- w00t
  */
-#ifdef WINDOWS
-typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash_compare<irc::string, std::less<irc::string> > > watchentries;
+#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
+       typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash_compare<irc::string, std::less<irc::string> > > watchentries;
 #else
-typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash<irc::string> > watchentries;
+       typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash<irc::string> > watchentries;
 #endif
 typedef std::map<irc::string, std::string> watchlist;
 
@@ -183,11 +183,7 @@ class CommandWatch : public Command
                        }
                }
 
-               /* This might seem confusing, but we return CMD_FAILURE
-                * to indicate that this message shouldnt be routed across
-                * the network to other linked servers.
-                */
-               return CMD_FAILURE;
+               return CMD_LOCALONLY;
        }
 
        CmdResult add_watch(User* user, const char* nick)
@@ -252,7 +248,7 @@ class CommandWatch : public Command
                        }
                }
 
-               return CMD_FAILURE;
+               return CMD_LOCALONLY;
        }
 
        CommandWatch (InspIRCd* Instance, unsigned int &maxwatch) : Command(Instance,"WATCH",0,0), MAX_WATCH(maxwatch)
@@ -365,32 +361,29 @@ class CommandWatch : public Command
                                }
                        }
                }
-               /* So that spanningtree doesnt pass the WATCH commands to the network! */
-               return CMD_FAILURE;
+               return CMD_LOCALONLY;
        }
 };
 
 class Modulewatch : public Module
 {
-       CommandWatch* mycommand;
-       CommandSVSWatch *sw;
        unsigned int maxwatch;
+       CommandWatch cmdw;
+       CommandSVSWatch sw;
 
  public:
        Modulewatch(InspIRCd* Me)
-               : Module(Me), maxwatch(32)
+               : Module(Me), maxwatch(32), cmdw(Me, maxwatch), sw(Me)
        {
-               OnRehash(NULL, "");
+               OnRehash(NULL);
                whos_watching_me = new watchentries();
-               mycommand = new CommandWatch(ServerInstance, maxwatch);
-               ServerInstance->AddCommand(mycommand);
-               sw = new CommandSVSWatch(ServerInstance);
-               ServerInstance->AddCommand(sw);
+               ServerInstance->AddCommand(&cmdw);
+               ServerInstance->AddCommand(&sw);
                Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
                ServerInstance->Modules->Attach(eventlist, this, 8);
        }
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ConfigReader Conf(ServerInstance);
                maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true);