Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
IceSignalQXmppManager.cpp
1
2
3#include "IceSignalQXmppManager.h"
4#include "IceSignalQXmppIq.h"
5#include "IceSignalQxmpp.h"
6#include "QXmppClient.h"
7#include <QDomElement>
8#include <QLoggingCategory>
9
10Q_DECLARE_LOGGING_CATEGORY(ChannelICE)
11
13 : m_pSignal(pSignal)
14{
15}
16
17int CIceSignalQXmppManager::sendPacket(CIceSignalQXmppIq &iq)
18{
19 if(this->client()->sendPacket(iq))
20 return 0;
21 qCritical(ChannelICE) << "QXmppCallWebrtcManager::sendPacket";
22 return -1;
23}
24
25QStringList CIceSignalQXmppManager::discoveryFeatures() const
26{
27 return QStringList() << CIceSignalQXmppIq::ns();
28}
29
30bool CIceSignalQXmppManager::handleStanza(const QDomElement &element)
31{
32 if (element.tagName() != "iq")
33 return false;
34 if (!CIceSignalQXmppIq::isIceSignalIq(element))
35 return false;
36
38 iq.parse(element);
39 if(iq.type() != QXmppIq::Set)
40 {
41 qWarning(ChannelICE) << "The package is error:type:" << iq.type();
42 QXmppIq ack;
43 ack.setId(iq.id());
44 ack.setTo(iq.from());
45 ack.setType(QXmppIq::Error);
46 return true;
47 }
48
49 if(m_pSignal)
50 if(!m_pSignal->proecssIq(iq))
51 {
52 QXmppIq ack;
53 ack.setId(iq.id());
54 ack.setTo(iq.from());
55 ack.setType(QXmppIq::Error);
56 return true;
57 }
58
59 QXmppIq ack;
60 ack.setId(iq.id());
61 ack.setTo(iq.from());
62 ack.setType(QXmppIq::Result);
63 return client()->sendPacket(ack);
64
65}
QXMPP implements ICE signaling class.