]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_watch.cpp
Add initial query support to m_mysql [patch by Athenon]
[user/henk/code/inspircd.git] / src / modules / m_watch.cpp
index 9b98ca83badedc4b958e6ab5f3301e89b55b1b08..1cda4484fd6820149783c20e6dc558cceeead89b 100644 (file)
@@ -103,9 +103,8 @@ watchentries* whos_watching_me;
 class CommandSVSWatch : public Command
 {
  public:
-       CommandSVSWatch (InspIRCd* Instance) : Command(Instance,"SVSWATCH", 0, 2)
+       CommandSVSWatch (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSWATCH", 0, 2)
        {
-               this->source = "m_watch.so";
                syntax = "<target> [C|L|S]|[+|-<nick>]";
                TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
        }
@@ -227,13 +226,6 @@ class CommandWatch : public Command
                        User* target = ServerInstance->FindNick(nick);
                        if (target)
                        {
-                               if (target->Visibility && !target->Visibility->VisibleTo(user))
-                               {
-                                       (*wl)[nick] = "";
-                                       user->WriteNumeric(605, "%s %s * * 0 :is offline",user->nick.c_str(), nick);
-                                       return CMD_FAILURE;
-                               }
-
                                (*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age));
                                user->WriteNumeric(604, "%s %s %s :is online",user->nick.c_str(), nick, (*wl)[nick].c_str());
                                if (IS_AWAY(target))
@@ -251,9 +243,8 @@ class CommandWatch : public Command
                return CMD_LOCALONLY;
        }
 
-       CommandWatch (InspIRCd* Instance, unsigned int &maxwatch) : Command(Instance,"WATCH",0,0), MAX_WATCH(maxwatch)
+       CommandWatch (InspIRCd* Instance, Module* parent, unsigned int &maxwatch) : Command(Instance,parent,"WATCH",0,0), MAX_WATCH(maxwatch)
        {
-               this->source = "m_watch.so";
                syntax = "[C|L|S]|[+|-<nick>]";
                TRANSLATE2(TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
        }
@@ -373,7 +364,7 @@ class Modulewatch : public Module
 
  public:
        Modulewatch(InspIRCd* Me)
-               : Module(Me), maxwatch(32), cmdw(Me, maxwatch), sw(Me)
+               : Module(Me), maxwatch(32), cmdw(Me, this, maxwatch), sw(Me,this) 
        {
                OnRehash(NULL);
                whos_watching_me = new watchentries();
@@ -391,7 +382,7 @@ class Modulewatch : public Module
                        maxwatch = 32;
        }
 
-       virtual int OnSetAway(User *user, const std::string &awaymsg)
+       virtual ModResult OnSetAway(User *user, const std::string &awaymsg)
        {
                std::string numeric;
                int inum;
@@ -412,12 +403,11 @@ class Modulewatch : public Module
                {
                        for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++)
                        {
-                               if (!user->Visibility || user->Visibility->VisibleTo(user))
-                                       (*n)->WriteNumeric(inum, numeric);
+                               (*n)->WriteNumeric(inum, numeric);
                        }
                }
 
-               return 0;
+               return MOD_RES_PASSTHRU;
        }
 
        virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
@@ -427,8 +417,7 @@ class Modulewatch : public Module
                {
                        for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++)
                        {
-                               if (!user->Visibility || user->Visibility->VisibleTo(*n))
-                                       (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str() ,user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) ServerInstance->Time());
+                               (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str() ,user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) ServerInstance->Time());
 
                                watchlist* wl;
                                if ((*n)->GetExt("watchlist", wl))
@@ -498,8 +487,7 @@ class Modulewatch : public Module
                {
                        for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++)
                        {
-                               if (!user->Visibility || user->Visibility->VisibleTo(*n))
-                                       (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age);
+                               (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age);
 
                                watchlist* wl;
                                if ((*n)->GetExt("watchlist", wl))
@@ -521,8 +509,7 @@ class Modulewatch : public Module
                                watchlist* wl;
                                if ((*n)->GetExt("watchlist", wl))
                                {
-                                       if (!user->Visibility || user->Visibility->VisibleTo(*n))
-                                               (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str(), oldnick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age);
+                                       (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str(), oldnick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age);
                                        (*wl)[oldnick.c_str()] = "";
                                }
                        }
@@ -536,8 +523,7 @@ class Modulewatch : public Module
                                if ((*n)->GetExt("watchlist", wl))
                                {
                                        (*wl)[user->nick.c_str()] = std::string(user->ident).append(" ").append(user->dhost).append(" ").append(ConvToStr(user->age));
-                                       if (!user->Visibility || user->Visibility->VisibleTo(*n))
-                                               (*n)->WriteNumeric(600, "%s %s %s :arrived online", (*n)->nick.c_str(), user->nick.c_str(), (*wl)[user->nick.c_str()].c_str());
+                                       (*n)->WriteNumeric(600, "%s %s %s :arrived online", (*n)->nick.c_str(), user->nick.c_str(), (*wl)[user->nick.c_str()].c_str());
                                }
                        }
                }