]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cull_list.cpp
Add sanity checks to the ssl modules so that theres no possibility of an out of range...
[user/henk/code/inspircd.git] / src / cull_list.cpp
index 4578b2a7603c868f83597d2329483b37418ba7db..a1e4aa99825fa710ec094b0700a088a46b153422 100644 (file)
  */
 
 #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;
@@ -30,6 +30,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 +38,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 +89,19 @@ void CullList::AddItem(userrec* user, const char* reason, const char* o_reason)
        }
 }
 
+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();
@@ -109,9 +133,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, oper_reason));
                }
 
                FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(a->GetUser()));
@@ -141,9 +165,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();
                }
 
@@ -156,7 +190,7 @@ int CullList::Apply()
                                        ServerInstance->local_users.erase(x);
                        }
                        ServerInstance->clientlist->erase(iter);
-                       DELETE(a->GetUser());
+                       delete a->GetUser();
                }
 
                list.erase(list.begin());