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"
25 #include "xmpp_chatstate.h"
26 #include "xmpp_receipts.h"
27 #include "xmpp_address.h"
28 #include "xmpp_rosterx.h"
37 class PubSubRetraction
;
39 class HttpAuthRequest
;
44 typedef enum { OfflineEvent
, DeliveredEvent
, DisplayedEvent
,
45 ComposingEvent
, CancelEvent
} MsgEvent
;
50 Message(const Jid
&to
="");
51 Message(const Message
&from
);
52 Message
& operator=(const Message
&from
);
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
);
76 const QString
& pubsubNode() const;
77 const QList
<PubSubItem
>& pubsubItems() const;
78 const QList
<PubSubRetraction
>& pubsubRetractions() const;
81 QDateTime
timeStamp() const;
82 void setTimeStamp(const QDateTime
&ts
, bool send
= false);
85 HTMLElement
html(const QString
&lang
="") const;
86 void setHTML(const HTMLElement
&s
, const QString
&lang
="");
87 bool containsHTML() const;
90 UrlList
urlList() const;
91 void urlAdd(const Url
&u
);
93 void setUrlList(const UrlList
&list
);
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
);
103 ChatState
chatState() const;
104 void setChatState(ChatState
);
107 MessageReceipt
messageReceipt() const;
108 void setMessageReceipt(MessageReceipt
);
111 QString
xencrypted() const;
112 void setXEncrypted(const QString
&s
);
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
);
122 const RosterExchangeItems
& rosterExchangeItems() const;
123 void setRosterExchangeItems(const RosterExchangeItems
&);
126 void setNick(const QString
&);
127 const QString
& nick() const;
130 void setHttpAuthRequest(const HttpAuthRequest
&);
131 HttpAuthRequest
httpAuthRequest() const;
134 void setForm(const XData
&);
135 const XData
& getForm() const;
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;
146 const IBBData
& ibbData() const;
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
);