bool QXmppVersionManager::handleStanza(const QDomElement &element) { if (element.tagName() == "iq" && QXmppVersionIq::isVersionIq(element)) { QXmppVersionIq versionIq; versionIq.parse(element); if(versionIq.type() == QXmppIq::Get) { // respond to query QXmppVersionIq responseIq; responseIq.setType(QXmppIq::Result); responseIq.setId(versionIq.id()); responseIq.setTo(versionIq.from()); responseIq.setName(clientName()); responseIq.setVersion(clientVersion()); responseIq.setOs(clientOs()); client()->sendPacket(responseIq); } emit versionReceived(versionIq); return true; } return false; }
bool XmppServerVersion::handleStanza(const QDomElement &element) { if (element.attribute("to") != server()->domain()) return false; // XEP-0092: Software Version if(QXmppVersionIq::isVersionIq(element)) { QXmppVersionIq versionIq; versionIq.parse(element); if (versionIq.type() == QXmppIq::Get) { QXmppVersionIq responseIq; responseIq.setType(QXmppIq::Result); responseIq.setId(versionIq.id()); responseIq.setTo(versionIq.from()); responseIq.setName(qApp->applicationName()); responseIq.setVersion(qApp->applicationVersion()); server()->sendPacket(responseIq); } return true; } return false; }