diff options
author | Olli Salli <ollisal@gmail.com> | 2011-10-09 15:04:08 +0300 |
---|---|---|
committer | Olli Salli <ollisal@gmail.com> | 2011-10-10 19:17:43 +0300 |
commit | c71a673c243b781ec67cdfcc33a903f31958891b (patch) | |
tree | 42037522af5c63eaccafdf98f4dc76ce6fe7792d /qt4 | |
parent | c88a8eb6ddc04156e39fe4060e8d6cd1c13fd70f (diff) |
Make StreamTubeServer report TCP conns through CMs with no Port AC support too, with a null src addr
Diffstat (limited to 'qt4')
-rw-r--r-- | qt4/TelepathyQt4/stream-tube-server.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/qt4/TelepathyQt4/stream-tube-server.cpp b/qt4/TelepathyQt4/stream-tube-server.cpp index 93ddcc7bc..67ad601b8 100644 --- a/qt4/TelepathyQt4/stream-tube-server.cpp +++ b/qt4/TelepathyQt4/stream-tube-server.cpp @@ -636,12 +636,22 @@ QHash<QPair<QHostAddress /* sourceAddress */, quint16 /* sourcePort */>, QHash<QPair<QHostAddress,quint16>, uint> srcAddrConns = tube.channel()->connectionsForSourceAddresses(); - QHash<uint, Tp::ContactPtr> connContacts = + QHash<uint, ContactPtr> connContacts = tube.channel()->contactsForConnections(); + QPair<QHostAddress, quint16> srcAddr; - foreach(srcAddr, srcAddrConns.keys()) { - conns.insert(srcAddr, - RemoteContact(tube.account(), connContacts.value(srcAddrConns.value(srcAddr)))); + foreach (srcAddr, srcAddrConns.keys()) { + ContactPtr contact = connContacts.take(srcAddrConns.value(srcAddr)); + conns.insert(srcAddr, RemoteContact(tube.account(), contact)); + } + + // The remaining values in our copy of connContacts are those which didn't have a + // corresponding source address, probably because the service doesn't properly implement + // Port AC + foreach (const ContactPtr &contact, connContacts.values()) { + // Insert them with an invalid source address as the key + conns.insertMulti(qMakePair(QHostAddress(QHostAddress::Null), quint16(0)), + RemoteContact(tube.account(), contact)); } } |