]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/protocolinterface.cpp
Send SVSNICKs during nick collision to prevent servers that do not fully implement...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / protocolinterface.cpp
index 850a27c22de970605089162caea1168e6a2bf5fa..9f32963a02c55adb1e645b8e9b32e675a882eff9 100644 (file)
@@ -5,6 +5,10 @@
 #include "m_spanningtree/treesocket.h"
 #include "m_spanningtree/protocolinterface.h"
 
+/*
+ * For documentation on this class, see include/protocol.h.
+ */
+
 void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
 {
        sl.clear();
@@ -13,9 +17,10 @@ void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
                ProtoServer ps;
                ps.servername = i->second->GetName();
                TreeServer* s = i->second->GetParent();
-               ps.parentname = s ? s->GetName() : ServerInstance->Config->ServerName;
+               ps.parentname = s ? s->GetName() : "";
                ps.usercount = i->second->GetUserCount();
                ps.opercount = i->second->GetOperCount();
+               ps.gecos = i->second->GetDesc();
                ps.latencyms = i->second->rtt;
                sl.push_back(ps);
        }
@@ -26,7 +31,7 @@ void SpanningTreeProtocolInterface::SendEncapsulatedData(parameterlist &encap)
        Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
 }
 
-void SpanningTreeProtocolInterface::SendMetaData(void* target, int type, const std::string &key, const std::string &data)
+void SpanningTreeProtocolInterface::SendMetaData(void* target, TargetTypeFlags type, const std::string &key, const std::string &data)
 {
        parameterlist params;
 
@@ -34,13 +39,16 @@ void SpanningTreeProtocolInterface::SendMetaData(void* target, int type, const s
        {
                case TYPE_USER:
                        params.push_back(((User*)target)->uuid);
-               break;
+                       break;
                case TYPE_CHANNEL:
                        params.push_back(((Channel*)target)->name);
-               break;
+                       break;
                case TYPE_SERVER:
                        params.push_back("*");
-               break;
+                       break;
+               default:
+                       throw CoreException("I don't know how to handle TYPE_OTHER.");
+                       break;
        }
        params.push_back(key);
        params.push_back(":" + data);
@@ -183,9 +191,9 @@ void SpanningTreeProtocolInterface::Introduce(User* user)
                params.push_back(user->host);
                params.push_back(user->dhost);
                params.push_back(user->ident);
-               params.push_back("+"+std::string(user->FormatModes()));
                params.push_back(user->GetIPString());
                params.push_back(ConvToStr(user->signon));
+               params.push_back("+"+std::string(user->FormatModes(true)));
                params.push_back(":"+std::string(user->fullname));
                Utils->DoOneToMany(ServerInstance->Config->GetSID(), "UID", params);
        }