diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-08 18:59:13 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-08 18:59:13 +0000 |
commit | fea1a27cb96a114f698eedcf90401b78406108fb (patch) | |
tree | 194649decb5d88184149307571bba6873537853d /include | |
parent | a7543c881be4c900b68a54714de7c1e677acbb09 (diff) |
WHEEEEE!!!!!
All of: Write(), WriteTo(), WriteFrom(), WriteServ() are now methods of userrec.
Write_NoFormat(), WriteTo_NoFormat(), WriteFrom_NoFormat(), WriteServ_NoFormat() are now std::string-taking overloaded methods of the functions above
All modules updated to use new syntax, my fingers hurt :(
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4798 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/globals.h | 6 | ||||
-rw-r--r-- | include/helperfuncs.h | 8 | ||||
-rw-r--r-- | include/modules.h | 34 | ||||
-rw-r--r-- | include/u_listmode.h | 6 | ||||
-rw-r--r-- | include/users.h | 18 |
5 files changed, 22 insertions, 50 deletions
diff --git a/include/globals.h b/include/globals.h index ea09f4227..6c51e1834 100644 --- a/include/globals.h +++ b/include/globals.h @@ -32,11 +32,7 @@ typedef std::vector< KeyVal > KeyValList; typedef std::multimap< std::string, KeyValList > ConfigDataHash; void WriteOpers(char* text, ...); -void log(int level, char *text, ...); -void Write(int sock,char *text, ...); -void WriteServ(int sock, char* text, ...); -void WriteFrom(int sock, userrec *user,char* text, ...); -void WriteTo(userrec *source, userrec *dest,char *data, ...); +void do_log(int level, char *text, ...); int common_channels(userrec *u, userrec *u2); void WriteCommon(userrec *u, char* text, ...); void WriteCommonExcept(userrec *u, char* text, ...); diff --git a/include/helperfuncs.h b/include/helperfuncs.h index 0ef5d4691..64b668769 100644 --- a/include/helperfuncs.h +++ b/include/helperfuncs.h @@ -48,18 +48,10 @@ void do_log(int level, const char *text, ...); void readfile(file_cache &F, const char* fname); -void Write(int sock,char *text, ...); -void WriteServ(int sock, char* text, ...); -void WriteFrom(int sock, userrec *user,char* text, ...); -void WriteTo(userrec *source, userrec *dest,char *data, ...); void WriteCommon(userrec *u, char* text, ...); void WriteCommonExcept(userrec *u, char* text, ...); void WriteOpers(const char* text, ...); -void Write_NoFormat(int sock,const char *text); -void WriteServ_NoFormat(int sock, const char* text); -void WriteFrom_NoFormat(int sock, userrec *user,const char* text); -void WriteTo_NoFormat(userrec *source, userrec *dest,const char *data); void WriteCommon_NoFormat(userrec *u, const char* text); void WriteCommonExcept_NoFormat(userrec *u, const char* text); void WriteOpers_NoFormat(const char* text); diff --git a/include/modules.h b/include/modules.h index 07e13eb20..a7f18fecd 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1327,40 +1327,6 @@ class Server : public Extensible */ virtual void Log(int level, const std::string &s); - /** Sends a line of text down a TCP/IP socket. - * This method writes a line of text to an established socket, cutting it to 510 characters - * plus a carriage return and linefeed if required. - */ - virtual void Send(int Socket, const std::string &s); - - /** Sends text from the server to a socket. - * This method writes a line of text to an established socket, with the servername prepended - * as used by numerics (see RFC 1459) - */ - virtual void SendServ(int Socket, const std::string &s); - - /** Sends text from a user to a socket. - * This method writes a line of text to an established socket, with the given user's nick/ident - * /host combination prepended, as used in PRIVSG etc commands (see RFC 1459) - */ - virtual void SendFrom(int Socket, userrec* User, const std::string &s); - - /** Sends text from a user to another user. - * This method writes a line of text to a user, with a user's nick/ident - * /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459) - * If you specify NULL as the source, then the data will originate from the - * local server, e.g. instead of: - * - * :user!ident@host TEXT - * - * The format will become: - * - * :localserver TEXT - * - * Which is useful for numerics and server notices to single users, etc. - */ - virtual void SendTo(userrec* Source, userrec* Dest, const std::string &s); - /** Returns true if two users share a common channel. * This method is used internally by the NICK and QUIT commands, and the Server::SendCommon * method. diff --git a/include/u_listmode.h b/include/u_listmode.h index b656196e9..b3958caa2 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -92,10 +92,10 @@ class ListModeBase : public ModeHandler { for(modelist::iterator it = el->begin(); it != el->end(); it++) { - WriteServ(user->fd, "%s %s %s %s %s %s", listnumeric.c_str(), user->nick, channel->name, it->mask.c_str(), it->nick.c_str(), it->time.c_str()); + user->WriteServ( "%s %s %s %s %s %s", listnumeric.c_str(), user->nick, channel->name, it->mask.c_str(), it->nick.c_str(), it->time.c_str()); } } - WriteServ(user->fd, "%s %s %s %s", endoflistnumeric.c_str(), user->nick, channel->name, endofliststring.c_str()); + user->WriteServ( "%s %s %s %s", endoflistnumeric.c_str(), user->nick, channel->name, endofliststring.c_str()); } virtual void DoRehash() @@ -211,7 +211,7 @@ class ListModeBase : public ModeHandler /* List is full, give subclass a chance to send a custom message */ if(!TellListTooLong(source, channel, parameter)) { - WriteServ(source->fd, "478 %s %s %s :Channel ban/ignore list is full", source->nick, channel->name, parameter.c_str()); + source->WriteServ("478 %s %s %s :Channel ban/ignore list is full", source->nick, channel->name, parameter.c_str()); } parameter = ""; diff --git a/include/users.h b/include/users.h index 30111870d..689f26e19 100644 --- a/include/users.h +++ b/include/users.h @@ -557,6 +557,24 @@ class userrec : public connection */ long LocalCloneCount(); + /** TO this user + */ + void Write(const std::string &text); + void Write(const char *text, ...); + /** FROM server to this user + */ + void WriteServ(const std::string& text); + void WriteServ(const char* text, ...); + /** FROM another user TO this user + */ + void WriteFrom(userrec *user, const std::string &text); + void WriteFrom(userrec *user, const char* text, ...); + /** TO another user FROM this user + */ + void WriteTo(userrec *dest, const std::string &data); + void WriteTo(userrec *dest, const char *data, ...); + + /** Default destructor */ virtual ~userrec(); |