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)
42 Q_PROPERTY(QStringList channels READ channels STORED false)
43 // Q_PROPERTY(QStringList usermodes READ usermodes WRITE setUsermodes)
46 IrcUser(const QString &hostmask, Network *network);
49 bool initialized() const;
54 QString hostmask() const;
55 Network *network() const;
57 QString userModes() const;
59 QStringList channels() const;
61 // user-specific encodings
62 QTextCodec *codecForEncoding() const;
63 QTextCodec *codecForDecoding() const;
64 void setCodecForEncoding(const QString &codecName);
65 void setCodecForEncoding(QTextCodec *codec);
66 void setCodecForDecoding(const QString &codecName);
67 void setCodecForDecoding(QTextCodec *codec);
69 QString decodeString(const QByteArray &text) const;
70 QByteArray encodeString(const QString string) const;
73 void setUser(const QString &user);
74 void setHost(const QString &host);
75 void setNick(const QString &nick);
76 void updateHostmask(const QString &mask);
78 void setUserModes(const QString &modes);
80 void joinChannel(IrcChannel *channel);
81 void joinChannel(const QString &channelname);
82 void partChannel(IrcChannel *channel);
83 void partChannel(const QString &channelname);
85 void addUserMode(const QString &mode);
86 void removeUserMode(const QString &mode);
89 void initSetChannels(const QStringList channels);
91 void setInitialized();
94 void userSet(QString user);
95 void hostSet(QString host);
96 void nickSet(QString newnick);
97 void hostmaskUpdated(QString mask);
99 void userModesSet(QString modes);
101 void channelJoined(QString channel);
102 void channelParted(QString channel);
104 void userModeAdded(QString mode);
105 void userModeRemoved(QString mode);
107 void renameObject(QString oldname, QString newname);
109 // void setUsermodes(const QSet<QString> &usermodes);
110 // QSet<QString> usermodes() const;
115 void updateObjectName();
116 void channelDestroyed();
119 inline bool operator==(const IrcUser &ircuser2) {
120 return (_nick.toLower() == ircuser2.nick().toLower());
123 inline bool operator==(const QString &nickname) {
124 return (_nick.toLower() == nickname.toLower());
133 // QSet<QString> _channels;
134 QSet<IrcChannel *> _channels;
139 QTextCodec *_codecForEncoding;
140 QTextCodec *_codecForDecoding;