]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add options:quietbursts, fixes bug #269, also adds support for quits in a cull list...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 4 May 2007 22:37:11 +0000 (22:37 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 4 May 2007 22:37:11 +0000 (22:37 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6883 e03df62e-2008-0410-955e-edbf42e46eb7

docs/inspircd.conf.example
include/cull_list.h
src/cull_list.cpp
src/modules/m_spanningtree/treeserver.cpp
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/utils.cpp
src/modules/m_spanningtree/utils.h

index c3108b9a778d1e852caf09fbe121c4ea6c66fc26..2ab450c2e6feec08727cdc872b21917b188388fc 100644 (file)
 #                  +b, as it may break some features in popular       #
 #                  clients such as mIRC.                              #
 #                                                                     #
+#  quietbursts   - When synching or splitting from the network, a     #
+#                  server can generate a lot of connect and quit      #
+#                  snotices to the +C and +Q snomasks. Setting this   #
+#                  value to yes squelches those messages, which can   #
+#                  make them more useful for opers, however it will   #
+#                  degrade their use by certain third party programs  #
+#                  such as BOPM which rely on them to scan users when #
+#                  a split heals in certain configurations.           #
+#                                                                     #
 
 <options prefixquit="Quit: "
          loglevel="default"
         disablehmac="no"
          hostintopic="yes"
         hidemodes="eI"
+        quietbursts="yes"
          allowhalfop="yes">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#- TIME SYNC OPTIONS -#-#-#-#-#-#-#-#-#-#-#-#
index beafc1e80d7eace29349e470f1bd9ccaabaff76f..bea75c86dd29b2d08c330f2b9a4ec03c55a01be8 100644 (file)
@@ -42,6 +42,9 @@ class CullItem : public classbase
        /** Holds the quit reason opers see, if different from users
         */
        std::string oper_reason;
+       /** Silent items dont generate an snotice.
+        */
+       bool silent;
  public:
        /** Constrcutor.
        * Initializes the CullItem with a user pointer
@@ -52,6 +55,9 @@ class CullItem : public classbase
        CullItem(userrec* u, std::string &r, const char* ro = "");
        CullItem(userrec* u, const char* r, const char* ro = "");
 
+       void MakeSilent();
+       bool IsSilent();
+
        ~CullItem();
 
        /** Returns a pointer to the user
@@ -111,6 +117,10 @@ class CullList : public classbase
        void AddItem(userrec* user, std::string &reason, const  char* o_reason = "");
        void AddItem(userrec* user, const char* reason, const char* o_reason = "");
 
+       /* Turn an item into a silent item
+        */
+       void MakeSilent(userrec* user);
+
        /** 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
index b0bf74ccb584906119738838eaf5c10f152d782a..ac842e248aeccdde23fabbe07eaf447234efc11e 100644 (file)
@@ -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<CullItem>::iterator a = list.begin(); a != list.end(); ++a)
+       {
+               if (a->GetUser() == user)
+               {
+                       a->MakeSilent();
+                       break;
+               }
+       }
+       return;
+}
+
 int CullList::Apply()
 {
        int n = list.size();
@@ -141,11 +166,13 @@ 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
                        {
                                if (!ServerInstance->SilentULine(a->GetUser()->server))
-                                       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 (!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();
                }
index 2bcfecf2b740ddf204fe4fbf85026cd550b3070f..0c9509adab1e9341e397bb4b98cda47d89fe5aa5 100644 (file)
@@ -144,6 +144,9 @@ int TreeServer::QuitUsers(const std::string &reason)
                                userrec::QuitUser(ServerInstance, a, "*.net *.split", reason_s);
                        else
                                userrec::QuitUser(ServerInstance, a, reason_s);
+
+                       if (this->Utils->quiet_bursts)
+                               ServerInstance->GlobalCulls.MakeSilent(a);
                }
        }
        return time_to_die.size();
index 6176d02015c178f38f1ccf5eb2157448e3fb0f23..66d223fa63fc5b13b85926355b5c138078485405 100644 (file)
@@ -1103,7 +1103,11 @@ bool TreeSocket::IntroduceClient(const std::string &source, std::deque<std::stri
 
        Instance->AddGlobalClone(_new);
 
-       if (!this->Instance->SilentULine(_new->server))
+       bool send = (!this->Instance->SilentULine(_new->server));
+       if (send)
+               send = (this->Utils->quiet_bursts && !this->bursting);
+
+       if (send)
                this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s]",_new->server,_new->nick,_new->ident,_new->host, _new->GetIPString());
 
        params[7] = ":" + params[7];
index 923308de0d8c8ee793593a9bbc1293b829a1b805..e1026ca94b750751364563bc0889bfd7d0e1188e 100644 (file)
@@ -477,6 +477,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
        EnableTimeSync = Conf->ReadFlag("timesync","enable",0);
        MasterTime = Conf->ReadFlag("timesync", "master", 0);
        ChallengeResponse = !Conf->ReadFlag("options", "disablehmac", 0);
+       quiet_bursts = Conf->ReadFlag("options", "quietbursts", 0);
        LinkBlocks.clear();
        ValidIPs.clear();
        for (int j =0; j < Conf->Enumerate("link"); j++)
index 2fd53bb43d8841062588b2b5a3800c715bdbaeb8..0e289146b9bb959bb9f230a04fc305923dec11b3 100644 (file)
@@ -63,6 +63,9 @@ class SpanningTreeUtilities
        /** Synchronize timestamps between servers
         */
        bool EnableTimeSync;
+       /** Make snomasks +CQ quiet during bursts and splits
+        */
+       bool quiet_bursts;
        /** Socket bindings for listening sockets
         */
        std::vector<TreeSocket*> Bindings;