Added Bits Of Binary (XEP-0231) support
[iris.git] / src / xmpp / xmpp-im / xmpp_message.h
blob8f4f5523d037ff967f52df49c20ddfe126594936
1 /*
2 * Copyright (C) 2003 Justin Karneges
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef XMPP_MESSAGE_H
21 #define XMPP_MESSAGE_H
23 #include "xmpp_stanza.h"
24 #include "xmpp_url.h"
25 #include "xmpp_chatstate.h"
26 #include "xmpp_receipts.h"
27 #include "xmpp_address.h"
28 #include "xmpp_rosterx.h"
29 #include "xmpp_muc.h"
31 class QString;
32 class QDateTime;
34 namespace XMPP {
35 class Jid;
36 class PubSubItem;
37 class PubSubRetraction;
38 class HTMLElement;
39 class HttpAuthRequest;
40 class XData;
41 class BoBData;
43 typedef enum { OfflineEvent, DeliveredEvent, DisplayedEvent,
44 ComposingEvent, CancelEvent } MsgEvent;
46 class Message
48 public:
49 Message(const Jid &to="");
50 Message(const Message &from);
51 Message & operator=(const Message &from);
52 ~Message();
54 Jid to() const;
55 Jid from() const;
56 QString id() const;
57 QString type() const;
58 QString lang() const;
59 QString subject(const QString &lang="") const;
60 QString body(const QString &lang="") const;
61 QString thread() const;
62 Stanza::Error error() const;
64 void setTo(const Jid &j);
65 void setFrom(const Jid &j);
66 void setId(const QString &s);
67 void setType(const QString &s);
68 void setLang(const QString &s);
69 void setSubject(const QString &s, const QString &lang="");
70 void setBody(const QString &s, const QString &lang="");
71 void setThread(const QString &s, bool send = false);
72 void setError(const Stanza::Error &err);
74 // JEP-0060
75 const QString& pubsubNode() const;
76 const QList<PubSubItem>& pubsubItems() const;
77 const QList<PubSubRetraction>& pubsubRetractions() const;
79 // JEP-0091
80 QDateTime timeStamp() const;
81 void setTimeStamp(const QDateTime &ts, bool send = false);
83 // JEP-0071
84 HTMLElement html(const QString &lang="") const;
85 void setHTML(const HTMLElement &s, const QString &lang="");
86 bool containsHTML() const;
88 // JEP-0066
89 UrlList urlList() const;
90 void urlAdd(const Url &u);
91 void urlsClear();
92 void setUrlList(const UrlList &list);
94 // JEP-0022
95 QString eventId() const;
96 void setEventId(const QString& id);
97 bool containsEvents() const;
98 bool containsEvent(MsgEvent e) const;
99 void addEvent(MsgEvent e);
101 // JEP-0085
102 ChatState chatState() const;
103 void setChatState(ChatState);
105 // XEP-0184
106 MessageReceipt messageReceipt() const;
107 void setMessageReceipt(MessageReceipt);
109 // JEP-0027
110 QString xencrypted() const;
111 void setXEncrypted(const QString &s);
113 // JEP-0033
114 AddressList addresses() const;
115 AddressList findAddresses(Address::Type t) const;
116 void addAddress(const Address &a);
117 void clearAddresses();
118 void setAddresses(const AddressList &list);
120 // JEP-144
121 const RosterExchangeItems& rosterExchangeItems() const;
122 void setRosterExchangeItems(const RosterExchangeItems&);
124 // JEP-172
125 void setNick(const QString&);
126 const QString& nick() const;
128 // JEP-0070
129 void setHttpAuthRequest(const HttpAuthRequest&);
130 HttpAuthRequest httpAuthRequest() const;
132 // JEP-0004
133 void setForm(const XData&);
134 const XData& getForm() const;
136 // JEP-xxxx SXE
137 void setSxe(const QDomElement&);
138 const QDomElement& sxe() const;
140 // XEP-0231 bits of binary
141 void addBoBData(const BoBData &);
142 QList<BoBData> bobDataList() const;
144 // MUC
145 void addMUCStatus(int);
146 const QList<int>& getMUCStatuses() const;
147 void addMUCInvite(const MUCInvite&);
148 const QList<MUCInvite>& mucInvites() const;
149 void setMUCDecline(const MUCDecline&);
150 const MUCDecline& mucDecline() const;
151 const QString& mucPassword() const;
152 void setMUCPassword(const QString&);
154 // Obsolete invitation
155 QString invite() const;
156 void setInvite(const QString &s);
158 // for compatibility. delete me later
159 bool spooled() const;
160 void setSpooled(bool);
161 bool wasEncrypted() const;
162 void setWasEncrypted(bool);
164 Stanza toStanza(Stream *stream) const;
165 bool fromStanza(const Stanza &s);
166 bool fromStanza(const Stanza &s, int tzoffset);
167 bool fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOffset);
169 private:
170 class Private;
171 Private *d;
175 #endif