From 396c9ef9f7a96934d3227bb7d1d091315e3d4fa8 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 10 Aug 2006 14:43:29 +0000 Subject: FindNick, FindChan, ChanModes, UserList, CountInvisible, PurgeEmptyChannels, GetClass, WriteOpers, GetServerDescription -> into classes ServerConfig takes InspIRCd pointer in its constructor git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4832 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/channels.h | 8 ++++++++ include/configreader.h | 5 ++++- include/globals.h | 2 -- include/helperfuncs.h | 16 ---------------- include/inspircd.h | 11 +++++++++++ include/inspstring.h | 3 +++ include/modules.h | 15 --------------- include/users.h | 4 ++++ 8 files changed, 30 insertions(+), 34 deletions(-) (limited to 'include') diff --git a/include/channels.h b/include/channels.h index 32f28c751..e9dcfb133 100644 --- a/include/channels.h +++ b/include/channels.h @@ -428,6 +428,14 @@ class chanrec : public Extensible */ void WriteAllExceptSender(userrec* user, char status, const std::string& text); + long GetMaxBans(); + + char* ChanModes(bool showkey); + + void UserList(userrec *user); + + int CountInvisible(); + /** Destructor for chanrec */ virtual ~chanrec() { /* stub */ } diff --git a/include/configreader.h b/include/configreader.h index 79384c2db..5bf26e695 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -27,6 +27,7 @@ #include "modules.h" class ServerConfig; +class InspIRCd; typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, void*); typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, void**, int*); @@ -61,6 +62,8 @@ struct MultiConfig class ServerConfig : public Extensible { private: + InspIRCd* ServerInstance; + /** This variable holds the names of all * files included from the main one. This * is used to make sure that no files are @@ -354,7 +357,7 @@ class ServerConfig : public Extensible */ bool SyntaxHints; - ServerConfig(); + ServerConfig(InspIRCd* Instance); /** Clears the include stack in preperation for * a Read() call. diff --git a/include/globals.h b/include/globals.h index 9950db422..d30f18ede 100644 --- a/include/globals.h +++ b/include/globals.h @@ -31,8 +31,6 @@ typedef std::pair< std::string, std::string > KeyVal; typedef std::vector< KeyVal > KeyValList; typedef std::multimap< std::string, KeyValList > ConfigDataHash; -void WriteOpers(char* text, ...); int isnick(const char *n); -chanrec* FindChan(const char* chan); #endif diff --git a/include/helperfuncs.h b/include/helperfuncs.h index 801e05bdb..9c3207a9e 100644 --- a/include/helperfuncs.h +++ b/include/helperfuncs.h @@ -48,20 +48,7 @@ enum DebugLevel #define STRINGIFY(x) STRINGIFY2(x) #define log(l, x, args...) InspIRCd::Log(l, __FILE__ ":" STRINGIFY(__LINE__) ": " x, ##args) -void WriteOpers(const char* text, ...); -void WriteOpers_NoFormat(const char* text); - -std::string GetServerDescription(const char* servername); void strlower(char *n); -userrec* Find(const std::string &nick); -userrec* Find(const char* nick); -chanrec* FindChan(const char* chan); -int usercount_i(chanrec *c); -long GetMaxBans(char* name); -void purge_empty_chans(userrec* u); -char* chanmodes(chanrec *chan, bool showkey); -void userlist(userrec *user,chanrec *c); -ConnectClass GetClass(userrec *user); void Error(int status); void ShowMOTD(userrec *user); void ShowRULES(userrec *user); @@ -73,7 +60,4 @@ std::string GetFullProgDir(char** argv, int argc); int InsertMode(std::string &output, const char* modes, unsigned short section); bool IsValidChannelName(const char *); -int charlcat(char* x,char y,int z); -bool charremove(char* mp, char remove); - #endif diff --git a/include/inspircd.h b/include/inspircd.h index 7cd1d973d..94bba27f6 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -122,6 +122,17 @@ class InspIRCd : public classbase const char* FindServerNamePtr(const std::string &servername); bool FindServerName(const std::string &servername); + std::string GetServerDescription(const char* servername); + + void WriteOpers(const char* text, ...); + void WriteOpers(const std::string &text); + + userrec* FindNick(const std::string &nick); + userrec* FindNick(const char* nick); + + chanrec* FindChan(const std::string &chan); + chanrec* FindChan(const char* chan); + bool UserToPseudo(userrec* user, const std::string &message); bool PseudoToUser(userrec* alive, userrec* zombie, const std::string &message); diff --git a/include/inspstring.h b/include/inspstring.h index c5a20e9e4..b29412100 100644 --- a/include/inspstring.h +++ b/include/inspstring.h @@ -9,4 +9,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz); size_t strlcat(char *dst, const char *src, size_t siz); #endif +int charlcat(char* x,char y,int z); +bool charremove(char* mp, char remove); + #endif diff --git a/include/modules.h b/include/modules.h index aca4f06ea..fca1bc128 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1297,11 +1297,6 @@ class Server : public Extensible * @returns a priority ID which the core uses to relocate the module in the list */ long PriorityAfter(const std::string &modulename); - - /** Sends text to all opers. - * This method sends a server notice to all opers with the usermode +s. - */ - virtual void SendOpers(const std::string &s); /** Returns the version string of this server */ @@ -1357,21 +1352,11 @@ class Server : public Extensible */ virtual bool IsNick(const std::string &nick); - /** Attempts to look up a nick and return a pointer to it. - * This function will return NULL if the nick does not exist. - */ - virtual userrec* FindNick(const std::string &nick); - /** Attempts to look up a nick using the file descriptor associated with that nick. * This function will return NULL if the file descriptor is not associated with a valid user. */ virtual userrec* FindDescriptor(int socket); - /** Attempts to look up a channel and return a pointer to it. - * This function will return NULL if the channel does not exist. - */ - virtual chanrec* FindChannel(const std::string &channel); - /** Attempts to look up a user's privilages on a channel. * This function will return a string containing either @, %, +, or an empty string, * representing the user's privilages upon the channel you specify. diff --git a/include/users.h b/include/users.h index 1d8e918aa..165b74aa4 100644 --- a/include/users.h +++ b/include/users.h @@ -650,6 +650,10 @@ class userrec : public connection void SplitChanList(userrec* dest, const std::string &cl); + void PurgeEmptyChannels(); + + ConnectClass& GetClass(); + /** Default destructor */ virtual ~userrec(); -- cgit v1.2.3