1
/****************************************************************************
5
** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6
** Copyright © 2011 Aleksey Sidorov <gorthauer87@yandex.ru>
8
*****************************************************************************
10
** $JREEN_BEGIN_LICENSE$
11
** This program is free software: you can redistribute it and/or modify
12
** it under the terms of the GNU General Public License as published by
13
** the Free Software Foundation, either version 2 of the License, or
14
** (at your option) any later version.
16
** This program is distributed in the hope that it will be useful,
17
** but WITHOUT ANY WARRANTY; without even the implied warranty of
18
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
** See the GNU General Public License for more details.
21
** You should have received a copy of the GNU General Public License
22
** along with this program. If not, see http://www.gnu.org/licenses/.
23
** $JREEN_END_LICENSE$
25
****************************************************************************/
31
#include "mucmessagesession_p.h"
36
class MUCRoomUserQuery;
41
Q_DECLARE_PUBLIC(MUCRoom)
43
MUCRoomPrivate(MUCRoom *room) :
44
q_ptr(room), client(0), affiliation(MUCRoom::AffiliationOutcast),
45
role(MUCRoom::RoleNone), maxChars(-1), maxStanzas(-1), seconds(-1),
46
currentPresence(Presence::Unavailable, JID(), QString()), isJoined(false),
51
static MUCRoomPrivate *get(MUCRoom *room) { return room->d_func(); }
52
void handlePresence(const Presence &pres);
53
void handleMessage(const Message &msg);
56
QPointer<Client> client;
58
MUCRoom::Affiliation affiliation;
60
QHash<QString, QSharedPointer<MUCRoomUserQuery> > participantsHash;
65
Presence currentPresence;
69
MUCMessageSession *session;
73
class MUCRoomQuery : public Payload
75
J_PAYLOAD(Jreen::MUCRoomQuery)
77
MUCRoomQuery(const QString &password)
78
: m_password(password), m_maxChars(-1), m_maxStanzas(-1), m_seconds(-1) {}
79
void setMaxChars(int maxChars) { m_maxChars = qMax(-1, maxChars); }
80
void setMaxStanzas(int maxStanzas) { m_maxStanzas = qMax(-1, maxStanzas); }
81
void setSeconds(int seconds) { m_seconds = qMax(-1, seconds); }
82
void setSince(const QDateTime &since) { m_since = since; }
89
friend class JREEN_AUTOTEST_EXPORT MUCRoomQueryFactory;
95
MUCRoomItem() : affiliation(MUCRoom::AffiliationInvalid), role(MUCRoom::RoleInvalid) {}
97
MUCRoom::Affiliation affiliation;
105
class MUCRoomUserQuery : public Payload
107
J_PAYLOAD(Jreen::MUCRoomUserQuery)
111
NonAnonymous = 0x0001,
112
SemiAnonymous = 0x0002,
113
FullyAnonymous = 0x0004,
114
AffiliationChangeWNR = 0x0008,
116
LoggingEnabled = 0x0020,
117
LoggingDisabled = 0x0040,
119
NickAssigned = 0x0100,
121
NickChanged = 0x0400,
123
AffiliationChanged = 0x1000,
124
MembershipRequired = 0x2000,
125
RoomSegfaulted = 0x4000
133
MUCRoomUserQuery() : flags(0), operation(0)
137
MUCRoomUserQuery(Operation op, const JID &to, const QString &reason, const QString &thread)
138
: flags(0), operation(op), thread(thread)
141
item.reason = reason;
153
class MUCRoomAdminQuery : public Payload
155
J_PAYLOAD(Jreen::MUCRoomAdminQuery)
157
MUCRoomAdminQuery() {}
158
MUCRoomAdminQuery(MUCRoom::Affiliation a)
161
item.affiliation = a;
164
MUCRoomAdminQuery(const JID &jid, MUCRoom::Affiliation a, const QString &reason)
167
item.affiliation = a;
169
item.reason = reason;
172
MUCRoomAdminQuery(const QString &nick, MUCRoom::Affiliation a, const QString &reason)
175
item.affiliation = a;
177
item.reason = reason;
180
MUCRoomAdminQuery(const QString &nick, MUCRoom::Role r, const QString &reason)
185
item.reason = reason;
188
QList<MUCRoomItem> items;
191
class MUCRoomOwnerQuery : public Payload
193
J_PAYLOAD(Jreen::MUCRoomOwnerQuery)
195
MUCRoomOwnerQuery() {}
196
MUCRoomOwnerQuery(const DataForm::Ptr &f) : form(f) {}
201
#endif // MUCROOM_P_H