QXmpp  Version:1.0.0
QXmppRpcManager.h
1 /*
2  * Copyright (C) 2008-2019 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 <QMap>
28 #include <QVariant>
29 
30 #include "QXmppClientExtension.h"
31 #include "QXmppInvokable.h"
32 #include "QXmppRemoteMethod.h"
33 
34 class QXmppRpcErrorIq;
35 class QXmppRpcInvokeIq;
36 class QXmppRpcResponseIq;
37 
53 
54 class QXMPP_EXPORT QXmppRpcManager : public QXmppClientExtension
55 {
56  Q_OBJECT
57 
58 public:
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;
77  virtual QList<QXmppDiscoveryIq::Identity> discoveryIdentities() const;
78  bool handleStanza(const QDomElement &element);
80 
81 signals:
83  void rpcCallResponse(const QXmppRpcResponseIq& result);
84  void rpcCallError(const QXmppRpcErrorIq &err);
86 
87 private:
88  void invokeInterfaceMethod(const QXmppRpcInvokeIq &iq);
89 
90  QMap<QString,QXmppInvokable*> m_interfaces;
91 };
92 
93 #endif
QXmppRpcManager
The QXmppRpcManager class make it possible to invoke remote methods and to expose local interfaces fo...
Definition: QXmppRpcManager.h:54
QXmppInvokable
Definition: QXmppInvokable.h:40
QXmppRpcResponseIq
The QXmppRpcResponseIq class represents an IQ used to carry an RPC response as specified by XEP-0009:...
Definition: QXmppRpcIq.h:43
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppRpcInvokeIq
The QXmppRpcInvokeIq class represents an IQ used to carry an RPC invocation as specified by XEP-0009:...
Definition: QXmppRpcIq.h:78
QXmppClientExtension::discoveryFeatures
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:54
QXmppClientExtension::discoveryIdentities
virtual QList< QXmppDiscoveryIq::Identity > discoveryIdentities() const
Definition: QXmppClientExtension.cpp:62
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.