summaryrefslogtreecommitdiff
path: root/src/cull_list.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-06 13:49:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-06 13:49:34 +0000
commitb790abb1545fc22d0f6799f48d4b7df22711db8a (patch)
tree0fccc47a24f0285e89977302c5465f956cf854e9 /src/cull_list.cpp
parent767fc7ad41553d8f18988d2330d99c5c89f994e4 (diff)
This properly fixes options:hidebans and options:hidesplits by providing the facility to have two different quit messages for a user, one an oper sees and one a normal user sees.
There are default values on the oper_quit parameters through the entire source so that if oper_quit parameter is not given it defaults to the same as the user_quit git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6630 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cull_list.cpp')
-rw-r--r--src/cull_list.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index 2a022449f..c1a9de1a0 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -15,16 +15,26 @@
#include "users.h"
#include "cull_list.h"
-CullItem::CullItem(userrec* u, std::string &r)
+CullItem::CullItem(userrec* u, std::string &r, const char* o_reason)
{
this->user = u;
this->reason = r;
+ /* Seperate oper reason not set, use the user reason */
+ if (*o_reason)
+ this->oper_reason = o_reason;
+ else
+ this->oper_reason = r;
}
-CullItem::CullItem(userrec* u, const char* r)
+CullItem::CullItem(userrec* u, const char* r, const char* o_reason)
{
this->user = u;
this->reason = r;
+ /* Seperate oper reason not set, use the user reason */
+ if (*o_reason)
+ this->oper_reason = o_reason;
+ else
+ this->oper_reason = r;
}
CullItem::~CullItem()
@@ -41,23 +51,28 @@ std::string& CullItem::GetReason()
return this->reason;
}
+std::string& CullItem::GetOperReason()
+{
+ return this->oper_reason;
+}
+
CullList::CullList(InspIRCd* Instance) : ServerInstance(Instance)
{
list.clear();
exempt.clear();
}
-void CullList::AddItem(userrec* user, std::string &reason)
+void CullList::AddItem(userrec* user, std::string &reason, const char* o_reason)
{
- AddItem(user, reason.c_str());
+ AddItem(user, reason.c_str(), o_reason);
}
-void CullList::AddItem(userrec* user, const char* reason)
+void CullList::AddItem(userrec* user, const char* reason, const char* o_reason)
{
if (exempt.find(user) == exempt.end())
{
- CullItem item(user,reason);
+ CullItem item(user, reason, o_reason);
list.push_back(item);
exempt[user] = user;
}
@@ -73,9 +88,12 @@ int CullList::Apply()
user_hash::iterator iter = ServerInstance->clientlist->find(a->GetUser()->nick);
std::map<userrec*, userrec*>::iterator exemptiter = exempt.find(a->GetUser());
std::string reason = a->GetReason();
+ std::string oper_reason = a->GetOperReason();
if (reason.length() > MAXQUIT - 1)
reason.resize(MAXQUIT - 1);
+ if (oper_reason.length() > MAXQUIT - 1)
+ oper_reason.resize(MAXQUIT - 1);
if (a->GetUser()->registered != REG_ALL)
if (ServerInstance->unregistered_count)
@@ -91,7 +109,7 @@ int CullList::Apply()
if (a->GetUser()->registered == REG_ALL)
{
a->GetUser()->PurgeEmptyChannels();
- a->GetUser()->WriteCommonExcept("QUIT :%s",reason.c_str());
+ a->GetUser()->WriteCommonQuit(reason, oper_reason);
FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(),reason));
}