]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Spotted problem: must clear out all prefixes attached to a user when they quit or...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 23 Aug 2006 20:29:09 +0000 (20:29 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 23 Aug 2006 20:29:09 +0000 (20:29 +0000)
Next thing to do, consider removing of opped_userlist, halfopped_userlist and voiced_userlist as this data is now in the prefixlist

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4998 e03df62e-2008-0410-955e-edbf42e46eb7

include/channels.h
src/channels.cpp
src/users.cpp

index 5186822e13339ec5c91cf8447ef84af19734434c..489c8b0e868886b511cab3df4df45956e2af2182 100644 (file)
@@ -473,6 +473,8 @@ class chanrec : public Extensible
         */
        const char* GetStatusChar(userrec *user);
 
+       void RemoveAllPrefixes(userrec* user);
+
        void SetPrefix(userrec* user, char prefix, unsigned int prefix_rank, bool adding);
 
        /** Destructor for chanrec
index 4d68af99cf1d45a6a00dbaf8f389924db4bf3722..312e78aa697eba498385fd4a6cd48ebc3319e730 100644 (file)
@@ -482,6 +482,7 @@ long chanrec::PartUser(userrec *user, const char* reason)
                        }
                        user->chans[i]->uc_modes = 0;
                        user->chans[i]->channel = NULL;
+                       this->RemoveAllPrefixes(user);
                        break;
                }
        }
@@ -528,6 +529,7 @@ long chanrec::ServerKickUser(userrec* user, const char* reason, bool triggereven
                        this->WriteChannelWithServ(ServerInstance->Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
                        user->chans[i]->uc_modes = 0;
                        user->chans[i]->channel = NULL;
+                       this->RemoveAllPrefixes(user);
                        break;
                }
        }
@@ -610,6 +612,7 @@ long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
                        this->WriteChannel(src, "KICK %s %s :%s", this->name, user->nick, reason);
                        (*i)->uc_modes = 0;
                        (*i)->channel = NULL;
+                       this->RemoveAllPrefixes(user);
                        break;
                }
        }
@@ -976,3 +979,10 @@ void chanrec::SetPrefix(userrec* user, char prefix, unsigned int prefix_value, b
        }
 }
 
+void chanrec::RemoveAllPrefixes(userrec* user)
+{
+       prefixlist::iterator n = prefixes.find(user);
+       if (n != prefixes.end())
+               prefixes.erase(n);
+}
+
index 3953db233929e3e4ac143e292eaa1677fd41fd0d..3b02e82b9b0e324625999803c200420f5ee37e30 100644 (file)
@@ -1744,6 +1744,7 @@ void userrec::PurgeEmptyChannels()
                ucrec* uc = *f;
                if (uc->channel)
                {
+                       uc->channel->RemoveAllPrefixes(this);
                        if (uc->channel->DelUser(this) == 0)
                        {
                                /* No users left in here, mark it for deletion */