summaryrefslogtreecommitdiff
path: root/src/usermanager.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-11-10 17:20:23 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-11-10 17:20:23 +0100
commit903a0075d3c123b16128b9f8f2eb36878c28e282 (patch)
tree46e8c60157f98464ae55e7ea5609ffc091422733 /src/usermanager.cpp
parent2c51a2bf17b6c377f0207f3d89b4b3f399fc0178 (diff)
parentaa05a6fd4d5c11dc8e8adc469134a2802446fe9f (diff)
Merge branch 'master+alreadysent'
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r--src/usermanager.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 41061f6d1..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,14 +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;
-}
-
/* 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)
@@ -368,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;
+}