]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
This fixes a deletion error here, we were using new[] and not using delete[], but...
[user/henk/code/inspircd.git] / src / users.cpp
index 06aba8fca59bc4e8138a107bed4a2335af8fbb93..8ab475bd9e9278754cb80ee0ab9df05b42b2bdf9 100644 (file)
@@ -309,13 +309,18 @@ const char* userrec::FormatModes()
 
 void userrec::DecrementModes()
 {
-       for (int n = 0; n < 64; n++)
+       ServerInstance->Log(DEBUG,"DecrementModes()");
+       for (unsigned char n = 'A'; n <= 'z'; n++)
        {
-               if (modes[n])
+               if (modes[n-65])
                {
-                       ModeHandler* mh = ServerInstance->Modes->FindMode(n+65, MODETYPE_USER);
+                       ServerInstance->Log(DEBUG,"DecrementModes() found mode %c", n);
+                       ModeHandler* mh = ServerInstance->Modes->FindMode(n, MODETYPE_USER);
                        if (mh)
+                       {
+                               ServerInstance->Log(DEBUG,"Found handler %c and call ChangeCount", n);
                                mh->ChangeCount(-1);
+                       }
                }
        }
 }
@@ -830,16 +835,9 @@ void userrec::UnOper()
                        // unset their oper type (what IS_OPER checks), and remove +o
                        *this->oper = 0;
                        this->modes[UM_OPERATOR] = 0;
-
-                       // remove them from the opers list.
-                       for (std::vector<userrec*>::iterator a = ServerInstance->all_opers.begin(); a < ServerInstance->all_opers.end(); a++)
-                       {
-                               if (*a == this)
-                               {
-                                       ServerInstance->all_opers.erase(a);
-                                       return;
-                               }
-                       }
+                       
+                       // remove the user from the oper list. Will remove multiple entries as a safeguard against bug #404
+                       ServerInstance->all_opers.remove(this);
                }
        }
 
@@ -878,9 +876,10 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
        {
                New = new userrec(Instance);
        }
-       catch (CoreException &e)
+       catch (...)
        {
                Instance->Log(DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed.");
+               Instance->WriteOpers("*** WARNING *** Duplicate UUID allocated!");
                return;
        }