X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=include%2Fusermanager.h;h=941569e8c02e7af1813ec95468fd7e924a3d36d8;hb=da29af8cba49d51e53d6e68237ccbf6370b6dd1f;hp=57306c8fb4bb12dce8ae84021108a36729382870;hpb=bc730a5d1a6df1c3ff5000a96eda6e153134ae04;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/usermanager.h b/include/usermanager.h index 57306c8fb..941569e8c 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -21,7 +21,7 @@ #include -class CoreExport UserManager +class CoreExport UserManager : public fakederef { public: struct CloneCounts @@ -37,7 +37,11 @@ class CoreExport UserManager /** Sequence container in which each element is a User* */ - typedef std::list OperList; + typedef std::vector OperList; + + /** A list holding local users + */ + typedef insp::intrusive_list LocalList; private: /** Map of IP addresses for clone counting @@ -48,6 +52,15 @@ class CoreExport UserManager */ const CloneCounts zeroclonecounts; + /** Local client list, a list containing only local clients + */ + LocalList local_users; + + /** Last used already sent id, used when sending messages to neighbors to help determine whether the message has + * been sent to a particular user or not. See User::ForEachNeighbor() for more info. + */ + already_sent_t already_sent_id; + public: /** Constructor, initializes variables */ @@ -66,10 +79,6 @@ class CoreExport UserManager */ user_hash uuidlist; - /** Local client list, a list containing only local clients - */ - LocalUserList local_users; - /** Oper list, a vector containing all local and remote opered users */ OperList all_opers; @@ -79,12 +88,6 @@ class CoreExport UserManager */ unsigned int unregistered_count; - /** - * Reset the already_sent IDs so we don't wrap it around and drop a message - * Also removes all expired invites - */ - void GarbageCollect(); - /** Perform background user events such as PING checks */ void DoBackgroundUserStuff(); @@ -126,6 +129,10 @@ class CoreExport UserManager */ void RemoveCloneCounts(User *user); + /** Rebuild clone counts + */ + void RehashCloneCounts(); + /** Return the number of local and global clones of this user * @param user The user to get the clone counts for * @return The clone counts of this user. The returned reference is volatile - you @@ -169,9 +176,19 @@ class CoreExport UserManager */ user_hash& GetUsers() { return clientlist; } + /** Get a list containing all local users + * @return A const list of local users + */ + const LocalList& GetLocalUsers() const { return local_users; } + /** Send a server notice to all local users * @param text The text format string to send * @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(); };