1 /***************************************************************************
2 * Copyright (C) 2005-08 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
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 program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 #include <QDataStream>
27 #include <QStringList>
30 #include "syncableobject.h"
32 class Identity : public SyncableObject {
35 Q_PROPERTY(IdentityId identityId READ id WRITE setId STORED false);
36 Q_PROPERTY(QString identityName READ identityName WRITE setIdentityName STORED false);
37 Q_PROPERTY(QString realName READ realName WRITE setRealName STORED false);
38 Q_PROPERTY(QStringList nicks READ nicks WRITE setNicks STORED false);
39 Q_PROPERTY(QString awayNick READ awayNick WRITE setAwayNick STORED false);
40 Q_PROPERTY(bool awayNickEnabled READ awayNickEnabled WRITE setAwayNickEnabled STORED false);
41 Q_PROPERTY(QString awayReason READ awayReason WRITE setAwayReason STORED false);
42 Q_PROPERTY(bool awayReasonEnabled READ awayReasonEnabled WRITE setAwayReasonEnabled STORED false);
43 Q_PROPERTY(QString returnMessage READ returnMessage WRITE setReturnMessage STORED false);
44 Q_PROPERTY(bool returnMessageEnabled READ returnMessageEnabled WRITE setReturnMessageEnabled STORED false);
45 Q_PROPERTY(bool autoAwayEnabled READ autoAwayEnabled WRITE setAutoAwayEnabled STORED false);
46 Q_PROPERTY(int autoAwayTime READ autoAwayTime WRITE setAutoAwayTime STORED false);
47 Q_PROPERTY(QString autoAwayReason READ autoAwayReason WRITE setAutoAwayReason STORED false);
48 Q_PROPERTY(bool autoAwayReasonEnabled READ autoAwayReasonEnabled WRITE setAutoAwayReasonEnabled STORED false);
49 Q_PROPERTY(QString autoReturnMessage READ autoReturnMessage WRITE setAutoReturnMessage STORED false);
50 Q_PROPERTY(bool autoReturnMessageEnabled READ autoReturnMessageEnabled WRITE setAutoReturnMessageEnabled STORED false);
51 Q_PROPERTY(QString ident READ ident WRITE setIdent STORED false);
52 Q_PROPERTY(QString kickReason READ kickReason WRITE setKickReason STORED false);
53 Q_PROPERTY(QString partReason READ partReason WRITE setPartReason STORED false);
54 Q_PROPERTY(QString quitReason READ quitReason WRITE setQuitReason STORED false);
57 Identity(IdentityId id = 0, QObject *parent = 0);
58 Identity(const Identity &other, QObject *parent = 0);
61 bool operator==(const Identity &other);
62 bool operator!=(const Identity &other);
66 IdentityId id() const;
67 QString identityName() const;
68 QString realName() const;
69 QStringList nicks() const;
70 QString awayNick() const;
71 bool awayNickEnabled() const;
72 QString awayReason() const;
73 bool awayReasonEnabled() const;
74 QString returnMessage() const;
75 bool returnMessageEnabled() const;
76 bool autoAwayEnabled() const;
77 int autoAwayTime() const;
78 QString autoAwayReason() const;
79 bool autoAwayReasonEnabled() const;
80 QString autoReturnMessage() const;
81 bool autoReturnMessageEnabled() const;
82 QString ident() const;
83 QString kickReason() const;
84 QString partReason() const;
85 QString quitReason() const;
88 void setId(IdentityId id);
89 void setIdentityName(const QString &name);
90 void setRealName(const QString &realName);
91 void setNicks(const QStringList &nicks);
92 void setAwayNick(const QString &awayNick);
93 void setAwayNickEnabled(bool enabled);
94 void setAwayReason(const QString &awayReason);
95 void setAwayReasonEnabled(bool enabled);
96 void setReturnMessage(const QString &returnMessage);
97 void setReturnMessageEnabled(bool enabled);
98 void setAutoAwayEnabled(bool enabled);
99 void setAutoAwayTime(int time);
100 void setAutoAwayReason(const QString &reason);
101 void setAutoAwayReasonEnabled(bool enabled);
102 void setAutoReturnMessage(const QString &message);
103 void setAutoReturnMessageEnabled(bool enabled);
104 void setIdent(const QString &ident);
105 void setKickReason(const QString &reason);
106 void setPartReason(const QString &reason);
107 void setQuitReason(const QString &reason);
109 void update(const Identity &other);
112 void idSet(IdentityId id);
113 void identityNameSet(const QString &name);
114 void realNameSet(const QString &realName);
115 void nicksSet(const QStringList &nicks);
116 void awayNickSet(const QString &awayNick);
117 void awayNickEnabledSet(bool);
118 void awayReasonSet(const QString &awayReason);
119 void awayReasonEnabledSet(bool);
120 void returnMessageSet(const QString &returnMessage);
121 void returnMessageEnabledSet(bool);
122 void autoAwayEnabledSet(bool);
123 void autoAwayTimeSet(int);
124 void autoAwayReasonSet(const QString &);
125 void autoAwayReasonEnabledSet(bool);
126 void autoReturnMessageSet(const QString &);
127 void autoReturnMessageEnabledSet(bool);
128 void identSet(const QString &);
129 void kickReasonSet(const QString &);
130 void partReasonSet(const QString &);
131 void quitReasonSet(const QString &);
134 IdentityId _identityId;
135 QString _identityName, _realName;
138 bool _awayNickEnabled;
140 bool _awayReasonEnabled;
141 QString _returnMessage;
142 bool _returnMessageEnabled;
143 bool _autoAwayEnabled;
145 QString _autoAwayReason;
146 bool _autoAwayReasonEnabled;
147 QString _autoReturnMessage;
148 bool _autoReturnMessageEnabled;
149 QString _ident, _kickReason, _partReason, _quitReason;
153 friend QDataStream &operator>>(QDataStream &in, Identity &identity);
156 QDataStream &operator<<(QDataStream &out, Identity identity);
157 QDataStream &operator>>(QDataStream &in, Identity &identity);
159 Q_DECLARE_METATYPE(Identity);