summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/usermanager.h5
-rw-r--r--src/modules/m_hostcycle.cpp4
-rw-r--r--src/usermanager.cpp5
-rw-r--r--src/users.cpp2
4 files changed, 13 insertions, 3 deletions
diff --git a/include/usermanager.h b/include/usermanager.h
index eee076802..605b841bb 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -186,4 +186,9 @@ class CoreExport UserManager : public fakederef<UserManager>
* @param ... The format arguments
*/
void ServerNoticeAll(const char* text, ...) CUSTOM_PRINTF(2, 3);
+
+ /** Retrieves the next already sent id, guaranteed to be not equal to any user's already_sent field
+ * @return Next already_sent id
+ */
+ already_sent_t NextAlreadySentId();
};
diff --git a/src/modules/m_hostcycle.cpp b/src/modules/m_hostcycle.cpp
index e8a0abbf1..d4def6473 100644
--- a/src/modules/m_hostcycle.cpp
+++ b/src/modules/m_hostcycle.cpp
@@ -29,8 +29,8 @@ class ModuleHostCycle : public Module
// GetFullHost() returns the original data at the time this function is called
const std::string quitline = ":" + user->GetFullHost() + " QUIT :" + quitmsg;
- already_sent_t silent_id = ++LocalUser::already_sent_id;
- already_sent_t seen_id = ++LocalUser::already_sent_id;
+ already_sent_t silent_id = ServerInstance->Users.NextAlreadySentId();
+ already_sent_t seen_id = ServerInstance->Users.NextAlreadySentId();
IncludeChanList include_chans(user->chans.begin(), user->chans.end());
std::map<User*,bool> exceptions;
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 41061f6d1..c593e149f 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -368,3 +368,8 @@ void UserManager::DoBackgroundUserStuff()
}
}
}
+
+already_sent_t UserManager::NextAlreadySentId()
+{
+ return ++LocalUser::already_sent_id;
+}
diff --git a/src/users.cpp b/src/users.cpp
index d503844e7..258544312 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -873,7 +873,7 @@ void User::ForEachNeighbor(ForEachNeighborHandler& handler, bool include_self)
FOREACH_MOD(OnBuildNeighborList, (this, include_chans, exceptions));
// Get next id, guaranteed to differ from the already_sent field of all users
- const already_sent_t newid = ++LocalUser::already_sent_id;
+ const already_sent_t newid = ServerInstance->Users.NextAlreadySentId();
// Handle exceptions first
for (std::map<User*, bool>::const_iterator i = exceptions.begin(); i != exceptions.end(); ++i)