]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/users.h
More CoreExport, brought the errors down, but some still persist.
[user/henk/code/inspircd.git] / include / users.h
index 763d45c57d3ce2105a597184054e76bb559faef9..a898d58130d18b7f58c752473d51e319c09afc8c 100644 (file)
@@ -62,7 +62,7 @@ class UserResolver;
 
 /** Holds information relevent to <connect allow> and <connect deny> tags in the config file.
  */
-struct CoreExport ConnectClass : public classbase
+struct CoreExport ConnectClass : public refcountbase
 {
        /** Type of line, either CC_ALLOW or CC_DENY
         */
@@ -93,8 +93,14 @@ struct CoreExport ConnectClass : public classbase
        std::string hash;
 
        /** Maximum size of sendq for users in this class (bytes)
+        * Users cannot send commands if they go over this limit
         */
-       unsigned long sendqmax;
+       unsigned long softsendqmax;
+
+       /** Maximum size of sendq for users in this class (bytes)
+        * Users are killed if they go over this limit
+        */
+       unsigned long hardsendqmax;
 
        /** Maximum size of recvq for users in this class (bytes)
         */
@@ -121,12 +127,6 @@ struct CoreExport ConnectClass : public classbase
         */
        unsigned long limit;
 
-       /** Reference counter.
-        * This will be 1 if no users are connected, as long as it is a valid connect block
-        * When it reaches 0, the object should be deleted
-        */
-       unsigned long RefCount;
-
        /** Create a new connect class with no settings.
         */
        ConnectClass(char type, const std::string& mask);
@@ -157,11 +157,19 @@ struct CoreExport ConnectClass : public classbase
                return (pingtime ? pingtime : 120);
        }
 
-       /** Returns the maximum sendq value
+       /** Returns the maximum sendq value (soft limit)
+        * Note that this is in addition to internal OS buffers
+        */
+       unsigned long GetSendqSoftMax()
+       {
+               return (softsendqmax ? softsendqmax : 4096);
+       }
+
+       /** Returns the maximum sendq value (hard limit)
         */
-       unsigned long GetSendqMax()
+       unsigned long GetSendqHardMax()
        {
-               return (sendqmax ? sendqmax : 262114);
+               return (hardsendqmax ? hardsendqmax : 0x100000);
        }
 
        /** Returns the maximum recvq value
@@ -188,19 +196,19 @@ struct CoreExport ConnectClass : public classbase
 
 /** Holds a complete list of all channels to which a user has been invited and has not yet joined, and the time at which they'll expire.
  */
-typedef std::vector< std::pair<irc::string, time_t> > InvitedList;
+CoreExport typedef std::vector< std::pair<irc::string, time_t> > InvitedList;
 
 /** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
  */
-typedef std::vector<ConnectClass*> ClassVector;
+CoreExport typedef std::vector<reference<ConnectClass> > ClassVector;
 
 /** Typedef for the list of user-channel records for a user
  */
-typedef std::set<Channel*> UserChanList;
+CoreExport typedef std::set<Channel*> UserChanList;
 
 /** Shorthand for an iterator into a UserChanList
  */
-typedef UserChanList::iterator UCListIter;
+CoreExport typedef UserChanList::iterator UCListIter;
 
 /* Required forward declaration
  */
@@ -256,13 +264,9 @@ class CoreExport User : public StreamSocket
        std::bitset<64> AllowedChanModes;
 
  public:
-       static LocalIntExt NICKForced;
-       static LocalStringExt OperQuit;
-
        /** Contains a pointer to the connect class a user is on from - this will be NULL for remote connections.
-        * The pointer is guarenteed to *always* be valid. :)
         */
-       ConnectClass *MyClass;
+       reference<ConnectClass> MyClass;
 
        /** Hostname of connection.
         * This should be valid as per RFC1035.
@@ -375,7 +379,7 @@ class CoreExport User : public StreamSocket
 
        /** The server the user is connected to.
         */
-       const char* server;
+       std::string server;
 
        /** The user's away message.
         * If this string is empty, the user is not marked as away.
@@ -437,10 +441,6 @@ class CoreExport User : public StreamSocket
         * @return The port number of this user.
         */
        int GetServerPort();
-       /**
-        * @return The server IP address
-        */
-       std::string GetServerIP();
 
        /** Get client IP string from sockaddr, using static internal buffer
         * @return The IP string
@@ -712,7 +712,7 @@ class CoreExport User : public StreamSocket
        /** Write to all users that can see this user (including this user in the list), appending CR/LF
         * @param text A std::string to send to the users
         */
-       void WriteCommon(const std::string &text);
+       void WriteCommonRaw(const std::string &line, bool include_self = true);
 
        /** Write to all users that can see this user (including this user in the list), appending CR/LF
         * @param text The format string for text to send to the users
@@ -726,11 +726,6 @@ class CoreExport User : public StreamSocket
         */
        void WriteCommonExcept(const char* text, ...) CUSTOM_PRINTF(2, 3);
 
-       /** Write to all users that can see this user (not including this user in the list), appending CR/LF
-        * @param text A std::string to send to the users
-        */
-       void WriteCommonExcept(const std::string &text);
-
        /** Write a quit message to all common users, as in User::WriteCommonExcept but with a specific
         * quit message for opers only.
         * @param normal_text Normal user quit message
@@ -855,7 +850,7 @@ class CoreExport User : public StreamSocket
        /** Default destructor
         */
        virtual ~User();
-       virtual void cull();
+       virtual bool cull();
 };
 
 /** Derived from Resolver, and performs user forward/reverse lookups.