QXmppRemoteMethod.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2008-2012 The QXmpp developers
  3. *
  4. * Authors:
  5. * Ian Reinhart Geiser
  6. *
  7. * Source:
  8. * http://code.google.com/p/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. #ifndef QXMPPREMOTEMETHOD_H
  24. #define QXMPPREMOTEMETHOD_H
  25. #include <QObject>
  26. #include <QVariant>
  27. #include "QXmppRpcIq.h"
  28. class QXmppClient;
  29. struct QXmppRemoteMethodResult {
  30. QXmppRemoteMethodResult() : hasError(false), code(0) { }
  31. bool hasError;
  32. int code;
  33. QString errorMessage;
  34. QVariant result;
  35. };
  36. class QXMPP_EXPORT QXmppRemoteMethod : public QObject
  37. {
  38. Q_OBJECT
  39. public:
  40. QXmppRemoteMethod(const QString &jid, const QString &method, const QVariantList &args, QXmppClient *client);
  41. QXmppRemoteMethodResult call( );
  42. private slots:
  43. void gotError( const QXmppRpcErrorIq &iq );
  44. void gotResult( const QXmppRpcResponseIq &iq );
  45. signals:
  46. void callDone();
  47. private:
  48. QXmppRpcInvokeIq m_payload;
  49. QXmppClient *m_client;
  50. QXmppRemoteMethodResult m_result;
  51. };
  52. #endif // QXMPPREMOTEMETHOD_H