]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
CPU Usage percent in stats z! yay!
[user/henk/code/inspircd.git] / include / users.h
index 83ea9bf3f4198a5d470f8e9fc03cf9d438d25720..429606344d6fe87d15e203568d0d5ba01598b3be 100644 (file)
@@ -46,6 +46,7 @@ enum UserModes {
        UM_WALLOPS = 'w'-65,
        UM_INVISIBLE = 'i'-65,
        UM_OPERATOR = 'o'-65,
+       UM_SNOMASK = 'n'-65,
 };
 
 enum RegistrationState {
@@ -64,8 +65,6 @@ class Invited : public classbase
         irc::string channel;
 };
 
-
-
 class InspIRCd;
 
 /** Derived from Resolver, and performs user forward/reverse lookups.
@@ -79,7 +78,7 @@ class UserResolver : public Resolver
        int bound_fd;
        bool fwd;
  public:
-       UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, bool forward);
+       UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, QueryType qt);
 
        void OnLookupComplete(const std::string &result);
        void OnError(ResolverError e, const std::string &errormessage);
@@ -147,7 +146,8 @@ typedef std::vector<ConnectClass> ClassVector;
 
 /** Typedef for the list of user-channel records for a user
  */
-typedef std::vector<ucrec*> UserChanList;
+typedef std::map<chanrec*, char> UserChanList;
+typedef UserChanList::iterator UCListIter;
 
 /** Holds all information about a user
  * This class stores all information about a user connected to the irc server. Everything about a
@@ -170,6 +170,10 @@ class userrec : public connection
         * channels are removed from this list.
         */
        InvitedList invites;
+
+       /** Number of channels this user is currently on
+        */
+       unsigned int ChannelCount;
  public:
        /** Resolvers for looking up this users IP address
         * This will occur if and when res_reverse completes.
@@ -345,6 +349,14 @@ class userrec : public connection
         */
        long recvqmax;
 
+       /** This is true if the user matched an exception when they connected to the ircd.
+        * It isnt valid after this point, and you should not attempt to do anything with it
+        * after this point, because the eline might be removed at a later time, and/or no
+        * longer be applicable to this user. It is only used to save doing the eline lookup
+        * twice (instead we do it once and set this value).
+        */
+       bool exempt;
+
        /** Default constructor
         * @throw Nothing at present
         */
@@ -372,9 +384,11 @@ class userrec : public connection
 
        /** Process a snomask modifier string, e.g. +abc-de
         * @param sm A sequence of notice mask characters
-        * @return True if the notice masks were successfully applied
+        * @return The cleaned mode sequence which can be output,
+        * e.g. in the above example if masks c and e are not
+        * valid, this function will return +ab-d
         */
-       bool userrec::ProcessNoticeMasks(const char *sm);
+       std::string ProcessNoticeMasks(const char *sm);
 
        /** Returns true if a notice mask is set
         * @param sm A notice mask character to check
@@ -510,11 +524,17 @@ class userrec : public connection
         */
        char* MakeWildHost();
 
-       /** Creates a host.
-        * Takes a buffer to use and fills the given buffer with the host in the format nick!user@host
-        * @param Buffer to fill with host information
+       /** Creates a usermask with real host.
+        * Takes a buffer to use and fills the given buffer with the hostmask in the format user@host
+        * @return the usermask in the format user@host
+        */
+       char* MakeHost();
+
+       /** Creates a usermask with real ip.
+        * Takes a buffer to use and fills the given buffer with the ipmask in the format user@ip
+        * @return the usermask in the format user@ip
         */
-       void MakeHost(char* nhost);
+       char* MakeHostIP();
 
        /** Shuts down and closes the user's socket
         * This will not cause the user to be deleted. Use InspIRCd::QuitUser for this,
@@ -715,6 +735,12 @@ class userrec : public connection
         */
        int CountChannels();
 
+       /** Modify the number of channels this user is on (used by CountChannels).
+        * Pass a positive number to increment the counter, or a negative number
+        * to decrement it.
+        */
+       void ModChannelCount(int n);
+
        /** Send a notice to all local users from this user
         * @param text The text format string to send
         * @param ... Format arguments
@@ -756,7 +782,7 @@ class userrec : public connection
        /** Handle socket event.
         * From EventHandler class.
         */
-       void HandleEvent(EventType et);
+       void HandleEvent(EventType et, int errornum = 0);
 
        /** Default destructor
         */
@@ -811,18 +837,22 @@ namespace irc
                 */
                typedef std::map<irc::string,whowas_set*> whowas_users;
 
+               /** Sets of time and users in whowas list
+                */
+               typedef std::map<time_t,irc::string> whowas_users_fifo;
+
                /** Called every hour by the core to remove expired entries
                 */
-               void MaintainWhoWas(time_t TIME);
+               void MaintainWhoWas(InspIRCd* ServerInstance, time_t TIME);
+
+               /** Prune for WhoWasGroupSize, WhoWasMaxGroups and
+                *  WhoWasMaxKeep on rehash
+                */
+               void PruneWhoWas(InspIRCd* ServerInstance, time_t TIME);
        };
 };
 
 /* Configuration callbacks */
 class ServerConfig;
-bool InitTypes(ServerConfig* conf, const char* tag);
-bool InitClasses(ServerConfig* conf, const char* tag);
-bool DoType(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoClass(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoneClassesAndTypes(ServerConfig* conf, const char* tag);
 
 #endif