]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_park.cpp
Improved strhashcomp with no allocations
[user/henk/code/inspircd.git] / src / modules / m_park.cpp
index 6be28d95035221313b3b86b362836d669abc8ec5..29ce2c1eb1cdcf36e514c92dda3bc713cf93c2c9 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
  *                       E-mail:
  *                <brain@chatspike.net>
  *               <Craig@chatspike.net>
@@ -42,7 +42,7 @@ class parkedinfo
        time_t parktime;
 };
 
-Server *Srv;
+static Server *Srv;
 typedef std::vector<awaymsg> awaylog;
 typedef std::vector<parkedinfo> parkinfo;
 parkinfo pinfo;
@@ -67,6 +67,7 @@ class cmd_park : public command_t
                 * We then disconnect the real user leaving a controlled ghost in their place :)
                 */
                int othersessions = 0;
+               /* XXX - why can't just use pinfo.size() like we do below, rather than iterating over the whole vector? -- w00t */
                if (pinfo.size())
                        for (parkinfo::iterator j = pinfo.begin(); j != pinfo.end(); j++)
                                if (j->host == std::string(user->host))
@@ -152,14 +153,11 @@ class cmd_unpark : public command_t
                if (key == atoi(parameters[1]))
                {
                        // first part the user from all chans theyre on, so things dont get messy
-                       for (unsigned int i = 0; i < user->chans.size(); i++)
+                       for (std::vector<ucrec*>::iterator i = user->chans.begin(); i != user->chans.end(); i++)
                        {
-                               if (user->chans[i].channel != NULL)
-                               {
-                                       if (user->chans[i].channel->name)
-                                       {
-                                               Srv->PartUserFromChannel(user,user->chans[i].channel->name,"Unparking");
-                                       }
+                               if (((ucrec*)(*i))->channel != NULL)
+                               {
+                                       Srv->PartUserFromChannel(user,((ucrec*)(*i))->channel->name,"Unparking");
                                }
                        }
                        // remove all their old modes
@@ -234,7 +232,7 @@ class ModulePark : public Module
 
        void Implements(char* List)
        {
-               List[I_OnRehash] = List[I_OnUserQuit] = List[I_OnUserPreMessage] = List[I_OnUserPreNick] = List[I_OnBackgroundTimer] = List[I_OnWhois] = 1;
+               List[I_On005Numeric] = List[I_OnRehash] = List[I_OnUserQuit] = List[I_OnUserPreMessage] = List[I_OnUserPreNick] = List[I_OnBackgroundTimer] = List[I_OnWhois] = 1;
        }
 
        virtual void OnRehash(std::string parameter)
@@ -284,6 +282,7 @@ class ModulePark : public Module
        {
                // track nickchanges in our parked user list
                // (this isnt too efficient, i'll tidy it up some time)
+               /* XXX - perhaps extend the user record, or, that wouldn't work - perhaps use a map? -- w00t */
                 for (parkinfo::iterator j = pinfo.begin(); j != pinfo.end(); j++)
                 {
                         if (j->nick == std::string(user->nick))
@@ -322,7 +321,8 @@ class ModulePark : public Module
                }
        }
 
-       virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
+       /* XXX - why is OnPrePrivmsg seperated here, I assume there is reason for the extra function call? --w00t */
+       virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status)
        {
                if (target_type == TYPE_USER)
                {