]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/inspircd.h
And its all done and working!
[user/henk/code/inspircd.git] / include / inspircd.h
index a15c1fd6811722c0d56e8f971ec8c18dd46a9c83..136914276ada0904571794749ac76a4c35562ab5 100644 (file)
 #include "command_parse.h"
 #include "snomasks.h"
 
-/** Returned by some functions to indicate failure,
- * and the exit code of the program if it terminates.
+/** Returned by some functions to indicate failure.
  */
 #define ERROR -1
 
-/** Crucial defines
+/** Support for librodent -
+ * see http://www.chatspike.net/index.php?z=64
  */
-#define ETIREDGERBILS EAGAIN
+#define ETIREDHAMSTERS EAGAIN
 
 /** Debug levels for use with InspIRCd::Log()
  */
@@ -78,6 +78,25 @@ template<typename T> inline long ConvToInt(const T &in)
        return atoi(tmp.str().c_str());
 }
 
+/** Template function to convert integer to char, storing result in *res and
+ * also returning the pointer to res. Based on Stuart Lowe's C/C++ Pages.
+ */
+template<typename T, typename V, typename R> inline char* itoa(const T &in, V *res, R base)
+{
+       if (base < 2 || base > 16) { *res = 0; return res; }
+       char* out = res;
+       int quotient = in;
+       while (quotient) {
+               *out = "0123456789abcdef"[ std::abs( quotient % base ) ];
+               ++out;
+               quotient /= base;
+       }
+       if ( in < 0 && base == 10) *out++ = '-';
+       std::reverse( res, out );
+       *out = 0;
+       return res;
+}
+
 /** This class contains various STATS counters
  * It is used by the InspIRCd class, which internally
  * has an instance of it.
@@ -367,6 +386,12 @@ class InspIRCd : public classbase
        int time_delta;
 
  public:
+
+       /** Number of unregistered users online right now.
+        * (Unregistered means before USER/NICK/dns)
+        */
+       int unregistered_count;
+
         /** List of server names we've seen.
         */
        servernamelist servernames;
@@ -402,11 +427,11 @@ class InspIRCd : public classbase
 
        /** Client list, a hash_map containing all clients, local and remote
         */
-       user_hash clientlist;
+       user_hash* clientlist;
 
        /** Channel list, a hash_map containing all channels
         */
-       chan_hash chanlist;
+       chan_hash* chanlist;
 
        /** Local client list, a vector containing only local clients
         */
@@ -420,14 +445,6 @@ class InspIRCd : public classbase
 
        clonemap global_clones;
 
-       /** Whowas container, contains a map of vectors of users tracked by WHOWAS
-        */
-       irc::whowas::whowas_users whowas;
-
-       /** Whowas container, contains a map of time_t to users tracked by WHOWAS
-        */
-       irc::whowas::whowas_users_fifo whowas_fifo;
-
        /** DNS class, provides resolver facilities to the core and modules
         */
        DNS* Res;
@@ -476,6 +493,10 @@ class InspIRCd : public classbase
 
        void AddGlobalClone(userrec* user);
 
+       /** Number of users with a certain mode set on them
+        */
+       int ModeCount(const char mode);
+
        /** Get the time offset in seconds
         * @return The current time delta (in seconds)
         */
@@ -605,6 +626,8 @@ class InspIRCd : public classbase
         */
        void OpenLog(char** argv, int argc);
 
+       void CloseLog();
+
        /** Convert a user to a pseudoclient, disconnecting the real user
         * @param user The user to convert
         * @param message The quit message to display when exiting the user
@@ -655,6 +678,7 @@ class InspIRCd : public classbase
 
        /** Causes the server to exit immediately
         * @param The exit code to give to the operating system
+        * (See the ExitStatus enum for valid values)
         */
        static void Exit(int status);
 
@@ -861,9 +885,10 @@ class InspIRCd : public classbase
 
        /** Add a dns Resolver class to this server's active set
         * @param r The resolver to add
+        * @param cached The value of 'cached' which you passed to the Resolver constructor before this function.
         * @return True if the resolver was added
         */
-        bool AddResolver(Resolver* r);
+        bool AddResolver(Resolver* r, bool cached);
 
        /** Add a command to this server's command parser
         * @param f A command_t command handler object to add
@@ -1127,6 +1152,12 @@ class InspIRCd : public classbase
         */
        void Cleanup();
 
+       /** This copies the user and channel hash_maps into new hash maps.
+        * This frees memory used by the hash_map allocator (which it neglects
+        * to free, most of the time, using tons of ram)
+        */
+       void RehashUsersAndChans();
+
        /** Begin execution of the server.
         * NOTE: this function NEVER returns. Internally,
         * after performing some initialisation routines,