QXmpp Version: 1.4.0
QXmppRpcManager.h
1/*
2 * Copyright (C) 2008-2021 The QXmpp developers
3 *
4 * Author:
5 * Jeremy Lainé
6 *
7 * Source:
8 * https://github.com/qxmpp-project/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24#ifndef QXMPPRPCMANAGER_H
25#define QXMPPRPCMANAGER_H
26
27#include "QXmppClientExtension.h"
28#include "QXmppInvokable.h"
29#include "QXmppRemoteMethod.h"
30
31#include <QMap>
32#include <QVariant>
33
34class QXmppRpcErrorIq;
37
53
54class QXMPP_EXPORT QXmppRpcManager : public QXmppClientExtension
55{
56 Q_OBJECT
57
58public:
60
61 void addInvokableInterface(QXmppInvokable *interface);
62 QXmppRemoteMethodResult callRemoteMethod(const QString &jid,
63 const QString &interface,
64 const QVariant &arg1 = QVariant(),
65 const QVariant &arg2 = QVariant(),
66 const QVariant &arg3 = QVariant(),
67 const QVariant &arg4 = QVariant(),
68 const QVariant &arg5 = QVariant(),
69 const QVariant &arg6 = QVariant(),
70 const QVariant &arg7 = QVariant(),
71 const QVariant &arg8 = QVariant(),
72 const QVariant &arg9 = QVariant(),
73 const QVariant &arg10 = QVariant());
74
76 QStringList discoveryFeatures() const override;
77 QList<QXmppDiscoveryIq::Identity> discoveryIdentities() const override;
78 bool handleStanza(const QDomElement &element) override;
80
81Q_SIGNALS:
83 void rpcCallResponse(const QXmppRpcResponseIq &result);
84 void rpcCallError(const QXmppRpcErrorIq &err);
86
87private:
88 void invokeInterfaceMethod(const QXmppRpcInvokeIq &iq);
89
90 QMap<QString, QXmppInvokable *> m_interfaces;
91};
92
93#endif
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:54
virtual QList< QXmppDiscoveryIq::Identity > discoveryIdentities() const
Definition: QXmppClientExtension.cpp:62
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
Definition: QXmppInvokable.h:41
The QXmppRpcInvokeIq class represents an IQ used to carry an RPC invocation as specified by XEP-0009:...
Definition: QXmppRpcIq.h:80
The QXmppRpcManager class make it possible to invoke remote methods and to expose local interfaces fo...
Definition: QXmppRpcManager.h:55
The QXmppRpcResponseIq class represents an IQ used to carry an RPC response as specified by XEP-0009:...
Definition: QXmppRpcIq.h:45