summaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree/protocolinterface.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2012-05-19 12:21:02 +0200
committerGravatar attilamolnar2012-05-19 12:21:02 +0200
commit14d102b7502e15ff091bd4d14a4d5d5ead9eddb3 (patch)
tree785cc591665125331a6713df58bff1013404760a /src/modules/m_spanningtree/protocolinterface.cpp
parentm_spanningtree Call ProtocolInterface::PushToClient when writing to remote cl... (diff)
downloadinspircd++-14d102b7502e15ff091bd4d14a4d5d5ead9eddb3.tar.gz
inspircd++-14d102b7502e15ff091bd4d14a4d5d5ead9eddb3.tar.bz2
inspircd++-14d102b7502e15ff091bd4d14a4d5d5ead9eddb3.zip
m_spanningtree Fix various bugs related to protocol interface and ENCAP handling
Most importantly: - Match the server name not the SID for determining if an incoming ENCAP should be processed by us - Handle the ? wildcard properly in the server name parameter of an ENCAP - Send single target ENCAPs to the destination only instead of broadcasting it - Make ProtocolInterface::SendMetaData accept TYPE_OTHER as target_type (on par with ProtoSendMetaData) instead of throwing an exception
Diffstat (limited to 'src/modules/m_spanningtree/protocolinterface.cpp')
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 6e68e2a52..9bd0263dc 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -48,7 +48,14 @@ void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
void SpanningTreeProtocolInterface::SendEncapsulatedData(parameterlist &encap)
{
- Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
+ if (encap.size() < 2)
+ return;
+
+ const std::string& target = encap[0];
+ if (target.find_first_of("*?") == std::string::npos)
+ Utils->DoOneToOne(ServerInstance->Config->GetSID(), "ENCAP", encap, target);
+ else
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
}
void SpanningTreeProtocolInterface::SendMetaData(void* target, TargetTypeFlags type, const std::string &key, const std::string &data)
@@ -63,12 +70,10 @@ void SpanningTreeProtocolInterface::SendMetaData(void* target, TargetTypeFlags t
case TYPE_CHANNEL:
params.push_back(((Channel*)target)->name);
break;
+ case TYPE_OTHER:
case TYPE_SERVER:
params.push_back("*");
break;
- default:
- throw CoreException("I don't know how to handle TYPE_OTHER.");
- break;
}
params.push_back(key);
params.push_back(":" + data);
@@ -179,7 +184,7 @@ void SpanningTreeProtocolInterface::SendUserPrivmsg(User* target, const std::str
TreeSocket* sock = serv->GetSocket();
if (sock)
{
- sock->WriteLine(":" + ServerInstance->Config->GetSID() + " PRIVMSG " + target->nick + " :"+text);
+ sock->WriteLine(":" + ServerInstance->Config->GetSID() + " PRIVMSG " + target->uuid + " :"+text);
}
}
}
@@ -192,7 +197,7 @@ void SpanningTreeProtocolInterface::SendUserNotice(User* target, const std::stri
TreeSocket* sock = serv->GetSocket();
if (sock)
{
- sock->WriteLine(":" + ServerInstance->Config->GetSID() + " NOTICE " + target->nick + " :"+text);
+ sock->WriteLine(":" + ServerInstance->Config->GetSID() + " NOTICE " + target->uuid + " :"+text);
}
}
}