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;
42
typedef enum { OfflineEvent, DeliveredEvent, DisplayedEvent,
43
ComposingEvent, CancelEvent } MsgEvent;
48
Message(const Jid &to="");
49
Message(const Message &from);
50
Message & operator=(const Message &from);
58
QString subject(const QString &lang="") const;
59
QString body(const QString &lang="") const;
60
QString thread() const;
61
Stanza::Error error() const;
63
void setTo(const Jid &j);
64
void setFrom(const Jid &j);
65
void setId(const QString &s);
66
void setType(const QString &s);
67
void setLang(const QString &s);
68
void setSubject(const QString &s, const QString &lang="");
69
void setBody(const QString &s, const QString &lang="");
70
void setThread(const QString &s, bool send = false);
71
void setError(const Stanza::Error &err);
74
const QString& pubsubNode() const;
75
const QList<PubSubItem>& pubsubItems() const;
76
const QList<PubSubRetraction>& pubsubRetractions() const;
79
QDateTime timeStamp() const;
80
void setTimeStamp(const QDateTime &ts, bool send = false);
83
HTMLElement html(const QString &lang="") const;
84
void setHTML(const HTMLElement &s, const QString &lang="");
85
bool containsHTML() const;
88
UrlList urlList() const;
89
void urlAdd(const Url &u);
91
void setUrlList(const UrlList &list);
94
QString eventId() const;
95
void setEventId(const QString& id);
96
bool containsEvents() const;
97
bool containsEvent(MsgEvent e) const;
98
void addEvent(MsgEvent e);
101
ChatState chatState() const;
102
void setChatState(ChatState);
105
MessageReceipt messageReceipt() const;
106
void setMessageReceipt(MessageReceipt);
109
QString xencrypted() const;
110
void setXEncrypted(const QString &s);
113
AddressList addresses() const;
114
AddressList findAddresses(Address::Type t) const;
115
void addAddress(const Address &a);
116
void clearAddresses();
117
void setAddresses(const AddressList &list);
120
const RosterExchangeItems& rosterExchangeItems() const;
121
void setRosterExchangeItems(const RosterExchangeItems&);
124
void setNick(const QString&);
125
const QString& nick() const;
128
void setHttpAuthRequest(const HttpAuthRequest&);
129
HttpAuthRequest httpAuthRequest() const;
132
void setForm(const XData&);
133
const XData& getForm() const;
136
void setSxe(const QDomElement&);
137
const QDomElement& sxe() const;
140
void setMUCStatus(int);
141
bool hasMUCStatus() const;
142
int mucStatus() const;
143
void addMUCInvite(const MUCInvite&);
144
const QList<MUCInvite>& mucInvites() const;
145
void setMUCDecline(const MUCDecline&);
146
const MUCDecline& mucDecline() const;
147
const QString& mucPassword() const;
148
void setMUCPassword(const QString&);
150
// Obsolete invitation
151
QString invite() const;
152
void setInvite(const QString &s);
154
// for compatibility. delete me later
155
bool spooled() const;
156
void setSpooled(bool);
157
bool wasEncrypted() const;
158
void setWasEncrypted(bool);
160
Stanza toStanza(Stream *stream) const;
161
bool fromStanza(const Stanza &s, int tzoffset);