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 ***************************************************************************/
26 #include <QStringList>
27 #include <QVariantMap>
29 #include "syncableobject.h"
35 class IrcUser : public SyncableObject {
38 Q_PROPERTY(QString user READ user WRITE setUser STORED false)
39 Q_PROPERTY(QString host READ host WRITE setHost STORED false)
40 Q_PROPERTY(QString nick READ nick WRITE setNick STORED false)
41 Q_PROPERTY(QString realName READ realName WRITE setRealName STORED false)
42 Q_PROPERTY(bool away READ isAway WRITE setAway STORED false)
43 Q_PROPERTY(QString awayMessage READ awayMessage WRITE setAwayMessage STORED false)
45 Q_PROPERTY(QStringList channels READ channels STORED false)
46 // Q_PROPERTY(QStringList usermodes READ usermodes WRITE setUsermodes)
49 IrcUser(const QString &hostmask, Network *network);
55 QString realName() const;
56 QString hostmask() const;
58 QString awayMessage() const;
59 Network *network() const;
61 QString userModes() const;
63 QStringList channels() const;
65 // user-specific encodings
66 QTextCodec *codecForEncoding() const;
67 QTextCodec *codecForDecoding() const;
68 void setCodecForEncoding(const QString &codecName);
69 void setCodecForEncoding(QTextCodec *codec);
70 void setCodecForDecoding(const QString &codecName);
71 void setCodecForDecoding(QTextCodec *codec);
73 QString decodeString(const QByteArray &text) const;
74 QByteArray encodeString(const QString string) const;
77 void setUser(const QString &user);
78 void setHost(const QString &host);
79 void setNick(const QString &nick);
80 void setRealName(const QString &realName);
81 void setAway(const bool &away);
82 void setAwayMessage(const QString &awayMessage);
83 void updateHostmask(const QString &mask);
85 void setUserModes(const QString &modes);
87 void joinChannel(IrcChannel *channel);
88 void joinChannel(const QString &channelname);
89 void partChannel(IrcChannel *channel);
90 void partChannel(const QString &channelname);
92 void addUserMode(const QString &mode);
93 void removeUserMode(const QString &mode);
96 void initSetChannels(const QStringList channels);
99 void userSet(QString user);
100 void hostSet(QString host);
101 void nickSet(QString newnick);
102 void realNameSet(QString realName);
103 void awaySet(bool away);
104 void awayMessageSet(QString awayMessage);
105 void hostmaskUpdated(QString mask);
107 void userModesSet(QString modes);
109 void channelJoined(QString channel);
110 void channelParted(QString channel);
112 void userModeAdded(QString mode);
113 void userModeRemoved(QString mode);
115 void renameObject(QString oldname, QString newname);
117 // void setUsermodes(const QSet<QString> &usermodes);
118 // QSet<QString> usermodes() const;
121 void updateObjectName();
122 void channelDestroyed();
125 inline bool operator==(const IrcUser &ircuser2) {
126 return (_nick.toLower() == ircuser2.nick().toLower());
129 inline bool operator==(const QString &nickname) {
130 return (_nick.toLower() == nickname.toLower());
139 QString _awayMessage;
142 // QSet<QString> _channels;
143 QSet<IrcChannel *> _channels;
148 QTextCodec *_codecForEncoding;
149 QTextCodec *_codecForDecoding;