X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fnetburst.cpp;h=21404e68ee2c1e54b657874c3560b2f80f1ddf28;hb=e9e75e50bc25e67af22dd88b39b12217a553d5cb;hp=a77623bfce10dcd9590a417670d6ce877b8ed6af;hpb=bf0fad3b3b2afeb55bba26fd9e8e6f947e980878;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index a77623bfc..21404e68e 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -44,7 +44,7 @@ void TreeSocket::DoBurst(TreeServer* s) /* send our version string */ this->WriteLine(":" + ServerInstance->Config->GetSID() + " VERSION :"+ServerInstance->GetVersionString()); /* Send server tree */ - this->SendServers(Utils->TreeRoot,s,1); + this->SendServers(Utils->TreeRoot, s); /* Send users and their oper status */ this->SendUsers(); @@ -57,16 +57,14 @@ void TreeSocket::DoBurst(TreeServer* s) ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+ s->GetName()+"\2."); } -/** Recursively send the server tree with distances as hops. +/** Recursively send the server tree. * This is used during network burst to inform the other server * (and any of ITS servers too) of what servers we know about. * If at any point any of these servers already exist on the other - * end, our connection may be terminated. The hopcounts given - * by this function are relative, this doesn't matter so long as - * they are all >1, as all the remote servers re-calculate them - * to be relative too, with themselves as hop 0. + * end, our connection may be terminated. + * The hopcount parameter (3rd) is deprecated, and is always 0. */ -void TreeSocket::SendServers(TreeServer* Current, TreeServer* s, int hops) +void TreeSocket::SendServers(TreeServer* Current, TreeServer* s) { char command[MAXBUF]; for (unsigned int q = 0; q < Current->ChildCount(); q++) @@ -75,13 +73,13 @@ void TreeSocket::SendServers(TreeServer* Current, TreeServer* s, int hops) if (recursive_server != s) { std::string recursive_servername = recursive_server->GetName(); - snprintf(command, MAXBUF, ":%s SERVER %s * %d %s :%s", Current->GetID().c_str(), recursive_servername.c_str(), hops, + snprintf(command, MAXBUF, ":%s SERVER %s * 0 %s :%s", Current->GetID().c_str(), recursive_servername.c_str(), recursive_server->GetID().c_str(), recursive_server->GetDesc().c_str()); this->WriteLine(command); this->WriteLine(":"+recursive_server->GetID()+" VERSION :"+recursive_server->GetVersion()); /* down to next level */ - this->SendServers(recursive_server, s, hops+1); + this->SendServers(recursive_server, s); } } } @@ -104,7 +102,7 @@ void TreeSocket::SendFJoins(Channel* c) for (UserMembCIter i = ulist->begin(); i != ulist->end(); ++i) { const std::string& modestr = i->second->modes; - if ((line.length() + modestr.length() + (UUID_LENGTH-1) + 2) > 480) + if ((line.length() + modestr.length() + UIDGenerator::UUID_LENGTH + 2) > 480) { this->WriteLine(line); line.erase(erase_from); @@ -159,7 +157,10 @@ void TreeSocket::SyncChannel(Channel* chan) char data[MAXBUF]; SendFJoins(chan); - if (!chan->topic.empty()) + + // If the topic was ever set, send it, even if it's empty now + // because a new empty topic should override an old non-empty topic + if (chan->topicset != 0) { snprintf(data,MAXBUF,":%s FTOPIC %s %lu %lu %s :%s", ServerInstance->Config->GetSID().c_str(), chan->name.c_str(), (unsigned long) chan->age, (unsigned long)chan->topicset, chan->setby.c_str(), chan->topic.c_str()); this->WriteLine(data);