diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-01 12:09:47 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-01 12:09:47 +0000 |
| commit | 9d2948db0eb57f2087685b9e711bcef38dfa3394 (patch) | |
| tree | 2741f4cd8ce5fbf0582e9b7539d010924cd7c99c /source | |
| parent | b41ac3387971d843e9db0785d7f693d5cb828461 (diff) | |
| download | qxmpp-9d2948db0eb57f2087685b9e711bcef38dfa3394.tar.gz | |
reply to server -> client XMPP Ping (XEP-1099)
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 |
