]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree.cpp
TimeSyncTimer now uses repeat timer.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree.cpp
index e960948ac280813b952c4280519dc3128426b2d4..df302a7bff221a9a5d8ef0d74b4b1a91fedd8bb1 100644 (file)
@@ -1904,7 +1904,7 @@ class TreeSocket : public InspSocket
                {
                        _new->modes[(*v)-65] = 1;
                        /* For each mode thats set, increase counter */
-                       ModeHandler* mh = Instance->Modes->FindMode((*v)-65, MODETYPE_USER);
+                       ModeHandler* mh = Instance->Modes->FindMode(*v, MODETYPE_USER);
                        if (mh)
                                mh->ChangeCount(1);
                }
@@ -2367,6 +2367,7 @@ class TreeSocket : public InspSocket
                if (u)
                {
                        u->modes[UM_OPERATOR] = 1;
+                       this->Instance->all_opers.push_back(u);
                        strlcpy(u->oper,opertype.c_str(),NICKMAX-1);
                        Utils->DoOneToAllButSender(u->nick,"OPERTYPE",params,u->server);
                        this->Instance->SNO->WriteToSnoMask('o',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick,u->ident,u->host,irc::Spacify(opertype.c_str()));
@@ -3713,12 +3714,12 @@ class ServernameResolver : public Resolver
        Link MyLink;
        SpanningTreeUtilities* Utils;
  public: 
-       ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, me), MyLink(x), Utils(Util)
+       ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), MyLink(x), Utils(Util)
        {
                /* Nothing in here, folks */
        }
 
-       void OnLookupComplete(const std::string &result)
+       void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
        {
                /* Initiate the connection, now that we have an IP to use.
                 * Passing a hostname directly to InspSocket causes it to
@@ -3763,11 +3764,11 @@ class SecurityIPResolver : public Resolver
        Link MyLink;
        SpanningTreeUtilities* Utils;
  public:
-       SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, me), MyLink(x), Utils(U)
+       SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), MyLink(x), Utils(U)
        {
        }
 
-       void OnLookupComplete(const std::string &result)
+       void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
        {
                ServerInstance->Log(DEBUG,"Security IP cache: Adding IP address '%s' for Link '%s'",result.c_str(),MyLink.Name.c_str());
                Utils->ValidIPs.push_back(result);
@@ -4121,8 +4122,9 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
                                {
                                        try
                                        {
-                                               SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L.IPAddr, L);
-                                               ServerInstance->AddResolver(sr);
+                                               bool cached;
+                                               SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L.IPAddr, L, cached);
+                                               ServerInstance->AddResolver(sr, cached);
                                        }
                                        catch (ModuleException& e)
                                        {
@@ -4652,8 +4654,9 @@ class ModuleSpanningTree : public Module
                {
                        try
                        {
-                               ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x);
-                               ServerInstance->AddResolver(snr);
+                               bool cached;
+                               ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x, cached);
+                               ServerInstance->AddResolver(snr, cached);
                        }
                        catch (ModuleException& e)
                        {
@@ -5155,6 +5158,7 @@ class ModuleSpanningTree : public Module
                        }
                }
                Utils->ReadConfiguration(false);
+               InitializeDisabledCommands(ServerInstance->Config->DisabledCommands, ServerInstance);
        }
 
        // note: the protocol does not allow direct umode +o except
@@ -5456,15 +5460,13 @@ class ModuleSpanningTree : public Module
        }
 };
 
-TimeSyncTimer::TimeSyncTimer(InspIRCd *Inst, ModuleSpanningTree *Mod) : InspTimer(43200, Inst->Time()), Instance(Inst), Module(Mod)
+TimeSyncTimer::TimeSyncTimer(InspIRCd *Inst, ModuleSpanningTree *Mod) : InspTimer(43200, Inst->Time(), true), Instance(Inst), Module(Mod)
 {
 }
 
 void TimeSyncTimer::Tick(time_t TIME)
 {
        Module->BroadcastTimeSync();
-       Module->SyncTimer = new TimeSyncTimer(Instance, Module);
-       Instance->Timers->AddTimer(Module->SyncTimer);
 }
 
 void SpanningTreeUtilities::DoFailOver(Link* x)