diff options
-rw-r--r-- | src/command_parse.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 16 |
2 files changed, 26 insertions, 16 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 2dd9a16cc..e56005751 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -1,4 +1,4 @@ -/* +------------------------------------+ + /* +------------------------------------+ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * @@ -452,25 +452,21 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) bool CommandParser::RemoveCommands(const char* source) { - bool go_again = true; + nspace::hash_map<std::string,command_t*>::iterator i, safeiter, last_iter; + last_iter = cmdlist.begin(); - while (go_again) + for (i = cmdlist.begin(); i != cmdlist.end(); i++) { - go_again = false; - - for (nspace::hash_map<std::string,command_t*>::iterator i = cmdlist.begin(); i != cmdlist.end(); i++) + if (i->second->source == std::string(source)) { - command_t* x = i->second; - if (x->source == std::string(source)) - { - ServerInstance->Log(DEBUG,"removecommands(%s) Removing dependent command: %s",x->source.c_str(),x->command.c_str()); - cmdlist.erase(i); - go_again = true; - break; - } + ServerInstance->Log(DEBUG, "removecommands(%s) Removing dependent command: %s", i->second->source.c_str(), i->second->command.c_str()); + safeiter = i; + i = last_iter; + cmdlist.erase(safeiter); + continue; } + last_iter = i; } - return true; } diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index f1384255c..f423f7617 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1627,6 +1627,20 @@ class TreeSocket : public InspSocket else created = true; /* don't perform deops, and set TS to correct time after processing. */ + /* Check if there are any local users on this channel. If there are not, set created = true. + * If there are no local users here, theres no need for us to bounce the modes, we leave this + * to servers which do have local users and save some bandwidth and prevent spurious deops + */ + if (!created) + { + CUList elist; + TreeServerList list; + Utils->GetListOfServersForChannel(chan, list, 0, elist); + if (list.find(Utils->TreeRoot) == list.end()) + created = true; + } + + /* In 1.1, if they have the newer channel, we immediately clear * all status modes from our users. We then accept their modes. * If WE have the newer channel its the other side's job to do this. @@ -1642,11 +1656,11 @@ class TreeSocket : public InspSocket chan->WriteChannelWithServ(Instance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name, chan->name, ourTS, TS); ourTS = TS; - param_list.push_back(channel); /* Zap all the privilage modes on our side, if the channel exists here */ if (!created) { + param_list.push_back(channel); this->RemoveStatus(Instance->Config->ServerName, param_list); chan->age = TS; } |