*/
#include "inspircd.h"
-#include "users.h"
#include "cull_list.h"
CullItem::CullItem(userrec* u, std::string &r, const char* o_reason)
{
this->user = u;
this->reason = r;
+ this->silent = false;
/* Seperate oper reason not set, use the user reason */
if (*o_reason)
this->oper_reason = o_reason;
{
this->user = u;
this->reason = r;
+ this->silent = false;
/* Seperate oper reason not set, use the user reason */
if (*o_reason)
this->oper_reason = o_reason;
this->oper_reason = r;
}
+void CullItem::MakeSilent()
+{
+ this->silent = true;
+}
+
+bool CullItem::IsSilent()
+{
+ return this->silent;
+}
+
CullItem::~CullItem()
{
}
}
}
+void CullList::MakeSilent(userrec* user)
+{
+ for (std::vector<CullItem>::iterator a = list.begin(); a != list.end(); ++a)
+ {
+ if (a->GetUser() == user)
+ {
+ a->MakeSilent();
+ break;
+ }
+ }
+ return;
+}
+
int CullList::Apply()
{
int n = list.size();
user_hash::iterator iter = ServerInstance->clientlist->find(a->GetUser()->nick);
std::map<userrec*, userrec*>::iterator exemptiter = exempt.find(a->GetUser());
+ const char* preset_reason = a->GetUser()->GetOperQuit();
std::string reason = a->GetReason();
- std::string oper_reason = a->GetOperReason();
+ std::string oper_reason = *preset_reason ? preset_reason : a->GetOperReason();
if (reason.length() > MAXQUIT - 1)
reason.resize(MAXQUIT - 1);
if (IS_LOCAL(a->GetUser()))
{
- a->GetUser()->Write("ERROR :Closing link (%s@%s) [%s]",a->GetUser()->ident,a->GetUser()->host,reason.c_str());
+ a->GetUser()->Write("ERROR :Closing link (%s@%s) [%s]", a->GetUser()->ident, a->GetUser()->host, oper_reason.c_str());
if ((!a->GetUser()->sendq.empty()) && (!(*a->GetUser()->GetWriteError())))
a->GetUser()->FlushWriteBuf();
}
if (a->GetUser()->registered == REG_ALL)
{
+ FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(), reason, oper_reason));
a->GetUser()->PurgeEmptyChannels();
a->GetUser()->WriteCommonQuit(reason, oper_reason);
- FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(),reason));
}
FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(a->GetUser()));
if (a->GetUser()->registered == REG_ALL)
{
if (IS_LOCAL(a->GetUser()))
- ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]",a->GetUser()->nick,a->GetUser()->ident,a->GetUser()->host,reason.c_str());
+ {
+ if (!a->IsSilent())
+ {
+ ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]",a->GetUser()->nick,a->GetUser()->ident,a->GetUser()->host,oper_reason.c_str());
+ }
+ }
else
- ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]",a->GetUser()->server,a->GetUser()->nick,a->GetUser()->ident,a->GetUser()->host,reason.c_str());
+ {
+ if ((!ServerInstance->SilentULine(a->GetUser()->server)) && (!a->IsSilent()))
+ {
+ ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]",a->GetUser()->server,a->GetUser()->nick,a->GetUser()->ident,a->GetUser()->host,oper_reason.c_str());
+ }
+ }
a->GetUser()->AddToWhoWas();
}
}
return n;
}
+