]> 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 5ac07839eb48213d991c2d82eac3b3b8ac5c5447..29ce2c1eb1cdcf36e514c92dda3bc713cf93c2c9 100644 (file)
@@ -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
@@ -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,6 +321,7 @@ class ModulePark : public Module
                }
        }
 
+       /* 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)