Fixed: choose filetransfer transport by priority (thanks Dealer_WeARE)
[iris.git] / src / xmpp / xmpp-im / xmpp_message.h
blob054a38c8b9f51f643efa49b3ba282250aa204dff
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;
42 class IBBData;
44 typedef enum { OfflineEvent, DeliveredEvent, DisplayedEvent,
45 ComposingEvent, CancelEvent } MsgEvent;
47 class Message
49 public:
50 Message(const Jid &to="");
51 Message(const Message &from);
52 Message & operator=(const Message &from);
53 ~Message();
55 Jid to() const;
56 Jid from() const;
57 QString id() const;
58 QString type() const;
59 QString lang() const;
60 QString subject(const QString &lang="") const;
61 QString body(const QString &lang="") const;
62 QString thread() const;
63 Stanza::Error error() const;
65 void setTo(const Jid &j);
66 void setFrom(const Jid &j);
67 void setId(const QString &s);
68 void setType(const QString &s);
69 void setLang(const QString &s);
70 void setSubject(const QString &s, const QString &lang="");
71 void setBody(const QString &s, const QString &lang="");
72 void setThread(const QString &s, bool send = false);
73 void setError(const Stanza::Error &err);
75 // JEP-0060
76 const QString& pubsubNode() const;
77 const QList<PubSubItem>& pubsubItems() const;
78 const QList<PubSubRetraction>& pubsubRetractions() const;
80 // JEP-0091
81 QDateTime timeStamp() const;
82 void setTimeStamp(const QDateTime &ts, bool send = false);
84 // JEP-0071
85 HTMLElement html(const QString &lang="") const;
86 void setHTML(const HTMLElement &s, const QString &lang="");
87 bool containsHTML() const;
89 // JEP-0066
90 UrlList urlList() const;
91 void urlAdd(const Url &u);
92 void urlsClear();
93 void setUrlList(const UrlList &list);
95 // JEP-0022
96 QString eventId() const;
97 void setEventId(const QString& id);
98 bool containsEvents() const;
99 bool containsEvent(MsgEvent e) const;
100 void addEvent(MsgEvent e);
102 // JEP-0085
103 ChatState chatState() const;
104 void setChatState(ChatState);
106 // XEP-0184
107 MessageReceipt messageReceipt() const;
108 void setMessageReceipt(MessageReceipt);
110 // JEP-0027
111 QString xencrypted() const;
112 void setXEncrypted(const QString &s);
114 // JEP-0033
115 AddressList addresses() const;
116 AddressList findAddresses(Address::Type t) const;
117 void addAddress(const Address &a);
118 void clearAddresses();
119 void setAddresses(const AddressList &list);
121 // JEP-144
122 const RosterExchangeItems& rosterExchangeItems() const;
123 void setRosterExchangeItems(const RosterExchangeItems&);
125 // JEP-172
126 void setNick(const QString&);
127 const QString& nick() const;
129 // JEP-0070
130 void setHttpAuthRequest(const HttpAuthRequest&);
131 HttpAuthRequest httpAuthRequest() const;
133 // JEP-0004
134 void setForm(const XData&);
135 const XData& getForm() const;
137 // JEP-xxxx SXE
138 void setSxe(const QDomElement&);
139 const QDomElement& sxe() const;
141 // XEP-0231 bits of binary
142 void addBoBData(const BoBData &);
143 QList<BoBData> bobDataList() const;
145 // XEP-0047 ibb
146 const IBBData& ibbData() const;
148 // MUC
149 void addMUCStatus(int);
150 const QList<int>& getMUCStatuses() const;
151 void addMUCInvite(const MUCInvite&);
152 const QList<MUCInvite>& mucInvites() const;
153 void setMUCDecline(const MUCDecline&);
154 const MUCDecline& mucDecline() const;
155 const QString& mucPassword() const;
156 void setMUCPassword(const QString&);
158 // Obsolete invitation
159 QString invite() const;
160 void setInvite(const QString &s);
162 // for compatibility. delete me later
163 bool spooled() const;
164 void setSpooled(bool);
165 bool wasEncrypted() const;
166 void setWasEncrypted(bool);
168 Stanza toStanza(Stream *stream) const;
169 bool fromStanza(const Stanza &s);
170 bool fromStanza(const Stanza &s, int tzoffset);
171 bool fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOffset);
173 private:
174 class Private;
175 Private *d;
179 #endif