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
;
43 typedef enum { OfflineEvent
, DeliveredEvent
, DisplayedEvent
,
44 ComposingEvent
, CancelEvent
} MsgEvent
;
49 Message(const Jid
&to
="");
50 Message(const Message
&from
);
51 Message
& operator=(const Message
&from
);
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
);
75 const QString
& pubsubNode() const;
76 const QList
<PubSubItem
>& pubsubItems() const;
77 const QList
<PubSubRetraction
>& pubsubRetractions() const;
80 QDateTime
timeStamp() const;
81 void setTimeStamp(const QDateTime
&ts
, bool send
= false);
84 HTMLElement
html(const QString
&lang
="") const;
85 void setHTML(const HTMLElement
&s
, const QString
&lang
="");
86 bool containsHTML() const;
89 UrlList
urlList() const;
90 void urlAdd(const Url
&u
);
92 void setUrlList(const UrlList
&list
);
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
);
102 ChatState
chatState() const;
103 void setChatState(ChatState
);
106 MessageReceipt
messageReceipt() const;
107 void setMessageReceipt(MessageReceipt
);
110 QString
xencrypted() const;
111 void setXEncrypted(const QString
&s
);
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
);
121 const RosterExchangeItems
& rosterExchangeItems() const;
122 void setRosterExchangeItems(const RosterExchangeItems
&);
125 void setNick(const QString
&);
126 const QString
& nick() const;
129 void setHttpAuthRequest(const HttpAuthRequest
&);
130 HttpAuthRequest
httpAuthRequest() const;
133 void setForm(const XData
&);
134 const XData
& getForm() const;
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;
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
);