X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcull_list.cpp;h=ee257350ed523bd3efbde751c25f0af35bebc887;hb=46ff0bed0047c4cd05828c5f46dce63176e5084b;hp=ce58273376d11f36651063fec9d14c630417d689;hpb=55107487aa7f4fae3552371d80c8bfe1584db0a3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cull_list.cpp b/src/cull_list.cpp index ce5827337..ee257350e 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -19,6 +19,7 @@ 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; @@ -30,6 +31,7 @@ CullItem::CullItem(userrec* u, const char* 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; @@ -37,6 +39,16 @@ CullItem::CullItem(userrec* u, const char* r, const char* o_reason) this->oper_reason = r; } +void CullItem::MakeSilent() +{ + this->silent = true; +} + +bool CullItem::IsSilent() +{ + return this->silent; +} + CullItem::~CullItem() { } @@ -78,6 +90,19 @@ void CullList::AddItem(userrec* user, const char* reason, const char* o_reason) } } +void CullList::MakeSilent(userrec* user) +{ + for (std::vector::iterator a = list.begin(); a != list.end(); ++a) + { + if (a->GetUser() == user) + { + a->MakeSilent(); + break; + } + } + return; +} + int CullList::Apply() { int n = list.size(); @@ -87,8 +112,9 @@ int CullList::Apply() user_hash::iterator iter = ServerInstance->clientlist->find(a->GetUser()->nick); std::map::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); @@ -108,9 +134,9 @@ int CullList::Apply() 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())); @@ -140,9 +166,19 @@ int CullList::Apply() 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,oper_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,oper_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(); }