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;
}
示例#2
0
void BookmarkStorage::onResultReady(const Payload::Ptr &node,
									PrivateXml::Result result, const Error::Ptr &error)
{
	Q_UNUSED(error);
	jreenDebug() << "onResultReady";
	if(result == PrivateXml::RequestOk) {
		Bookmark *bookmark = se_cast<Bookmark*>(node.data());
		jreenDebug() << "received bookmarks" << bookmark << node.data();
		if (bookmark)
			emit bookmarksReceived(node.staticCast<Bookmark>());
		else
			emit bookmarksReceived(Bookmark::Ptr::create());
	}
}