summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/treesocket2.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-12-07 10:07:03 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-12-07 10:07:03 +0100
commit5b138fa099e1c1557362fe72a4b146a0750dde9c (patch)
treecf7299b7f4224d6579c2676de139619d61a833bc /src/modules/m_spanningtree/treesocket2.cpp
parent619c5eabb1834f2ec9e3b723243b679a62f0acd3 (diff)
m_spanningtree Try FindServerID() first if the prefix looks like a sid in TreeSocket::FindSource()
Diffstat (limited to 'src/modules/m_spanningtree/treesocket2.cpp')
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 1f98f7819..2e6961524 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -220,10 +220,20 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma
if (prefix.empty())
return MyRoot->ServerUser;
- // If the prefix string is a uuid or a sid FindUUID() returns the appropriate User object
- User* who = ServerInstance->FindUUID(prefix);
- if (who)
- return who;
+ if (prefix.size() == 3)
+ {
+ // Prefix looks like a sid
+ TreeServer* server = Utils->FindServerID(prefix);
+ if (server)
+ return server->ServerUser;
+ }
+ else
+ {
+ // If the prefix string is a uuid FindUUID() returns the appropriate User object
+ User* user = ServerInstance->FindUUID(prefix);
+ if (user)
+ return user;
+ }
// Some implementations wrongly send a server name as prefix occasionally, handle that too for now
TreeServer* const server = Utils->FindServer(prefix);
@@ -243,9 +253,9 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma
* command came from a server to avoid desync.
*/
- who = ServerInstance->FindUUID(prefix.substr(0, 3));
- if (who)
- return who;
+ TreeServer* const usersserver = Utils->FindServerID(prefix.substr(0, 3));
+ if (usersserver)
+ return usersserver->ServerUser;
return this->MyRoot->ServerUser;
}