]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/inspircd.h
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / include / inspircd.h
index a7469c52d51d435bc2cad7920322146d8094c02e..0ec2c74659f3a25621f865ecef5bc8af64a5418a 100644 (file)
@@ -23,8 +23,7 @@
  */
 
 
-#ifndef INSPIRCD_H
-#define INSPIRCD_H
+#pragma once
 
 #define _FILE_OFFSET_BITS 64
 #ifndef _LARGEFILE_SOURCE
 #include <unistd.h>
 #endif
 
+#ifdef _WIN32
+# include <unordered_map>
+#else
+# include <tr1/unordered_map>
+#endif
 #include <sstream>
 #include <string>
 #include <vector>
@@ -76,8 +80,7 @@
 #include <bitset>
 #include <set>
 #include <time.h>
-#include "inspircd_config.h"
-#include "inspircd_version.h"
+#include "config.h"
 #include "typedefs.h"
 #include "consolecolors.h"
 
@@ -263,11 +266,31 @@ class serverstats
        }
 };
 
-DEFINE_HANDLER2(IsNickHandler, bool, const char*, size_t);
+/** This class manages the generation and transmission of ISUPPORT. */
+class CoreExport ISupportManager
+{
+private:
+       /** The generated lines which are sent to clients. */
+       std::vector<std::string> Lines;
+
+public:
+       /** (Re)build the ISUPPORT vector. */
+       void Build();
+
+       /** Returns the std::vector of ISUPPORT lines. */
+       const std::vector<std::string>& GetLines()
+       {
+               return this->Lines;
+       }
+
+       /** Send the 005 numerics (ISUPPORT) to a user. */
+       void SendTo(LocalUser* user);
+};
+
+DEFINE_HANDLER2(IsNickHandler, bool, const std::string&, size_t);
 DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t);
-DEFINE_HANDLER1(IsIdentHandler, bool, const char*);
-DEFINE_HANDLER2(IsChannelHandler, bool, const char*, size_t);
-DEFINE_HANDLER1(IsSIDHandler, bool, const std::string&);
+DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&);
+DEFINE_HANDLER2(IsChannelHandler, bool, const std::string&, size_t);
 DEFINE_HANDLER1(RehashHandler, void, const std::string&);
 DEFINE_HANDLER3(OnCheckExemptionHandler, ModResult, User*, Channel*, const std::string&);
 
@@ -337,7 +360,6 @@ class CoreExport InspIRCd
        IsIdentHandler HandleIsIdent;
        OnCheckExemptionHandler HandleOnCheckExemption;
        IsChannelHandler HandleIsChannel;
-       IsSIDHandler HandleIsSID;
        RehashHandler HandleRehash;
        GenRandomHandler HandleGenRandom;
 
@@ -369,10 +391,6 @@ class CoreExport InspIRCd
         */
        User* FindUUID(const char *uid);
 
-       /** Build the ISUPPORT string by triggering all modules On005Numeric events
-        */
-       void BuildISupport();
-
        /** Time this ircd was booted
         */
        time_t startup_time;
@@ -470,6 +488,9 @@ class CoreExport InspIRCd
         */
        LocalStringExt OperQuit;
 
+       /** Manages the generation and transmission of ISUPPORT. */
+       ISupportManager ISupport;
+
        /** Get the current time
         * Because this only calls time() once every time around the mainloop,
         * it is much faster than calling time() directly.
@@ -568,12 +589,12 @@ class CoreExport InspIRCd
         * @param chname A channel name to verify
         * @return True if the name is valid
         */
-       caller2<bool, const char*, size_t> IsChannel;
+       caller2<bool, const std::string&, size_t> IsChannel;
 
        /** Return true if str looks like a server ID
         * @param string to check against
         */
-       caller1<bool, const std::string&> IsSID;
+       static bool IsSID(const std::string& sid);
 
        /** Rehash the local server
         */
@@ -616,13 +637,13 @@ class CoreExport InspIRCd
         * @param n A nickname to verify
         * @return True if the nick is valid
         */
-       caller2<bool, const char*, size_t> IsNick;
+       caller2<bool, const std::string&, size_t> IsNick;
 
        /** Return true if an ident is valid
         * @param An ident to verify
         * @return True if the ident is valid
         */
-       caller1<bool, const char*> IsIdent;
+       caller1<bool, const std::string&> IsIdent;
 
        /** Add a dns Resolver class to this server's active set
         * @param r The resolver to add
@@ -732,7 +753,7 @@ class CoreExport InspIRCd
         * (one year, two weeks, three days, four hours, six minutes and five seconds)
         * @return The total number of seconds
         */
-       long Duration(const std::string &str);
+       static unsigned long Duration(const std::string& str);
 
        /** Attempt to compare a password to a string from the config file.
         * This will be passed to handling modules which will compare the data
@@ -794,10 +815,6 @@ class CoreExport InspIRCd
         */
        void SendWhoisLine(User* user, User* dest, int numeric, const char* format, ...) CUSTOM_PRINTF(5, 6);
 
-       /** Handle /WHOIS
-        */
-       void DoWhois(User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick);
-
        /** Called to check whether a channel restriction mode applies to a user
         * @param User that is attempting some action
         * @param Channel that the action is being performed on
@@ -819,17 +836,6 @@ class CoreExport InspIRCd
         */
        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();
-
-       /** Resets the cached max bans value on all channels.
-        * Called by rehash.
-        */
-       void ResetMaxBans();
-
        /** Return a time_t as a human-readable string.
         */
        std::string TimeString(time_t curtime);
@@ -841,10 +847,6 @@ class CoreExport InspIRCd
         */
        int Run();
 
-       /** Adds an extban char to the 005 token.
-        */
-       void AddExtBanChar(char c);
-
        char* GetReadBuffer()
        {
                return this->ReadBuffer;
@@ -874,5 +876,3 @@ class CommandModule : public Module
                return Version(cmd.name, VF_VENDOR|VF_CORE);
        }
 };
-
-#endif