QXmpp  Version:1.0.0
QXmppMessage.h
1 /*
2  * Copyright (C) 2008-2019 The QXmpp developers
3  *
4  * Author:
5  * Manjeet Dahiya
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 
25 #ifndef QXMPPMESSAGE_H
26 #define QXMPPMESSAGE_H
27 
28 #include <QDateTime>
29 #include "QXmppStanza.h"
30 
31 class QXmppMessagePrivate;
32 
37 
38 class QXMPP_EXPORT QXmppMessage : public QXmppStanza
39 {
40 public:
42  enum Type
43  {
44  Error = 0,
45  Normal,
46  Chat,
47  GroupChat,
48  Headline
49  };
50 
53  enum State
54  {
55  None = 0,
58  Gone,
60  Paused
61  };
62 
65  enum Marker {
66  NoMarker = 0,
67  Received,
68  Displayed,
69  Acknowledged
70  };
71 
72  QXmppMessage(const QString& from = QString(), const QString& to = QString(),
73  const QString& body = QString(), const QString& thread = QString());
74 
75  QXmppMessage(const QXmppMessage &other);
76  ~QXmppMessage();
77 
78  QXmppMessage& operator=(const QXmppMessage &other);
79 
80  QString body() const;
81  void setBody(const QString&);
82 
83  bool isAttentionRequested() const;
84  void setAttentionRequested(bool requested);
85 
86  bool isReceiptRequested() const;
87  void setReceiptRequested(bool requested);
88 
89  QString mucInvitationJid() const;
90  void setMucInvitationJid(const QString &jid);
91 
92  QString mucInvitationPassword() const;
93  void setMucInvitationPassword(const QString &password);
94 
95  QString mucInvitationReason() const;
96  void setMucInvitationReason(const QString &reason);
97 
98  QString receiptId() const;
99  void setReceiptId(const QString &id);
100 
101  QDateTime stamp() const;
102  void setStamp(const QDateTime &stamp);
103 
104  QXmppMessage::State state() const;
105  void setState(QXmppMessage::State);
106 
107  QString subject() const;
108  void setSubject(const QString&);
109 
110  QString thread() const;
111  void setThread(const QString&);
112 
113  QXmppMessage::Type type() const;
114  void setType(QXmppMessage::Type);
115 
116  QString xhtml() const;
117  void setXhtml(const QString &xhtml);
118 
119  // XEP-0333
120  bool isMarkable() const;
121  void setMarkable(const bool);
122 
123  QString markedId() const;
124  void setMarkerId(const QString&);
125 
126  QString markedThread() const;
127  void setMarkedThread(const QString&);
128 
129  Marker marker() const;
130  void setMarker(const Marker);
131 
132  // XEP-0280: Message Carbons
133  bool isPrivate() const;
134  void setPrivate(const bool);
135 
136  bool isXmppStanza() const;
137 
138  // XEP-0066: Out of Band Data
139  QString outOfBandUrl() const;
140  void setOutOfBandUrl(const QString&);
141 
142  // XEP-0308: Last Message Correction
143  QString replaceId() const;
144  void setReplaceId(const QString&);
145 
147  void parse(const QDomElement &element);
148  void toXml(QXmlStreamWriter *writer) const;
150 
151 private:
152  QSharedDataPointer<QXmppMessagePrivate> d;
153 };
154 
155 #endif // QXMPPMESSAGE_H
State
Definition: QXmppMessage.h:53
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:90
User is composing a message.
Definition: QXmppMessage.h:59
virtual bool isXmppStanza() const
Definition: QXmppStanza.cpp:492
User has effectively ended their participation in the chat session.
Definition: QXmppMessage.h:58
Marker
Definition: QXmppMessage.h:65
User is actively participating in the chat session.
Definition: QXmppMessage.h:56
User has not been actively participating in the chat session.
Definition: QXmppMessage.h:57
Type
This enum described a message type.
Definition: QXmppMessage.h:42
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:38
QXmppStanza & operator=(const QXmppStanza &other)
Assigns other to this stanza.
Definition: QXmppStanza.cpp:368