QXmppMessage.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (C) 2008-2012 The QXmpp developers
  3. *
  4. * Author:
  5. * Manjeet Dahiya
  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 QXMPPMESSAGE_H
  24. #define QXMPPMESSAGE_H
  25. #include <QDateTime>
  26. #include "QXmppStanza.h"
  27. class QXmppMessagePrivate;
  28. /// \brief The QXmppMessage class represents an XMPP message.
  29. ///
  30. /// \ingroup Stanzas
  31. ///
  32. class QXMPP_EXPORT QXmppMessage : public QXmppStanza
  33. {
  34. public:
  35. /// This enum described a message type.
  36. enum Type
  37. {
  38. Error = 0,
  39. Normal,
  40. Chat,
  41. GroupChat,
  42. Headline
  43. };
  44. /// This enum describes a chat state as defined by
  45. /// XEP-0085 : Chat State Notifications.
  46. enum State
  47. {
  48. None = 0, ///< The message does not contain any chat state information.
  49. Active, ///< User is actively participating in the chat session.
  50. Inactive, ///< User has not been actively participating in the chat session.
  51. Gone, ///< User has effectively ended their participation in the chat session.
  52. Composing, ///< User is composing a message.
  53. Paused, ///< User had been composing but now has stopped.
  54. };
  55. QXmppMessage(const QString& from = "", const QString& to = "",
  56. const QString& body = "", const QString& thread = "");
  57. QXmppMessage(const QXmppMessage &other);
  58. ~QXmppMessage();
  59. QXmppMessage& operator=(const QXmppMessage &other);
  60. QString body() const;
  61. void setBody(const QString&);
  62. bool isAttentionRequested() const;
  63. void setAttentionRequested(bool requested);
  64. bool isReceiptRequested() const;
  65. void setReceiptRequested(bool requested);
  66. QString mucInvitationJid() const;
  67. void setMucInvitationJid(const QString &jid);
  68. QString mucInvitationPassword() const;
  69. void setMucInvitationPassword(const QString &password);
  70. QString mucInvitationReason() const;
  71. void setMucInvitationReason(const QString &reason);
  72. QString receiptId() const;
  73. void setReceiptId(const QString &id);
  74. QDateTime stamp() const;
  75. void setStamp(const QDateTime &stamp);
  76. QXmppMessage::State state() const;
  77. void setState(QXmppMessage::State);
  78. QString subject() const;
  79. void setSubject(const QString&);
  80. QString thread() const;
  81. void setThread(const QString&);
  82. QXmppMessage::Type type() const;
  83. void setType(QXmppMessage::Type);
  84. QString xhtml() const;
  85. void setXhtml(const QString &xhtml);
  86. /// \cond
  87. void parse(const QDomElement &element);
  88. void toXml(QXmlStreamWriter *writer) const;
  89. /// \endcond
  90. private:
  91. QSharedDataPointer<QXmppMessagePrivate> d;
  92. };
  93. #endif // QXMPPMESSAGE_H