diff options
-rw-r--r-- | include/xline.h | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 7 | ||||
-rw-r--r-- | src/xline.cpp | 10 |
3 files changed, 19 insertions, 2 deletions
diff --git a/include/xline.h b/include/xline.h index d5653f8e0..6d11256f2 100644 --- a/include/xline.h +++ b/include/xline.h @@ -142,6 +142,8 @@ class CoreExport XLine : public classbase * type of line this is. */ const std::string type; + + virtual bool IsBurstable(); }; /** KLine class @@ -184,6 +186,8 @@ class CoreExport KLine : public XLine virtual const char* Displayable(); + virtual bool IsBurstable(); + /** Ident mask (ident part only) */ char* identmask; diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index e9366ef71..86d13e96f 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -164,8 +164,11 @@ void TreeSocket::SendXLines(TreeServer* Current) { for (LookupIter i = lookup->begin(); i != lookup->end(); ++i) { - if (i->second->type == "K") - continue; + /* Is it burstable? this is better than an explicit check for type 'K'. + * We break the loop as NONE of the items in this group are worth iterating. + */ + if (!i->second->IsBurstable()) + break; snprintf(data,MAXBUF,":%s ADDLINE %s %s %s %lu %lu :%s\r\n",sn, it->c_str(), i->second->Displayable(), i->second->source, diff --git a/src/xline.cpp b/src/xline.cpp index 57e6221c4..547a54fea 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -391,6 +391,11 @@ void XLine::Apply(User* u) { } +bool XLine::IsBurstable() +{ + return true; +} + void XLine::DefaultApply(User* u, const std::string &line, bool bancache) { char sreason[MAXBUF]; @@ -595,6 +600,11 @@ const char* QLine::Displayable() return nick; } +bool KLine::IsBurstable() +{ + return false; +} + bool XLineManager::RegisterFactory(XLineFactory* xlf) { XLineFactMap::iterator n = line_factory.find(xlf->GetType()); |