X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fusermanager.cpp;h=ba6bbf36bb8e6a96bd1a2a3c6bd82211df21bf9d;hb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;hp=7e92507ca77b5844f3db08f8b5cb1ffa1e5eb9d2;hpb=d549fbb7d3912b6bef86099ac6b2e552ce3c3cee;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 7e92507ca..ba6bbf36b 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -49,7 +49,8 @@ namespace } UserManager::UserManager() - : unregistered_count(0) + : already_sent_id(0) + , unregistered_count(0) { } @@ -278,17 +279,6 @@ void UserManager::ServerNoticeAll(const char* text, ...) } } -void UserManager::GarbageCollect() -{ - // Reset the already_sent IDs so we don't wrap it around and drop a message - LocalUser::already_sent_id = 0; - for (LocalList::const_iterator i = local_users.begin(); i != local_users.end(); ++i) - { - (**i).already_sent = 0; - (**i).RemoveExpiredInvites(); - } -} - /* this returns true when all modules are satisfied that the user should be allowed onto the irc server * (until this returns true, a user will block in the waiting state, waiting to connect up to the * registration timeout maximum seconds) @@ -371,3 +361,18 @@ void UserManager::DoBackgroundUserStuff() } } } + +already_sent_t UserManager::NextAlreadySentId() +{ + if (++already_sent_id == 0) + { + // Wrapped around, reset the already_sent ids of all users + already_sent_id = 1; + for (LocalList::iterator i = local_users.begin(); i != local_users.end(); ++i) + { + LocalUser* user = *i; + user->already_sent = 0; + } + } + return already_sent_id; +}