summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/anope.h15
-rw-r--r--include/commands.h2
-rw-r--r--include/modules.h2
-rw-r--r--include/sockets.h10
-rw-r--r--include/uplink.h6
-rw-r--r--include/users.h17
6 files changed, 40 insertions, 12 deletions
diff --git a/include/anope.h b/include/anope.h
index bf82e6d78..5b230a1a9 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -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.
*/
diff --git a/include/commands.h b/include/commands.h
index 6935db576..1242efa72 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -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;
diff --git a/include/modules.h b/include/modules.h
index cc5bb4b07..e24bbf69a 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -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
diff --git a/include/sockets.h b/include/sockets.h
index ae7d6e798..1b9311794 100644
--- a/include/sockets.h
+++ b/include/sockets.h
@@ -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
diff --git a/include/uplink.h b/include/uplink.h
index d635bd7d3..b0d6e06d2 100644
--- a/include/uplink.h
+++ b/include/uplink.h
@@ -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
diff --git a/include/users.h b/include/users.h
index 87a18ed3f..278a5cec9 100644
--- a/include/users.h
+++ b/include/users.h
@@ -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