summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/cull_list.h2
-rw-r--r--include/users.h2
-rw-r--r--src/cull_list.cpp16
-rw-r--r--src/userprocess.cpp2
-rw-r--r--src/users.cpp6
5 files changed, 23 insertions, 5 deletions
diff --git a/include/cull_list.h b/include/cull_list.h
index e20eb1dd0..ca7189f4c 100644
--- a/include/cull_list.h
+++ b/include/cull_list.h
@@ -51,6 +51,7 @@ class CullItem
* @param r The quit reason of the added user
*/
CullItem(userrec* u, std::string &r);
+ CullItem(userrec* u, const char* r);
/** Returns a pointer to the user
*/
userrec* GetUser();
@@ -105,6 +106,7 @@ class CullList
* @param reason The quit reason of the user being added
*/
void AddItem(userrec* user, std::string &reason);
+ void AddItem(userrec* user, const char* reason);
/** Applies the cull list, quitting all the users
* on the list with their quit reasons all at once.
* This is a very fast operation compared to
diff --git a/include/users.h b/include/users.h
index e7ad4b9d9..073ba3624 100644
--- a/include/users.h
+++ b/include/users.h
@@ -311,7 +311,7 @@ class userrec : public connection
/** Returns the write error which last occured on this connection or an empty string
* if none occured.
*/
- std::string GetWriteError();
+ const char* GetWriteError();
/** Adds to the user's write buffer.
* You may add any amount of text up to this users sendq value, if you exceed the
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index a8188701a..b7254fd0b 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -87,6 +87,12 @@ CullItem::CullItem(userrec* u, std::string &r)
this->reason = r;
}
+CullItem::CullItem(userrec* u, const char* r)
+{
+ this->user = u;
+ this->reason = r;
+}
+
userrec* CullItem::GetUser()
{
return this->user;
@@ -113,6 +119,16 @@ void CullList::AddItem(userrec* user, std::string &reason)
}
}
+void CullList::AddItem(userrec* user, const char* reason)
+{
+ if (exempt.find(user) == exempt.end())
+ {
+ CullItem item(user,reason);
+ list.push_back(item);
+ exempt[user] = user->signon;
+ }
+}
+
int CullList::Apply()
{
int n = 0;
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 30f7d49f8..0c72a53b5 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -404,7 +404,7 @@ void DoBackgroundUserStuff(time_t TIME)
*/
curr->FlushWriteBuf();
- if (curr->GetWriteError() != "")
+ if (*curr->GetWriteError())
{
GlobalGoners.AddItem(curr,curr->GetWriteError());
continue;
diff --git a/src/users.cpp b/src/users.cpp
index a0929d684..3b6a10197 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -357,7 +357,7 @@ std::string userrec::GetBuffer()
void userrec::AddWriteBuf(std::string data)
{
- if (this->GetWriteError() != "")
+ if (*this->GetWriteError())
return;
if (sendq.length() + data.length() > (unsigned)this->sendqmax)
{
@@ -405,9 +405,9 @@ void userrec::SetWriteError(std::string error)
this->WriteError = error;
}
-std::string userrec::GetWriteError()
+const char* userrec::GetWriteError()
{
- return this->WriteError;
+ return this->WriteError.c_str();
}
void AddOper(userrec* user)