]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_watch.cpp
(Bigger than it looks, i did this with perl inplace edit) -- commands now take an...
[user/henk/code/inspircd.git] / src / modules / m_watch.cpp
index 2ba9c9afb1bc1c2964be5d830d55a85d9c3013d5..5b911632c580df557a1c71a87145c08f3bb86515 100644 (file)
@@ -28,7 +28,8 @@ using namespace std;
 
 /* $ModDesc: Provides support for the /watch command */
 
-static Server *Srv;
+
+extern InspIRCd* ServerInstance;
 
 class watchentry : public classbase
 {
@@ -43,7 +44,7 @@ watchlist watches;
 class cmd_watch : public command_t
 {
  public:
      cmd_watch() : command_t("WATCH",0,0)
cmd_watch (InspIRCd* Instance) : command_t(Instance,"WATCH",0,0)
        {
                this->source = "m_watch.so";
                syntax = "[C|L|S]|[+|-<nick>]";
@@ -58,7 +59,7 @@ class cmd_watch : public command_t
                                watchentry* a = (watchentry*)(*q);
                                if (a->watcher == user)
                                {
-                                       userrec* targ = Srv->FindNick(a->target);
+                                       userrec* targ = ServerInstance->FindNick(a->target);
                                        if (targ)
                                        {
                                                user->WriteServ("604 %s %s %s %s %lu :is online",user->nick,targ->nick,targ->ident,targ->dhost,targ->age);
@@ -99,7 +100,7 @@ class cmd_watch : public command_t
                                                watchentry* a = (watchentry*)(*q);
                                                if (a->watcher == user)
                                                {
-                                                       userrec* targ = Srv->FindNick(a->target);
+                                                       userrec* targ = ServerInstance->FindNick(a->target);
                                                        if (targ)
                                                        {
                                                                user->WriteServ("604 %s %s %s %s %lu :is online",user->nick,targ->nick,targ->ident,targ->dhost,targ->age);
@@ -136,7 +137,7 @@ class cmd_watch : public command_t
                                                if (b->watcher == user)
                                                {
                                                        irc::string n2 = b->target.c_str();
-                                                       userrec* a = Srv->FindNick(b->target);
+                                                       userrec* a = ServerInstance->FindNick(b->target);
                                                        if (a)
                                                        {
                                                                user->WriteServ("602 %s %s %s %s %lu :stopped watching",user->nick,a->nick,a->ident,a->dhost,a->age);
@@ -180,7 +181,7 @@ class cmd_watch : public command_t
                                                watches.push_back(w);
                                                log(DEBUG,"*** Added %s to watchlist of %s",nick,user->nick);
                                        }
-                                       userrec* a = Srv->FindNick(nick);
+                                       userrec* a = ServerInstance->FindNick(nick);
                                        if (a)
                                        {
                                                user->WriteServ("604 %s %s %s %s %lu :is online",user->nick,a->nick,a->ident,a->dhost,a->age);
@@ -201,12 +202,12 @@ class Modulewatch : public Module
        cmd_watch* mycommand;
  public:
 
-       Modulewatch(Server* Me)
+       Modulewatch(InspIRCd* Me)
                : Module::Module(Me)
        {
-               Srv = Me;
-               mycommand = new cmd_watch();
-               Srv->AddCommand(mycommand);
+               
+               mycommand = new cmd_watch(ServerInstance);
+               ServerInstance->AddCommand(mycommand);
        }
 
        void Implements(char* List)
@@ -314,7 +315,7 @@ class ModulewatchFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule(Server* Me)
+       virtual Module * CreateModule(InspIRCd* Me)
        {
                return new Modulewatch(Me);
        }