summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2013-04-11 15:11:31 -0700
committerAttila Molnar <attilamolnar@hush.com>2013-04-11 15:11:31 -0700
commit1858feabd342636df0b52780c978979b4e049fc3 (patch)
treec00ab92b6ff6d002e6c40909587b146ba5e45612 /include
parent295b3e7ba15a228948358bd6f23591a9cb5bf5a8 (diff)
parent5c29c53f651fb0c513a50c9396e08ba340a6d2bf (diff)
Merge pull request #487 from SaberUK/master+better-isupport-api
Convert ISUPPORT to use a map instead of a string.
Diffstat (limited to 'include')
-rw-r--r--include/configreader.h18
-rw-r--r--include/inspircd.h32
-rw-r--r--include/modules.h6
3 files changed, 27 insertions, 29 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 5541a2c42..b137ee544 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -432,16 +432,6 @@ class CoreExport ServerConfig
*/
ClassVector Classes;
- /** The 005 tokens of this server (ISUPPORT)
- * populated/repopulated upon loading or unloading
- * modules.
- */
- std::string data005;
-
- /** isupport strings
- */
- std::vector<std::string> isupport;
-
/** STATS characters in this list are available
* only to operators.
*/
@@ -515,14 +505,6 @@ class CoreExport ServerConfig
*/
const std::string& GetSID();
- /** Update the 005 vector
- */
- void Update005();
-
- /** Send the 005 numerics (ISUPPORT) to a user
- */
- void Send005(User* user);
-
/** Read the entire configuration into memory
* and initialize this class. All other methods
* should be used only by the core.
diff --git a/include/inspircd.h b/include/inspircd.h
index df2ad1095..f61d48529 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -267,6 +267,27 @@ class serverstats
}
};
+/** 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 std::string&);
@@ -371,10 +392,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;
@@ -472,6 +489,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.
@@ -828,10 +848,6 @@ class CoreExport InspIRCd
*/
int Run();
- /** Adds an extban char to the 005 token.
- */
- void AddExtBanChar(char c);
-
char* GetReadBuffer()
{
return this->ReadBuffer;
diff --git a/include/modules.h b/include/modules.h
index 3e5ace3f4..58062fddd 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -911,9 +911,9 @@ class CoreExport Module : public classbase, public usecountbase
/** Called when a 005 numeric is about to be output.
* The module should modify the 005 numeric if needed to indicate its features.
- * @param output The 005 string to be modified if neccessary.
- */
- virtual void On005Numeric(std::string &output);
+ * @param output The 005 map to be modified if neccessary.
+ */
+ virtual void On005Numeric(std::map<std::string, std::string>& tokens);
/** Called when a client is disconnected by KILL.
* If a client is killed by a server, e.g. a nickname collision or protocol error,