]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_watch.cpp
Add comments
[user/henk/code/inspircd.git] / src / modules / m_watch.cpp
index 84058d6278caa194e4454e806bed503d87f053bb..669f76b538d8f2d5a0e993128c99c72097af214f 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -62,7 +62,7 @@
  * 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, less<irc::string> > > watchentries;
+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;
 #endif
@@ -94,6 +94,10 @@ class CommandWatch : public Command
                {
                        /* Yup, is on my list */
                        watchlist::iterator n = wl->find(nick);
+
+                       if (!wl)
+                               return CMD_FAILURE;
+
                        if (n != wl->end())
                        {
                                if (!n->second.empty())
@@ -312,6 +316,8 @@ class Modulewatch : public Module
                whos_watching_me = new watchentries();
                mycommand = new CommandWatch(ServerInstance, maxwatch);
                ServerInstance->AddCommand(mycommand);
+               Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric };
+               ServerInstance->Modules->Attach(eventlist, this, 7);
        }
 
        virtual void OnRehash(User* user, const std::string &parameter)
@@ -322,10 +328,6 @@ class Modulewatch : public Module
                        maxwatch = 32;
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnRehash] = List[I_OnGarbageCollect] = List[I_OnCleanup] = List[I_OnUserQuit] = List[I_OnPostConnect] = List[I_OnUserPostNick] = List[I_On005Numeric] = 1;
-       }
 
        virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
        {
@@ -367,6 +369,7 @@ class Modulewatch : public Module
 
                        /* User's quitting, we're done with this. */
                        delete wl;
+                       user->Shrink("watchlist");
                }
        }