3
* Copyright (C) 2006 Remko Troncon
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#ifndef PRIVACYLISTITEM_H
22
#define PRIVACYLISTITEM_H
32
typedef enum { FallthroughType, JidType, GroupType, SubscriptionType } Type;
33
typedef enum { Allow, Deny } Action;
36
PrivacyListItem(const QDomElement& e);
38
Type type() const { return type_; }
39
Action action() const { return action_; }
40
bool message() const { return message_; }
41
bool presenceIn() const { return presenceIn_; }
42
bool presenceOut() const { return presenceOut_; }
43
bool iq() const { return iq_; }
44
bool all() const { return iq_ && presenceIn_ && presenceOut_ && message_; }
45
const QString& value() const { return value_; }
46
unsigned int order() const { return order_; }
48
void setType(Type type) { type_ = type; }
49
void setAction(Action action) { action_ = action; }
50
void setMessage(bool b) { message_ = b; }
51
void setPresenceIn(bool b) { presenceIn_ = b; }
52
void setPresenceOut(bool b) { presenceOut_ = b; }
53
void setIQ(bool b) { iq_ = b; }
54
void setAll() { iq_ = presenceIn_ = presenceOut_ = message_ = true; }
55
void setValue(const QString& value) { value_ = value; }
56
void setOrder(unsigned int order) { order_ = order; }
59
QString toString() const;
60
QDomElement toXml(QDomDocument&) const;
61
void fromXml(const QDomElement& e);
63
bool operator<(const PrivacyListItem& it) const { return order() < it.order(); }
64
bool operator==(const PrivacyListItem& o) const { return type_ == o.type_ && action_ == o.action_ && message_ == o.message_ && presenceIn_ == o.presenceIn_ && presenceOut_ == o.presenceOut_ && iq_ == o.iq_ && order_ == o.order_ && value_ == o.value_; }
66
static PrivacyListItem blockItem(const QString& jid);
71
bool message_, presenceIn_, presenceOut_, iq_;