1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 23:33:12 +02:00

Don't delete users immediately when quit or killed, instead wait until message processing is done

This commit is contained in:
Adam
2013-01-03 11:41:32 -05:00
parent 827469600e
commit 098157dca8
25 changed files with 133 additions and 114 deletions
+14 -1
View File
@@ -158,15 +158,28 @@ namespace Anope
/**
* Trim leading and trailing white spaces from the string.
*/
inline string& trim()
inline string& ltrim()
{
while (!this->_string.empty() && isspace(this->_string[0]))
this->_string.erase(this->_string.begin());
return *this;
}
inline string& rtrim()
{
while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1]))
this->_string.erase(this->_string.length() - 1);
return *this;
}
inline string& trim()
{
this->ltrim();
this->rtrim();
return *this;
}
/**
* Clears the string.
*/
+1 -1
View File
@@ -54,7 +54,7 @@ class CoreExport CommandSource
/* The nick executing the command */
Anope::string nick;
/* User executing the command, may be NULL */
Reference<User> u;
User *u;
public:
/* The account executing the command */
Reference<NickCore> nc;
+1 -1
View File
@@ -291,7 +291,7 @@ class CoreExport Module : public Extensible
* @param u The connecting user.
* @param exempt set to true/is true if the user should be excepted from bans etc
*/
virtual void OnUserConnect(Reference<User> &u, bool &exempt) { }
virtual void OnUserConnect(User *u, bool &exempt) { }
/** Called when a new server connects to the network.
* @param s The server that has connected to the network
+4 -6
View File
@@ -261,10 +261,10 @@ class CoreExport Socket : public Flags<SocketFlag>
class CoreExport BufferedSocket : public virtual Socket
{
protected:
/* Things read from the socket */
Anope::string read_buffer;
/* Things to be written to the socket */
Anope::string write_buffer;
/* Part of a message sent from the server, but not totally received */
Anope::string extra_buf;
/* How much data was received from this socket on this recv() */
int recv_len;
@@ -282,11 +282,9 @@ class CoreExport BufferedSocket : public virtual Socket
*/
bool ProcessWrite() anope_override;
/** Called with a line received from the socket
* @param buf The line
* @return true to continue reading, false to drop the socket
/** Gets the new line from the input buffer, if any
*/
virtual bool Read(const Anope::string &buf);
const Anope::string GetLine();
/** Write to the socket
* @param message The message
+3 -3
View File
@@ -26,9 +26,9 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket
public:
UplinkSocket();
~UplinkSocket();
bool Read(const Anope::string &);
void OnConnect();
void OnError(const Anope::string &);
bool ProcessRead() anope_override;
void OnConnect() anope_override;
void OnError(const Anope::string &) anope_override;
/* A message sent over the uplink socket */
class CoreExport Message
+17
View File
@@ -32,6 +32,10 @@ extern CoreExport time_t MaxUserTime;
/* Online user and channel data. */
class CoreExport User : public virtual Base, public Extensible, public CommandReply
{
/* true if the user was quit or killed */
bool quit;
/* Users that are in the process of quitting */
static std::list<User *> quitting_users;
protected:
Anope::string vident;
Anope::string ident;
@@ -103,10 +107,12 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/
User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ssignon, const Anope::string &smodes, const Anope::string &suid = "");
protected:
/** Destroy a user.
*/
virtual ~User();
public:
/** Update the nickname of a user record accordingly, should be
* called from ircd protocol.
* @param newnick The new username
@@ -327,6 +333,13 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/
void KillInternal(const Anope::string &source, const Anope::string &reason);
/** Processes a quit for the user, and marks them as quit
* @param reason The reason for the quit
*/
void Quit(const Anope::string &reason = "");
bool Quitting() const;
/* Returns a mask that will most likely match any address the
* user will have from that location. For IP addresses, wildcards the
* appropriate subnet mask (e.g. 35.1.1.1 -> 35.*; 128.2.1.1 -> 128.2.*);
@@ -348,6 +361,10 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @return the user, if they exist
*/
static User* Find(const Anope::string &name, bool nick_only = false);
/** Quits all users who are pending to be quit
*/
static void QuitUsers();
};
#endif // USERS_H