diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/QXmppPingIq.cpp | 3 | ||||
| -rw-r--r-- | source/QXmppStream.cpp | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/source/QXmppPingIq.cpp b/source/QXmppPingIq.cpp index ccf34cf6..3b29139d 100644 --- a/source/QXmppPingIq.cpp +++ b/source/QXmppPingIq.cpp @@ -34,7 +34,8 @@ QXmppPingIq::QXmppPingIq() : QXmppIq(QXmppIq::Get) bool QXmppPingIq::isPingIq( QDomElement &element ) { QDomElement pingElement = element.firstChildElement("ping"); - return (pingElement.namespaceURI() == ns_ping); + return (element.attribute("type") == "get" && + pingElement.namespaceURI() == ns_ping); } void QXmppPingIq::toXmlElementFromChild(QXmlStreamWriter *writer) const diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp index 7d252a35..33394e48 100644 --- a/source/QXmppStream.cpp +++ b/source/QXmppStream.cpp @@ -41,6 +41,7 @@ #include "QXmppDataIq.h" #include "QXmppRpcIq.h" #include "QXmppIbbTransferManager.h" +#include "QXmppPingIq.h" #include "QXmppLogger.h" #include "QXmppUtils.h" @@ -572,6 +573,15 @@ void QXmppStream::parser(const QByteArray& data) sendNonSASLAuth(plainText); } } + // XEP-0199 ping + else if(QXmppPingIq::isPingIq(nodeRecv)) + { + QXmppIq iq(QXmppIq::Result); + iq.setId(id); + iq.setTo(from); + iq.setFrom(to); + sendPacket(iq); + } else // didn't understant the iq...reply with error { if(type != "result") // but not incase of result iqs |
