squawk/qomemo/device_service.cpp

31 lines
801 B
C++
Raw Normal View History

/*
* Created by victoria on 2021-05-12.
*/
#include "device_service.h"
#include <QXmppClient.h>
#include <QXmppPubSubIq.h>
#include <QDebug>
QXmpp::Omemo::DeviceService::DeviceService(QXmppClient &client, QObject *parent)
: QObject(parent), client(client) {
connect(&client, &QXmppClient::iqReceived, this,
&DeviceService::onIqReceived);
}
void QXmpp::Omemo::DeviceService::onIqReceived(const QXmppIq &iq) {
// Update OMEMO device list
}
void QXmpp::Omemo::DeviceService::fetch() {
QXmppPubSubIq fetchOwnDevices{};
fetchOwnDevices.setFrom(client.configuration().jid());
fetchOwnDevices.setTo(client.configuration().jidBare());
fetchOwnDevices.setType(QXmppIq::Get);
fetchOwnDevices.setQueryNode("urn:xmpp:omemo:1:devices");
client.sendPacket(fetchOwnDevices);
}