]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_watch.cpp
Fix IPv6 cloaking in compatability mode (was using the wrong xtab confusor)
[user/henk/code/inspircd.git] / src / modules / m_watch.cpp
index ab32c674047ba31f5ccc2bb58019e9d019d0f16d..78da2799b9961e067634964870854fde6bbb8de4 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -103,7 +103,7 @@ watchentries* whos_watching_me;
 class CommandSVSWatch : public Command
 {
  public:
-       CommandSVSWatch (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSWATCH", 0, 2)
+       CommandSVSWatch(Module* Creator) : Command(Creator,"SVSWATCH", 2)
        {
                syntax = "<target> [C|L|S]|[+|-<nick>]";
                TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
@@ -128,7 +128,10 @@ class CommandSVSWatch : public Command
 
        RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
        {
-               return ROUTE_BROADCAST;
+               User* target = ServerInstance->FindNick(parameters[0]);
+               if (target)
+                       return ROUTE_OPT_UCAST(target->server);
+               return ROUTE_LOCALONLY;
        }
 };
 
@@ -248,8 +251,7 @@ class CommandWatch : public Command
                return CMD_SUCCESS;
        }
 
-       CommandWatch (InspIRCd* Instance, Module* parent, unsigned int &maxwatch)
-               : Command(Instance,parent,"WATCH",0,0), MAX_WATCH(maxwatch), ext("watchlist", parent)
+       CommandWatch(Module* parent, unsigned int &maxwatch) : Command(parent,"WATCH", 0), MAX_WATCH(maxwatch), ext("watchlist", parent)
        {
                syntax = "[C|L|S]|[+|-<nick>]";
                TRANSLATE2(TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
@@ -368,21 +370,21 @@ class Modulewatch : public Module
        CommandSVSWatch sw;
 
  public:
-       Modulewatch(InspIRCd* Me)
-               : Module(Me), maxwatch(32), cmdw(Me, this, maxwatch), sw(Me,this) 
+       Modulewatch()
+               : maxwatch(32), cmdw(this, maxwatch), sw(this) 
        {
                OnRehash(NULL);
                whos_watching_me = new watchentries();
                ServerInstance->AddCommand(&cmdw);
                ServerInstance->AddCommand(&sw);
-               Extensible::Register(&cmdw.ext);
-               Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
-               ServerInstance->Modules->Attach(eventlist, this, 8);
+               ServerInstance->Extensions.Register(&cmdw.ext);
+               Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
+               ServerInstance->Modules->Attach(eventlist, this, 7);
        }
 
        virtual void OnRehash(User* user)
        {
-               ConfigReader Conf(ServerInstance);
+               ConfigReader Conf;
                maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true);
                if (!maxwatch)
                        maxwatch = 32;
@@ -529,7 +531,7 @@ class Modulewatch : public Module
 
        virtual Version GetVersion()
        {
-               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("Provides support for the /WATCH command", VF_OPTCOMMON | VF_VENDOR);
        }
 };