bool QXmppBookmarkManager::handleStanza(const QDomElement &stanza)
{
    if (stanza.tagName() == "iq")
    {
        if (QXmppPrivateStorageIq::isPrivateStorageIq(stanza))
        {
            QXmppPrivateStorageIq iq;
            iq.parse(stanza);

            if (iq.type() == QXmppIq::Result)
            {
                d->bookmarks = iq.bookmarks();
                d->bookmarksReceived = true;
                emit bookmarksReceived(d->bookmarks);
            }
            return true;
        }
        else if (!d->pendingId.isEmpty() && stanza.attribute("id") == d->pendingId)
        {
            QXmppIq iq;
            iq.parse(stanza);
            if (iq.type() == QXmppIq::Result)
            {
                d->bookmarks = d->pendingBookmarks;
                emit bookmarksReceived(d->bookmarks);
            }
            d->pendingId = QString();
            return true;
        }
    }
    return false;
}
Exemple #2
0
void tst_QXmppIq::testBasic()
{
    QFETCH(QByteArray, xml);
    QFETCH(int, type);

    QXmppIq iq;
    parsePacket(iq, xml);
    QCOMPARE(iq.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(iq.from(), QString("[email protected]/QXmpp"));
    QCOMPARE(int(iq.type()), type);
    serializePacket(iq, xml);
}
bool JabberErrorService::isErrorIq(const QXmppIq &iq) const
{
	return iq.type() == QXmppIq::Type::Error;
}