]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Tons of buffering fixes and optimisations for user connections
[user/henk/code/inspircd.git] / src / users.cpp
index b179fabddf7f11ccdb20e8063b2ae9aefe8cb765..4c7173e30084daa670450695e27d0367ebf03640 100644 (file)
@@ -13,6 +13,7 @@ userrec::userrec()
        // the PROPER way to do it, AVOID bzero at *ALL* costs
        strcpy(nick,"");
        ip = 0;
+       timeout = 0;
        strcpy(ident,"");
        strcpy(host,"");
        strcpy(dhost,"");
@@ -32,6 +33,7 @@ userrec::userrec()
        invites.clear();
 }
 
+
  
 char* userrec::GetFullHost()
 {
@@ -50,11 +52,14 @@ bool userrec::IsInvited(char* channel)
 {
        for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
        {
-               if (!strcasecmp(i->channel,channel))
-               {
-                       return true;
+               if (i->channel) {
+                       if (!strcasecmp(i->channel,channel))
+                       {
+                               return true;
+                       }
                }
        }
+       return false;
 }
 
 void userrec::InviteTo(char* channel)
@@ -66,12 +71,18 @@ void userrec::InviteTo(char* channel)
 
 void userrec::RemoveInvite(char* channel)
 {
-        for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
-        {
-                if (!strcasecmp(i->channel,channel))
-                {
-                        invites.erase(i);
-                       return;
-                }
+       log(DEBUG,"Removing invites");
+       if (invites.size())
+       {
+               for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
+               {
+                       if (i->channel) {
+                               if (!strcasecmp(i->channel,channel))
+                               {
+                                               invites.erase(i);
+                                       return;
+                               }
+                       }
+               }
         }
 }