]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_watch.cpp
Fix previous module mismatch message; "remote" is misleading when sent as an ERROR
[user/henk/code/inspircd.git] / src / modules / m_watch.cpp
index 71e651736fa618fe438868e1035810640390c5e7..cfa8e038b3f9f1ab3507d9510ecd4fc31d92d5bc 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -162,7 +162,7 @@ class CommandWatch : public Command
                                wl->erase(n);
                        }
 
-                       if (!wl->size())
+                       if (wl->empty())
                        {
                                user->Shrink("watchlist");
                                delete wl;
@@ -177,16 +177,13 @@ class CommandWatch : public Command
                                        /* I'm no longer watching you... */
                                        x->second.erase(n2);
 
-                               if (!x->second.size())
+                               if (x->second.empty())
+                                       /* nobody else is, either. */
                                        whos_watching_me->erase(nick);
                        }
                }
 
-               /* 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)
@@ -251,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)
@@ -263,7 +260,7 @@ class CommandWatch : public Command
 
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
-               if (!parameters.size())
+               if (parameters.empty())
                {
                        watchlist* wl;
                        if (user->GetExt("watchlist", wl))
@@ -298,8 +295,9 @@ class CommandWatch : public Command
                                                                        /* I'm no longer watching you... */
                                                                        i2->second.erase(n);
 
-                                                               if (!i2->second.size())
-                                                                       whos_watching_me->erase(user->nick.c_str());
+                                                               if (i2->second.empty())
+                                                                       /* nobody else is, either. */
+                                                                       whos_watching_me->erase(i2);
                                                        }
                                                }
 
@@ -363,8 +361,7 @@ class CommandWatch : public Command
                                }
                        }
                }
-               /* So that spanningtree doesnt pass the WATCH commands to the network! */
-               return CMD_FAILURE;
+               return CMD_LOCALONLY;
        }
 };
 
@@ -458,8 +455,9 @@ class Modulewatch : public Module
                                                        /* I'm no longer watching you... */
                                                        i2->second.erase(n);
 
-                                               if (!i2->second.size())
-                                                       whos_watching_me->erase(user->nick.c_str());
+                                               if (i2->second.empty())
+                                                       /* and nobody else is, either. */
+                                                       whos_watching_me->erase(i2);
                                }
                        }