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);
52 QString hostmask() const;
53 Network *network() const;
55 QString userModes() const;
57 QStringList channels() const;
59 // user-specific encodings
60 QTextCodec *codecForEncoding() const;
61 QTextCodec *codecForDecoding() const;
62 void setCodecForEncoding(const QString &codecName);
63 void setCodecForEncoding(QTextCodec *codec);
64 void setCodecForDecoding(const QString &codecName);
65 void setCodecForDecoding(QTextCodec *codec);
67 QString decodeString(const QByteArray &text) const;
68 QByteArray encodeString(const QString string) const;
71 void setUser(const QString &user);
72 void setHost(const QString &host);
73 void setNick(const QString &nick);
74 void updateHostmask(const QString &mask);
76 void setUserModes(const QString &modes);
78 void joinChannel(IrcChannel *channel);
79 void joinChannel(const QString &channelname);
80 void partChannel(IrcChannel *channel);
81 void partChannel(const QString &channelname);
83 void addUserMode(const QString &mode);
84 void removeUserMode(const QString &mode);
87 void initSetChannels(const QStringList channels);
90 void userSet(QString user);
91 void hostSet(QString host);
92 void nickSet(QString newnick);
93 void hostmaskUpdated(QString mask);
95 void userModesSet(QString modes);
97 void channelJoined(QString channel);
98 void channelParted(QString channel);
100 void userModeAdded(QString mode);
101 void userModeRemoved(QString mode);
103 void renameObject(QString oldname, QString newname);
105 // void setUsermodes(const QSet<QString> &usermodes);
106 // QSet<QString> usermodes() const;
109 void updateObjectName();
110 void channelDestroyed();
113 inline bool operator==(const IrcUser &ircuser2) {
114 return (_nick.toLower() == ircuser2.nick().toLower());
117 inline bool operator==(const QString &nickname) {
118 return (_nick.toLower() == nickname.toLower());
127 // QSet<QString> _channels;
128 QSet<IrcChannel *> _channels;
133 QTextCodec *_codecForEncoding;
134 QTextCodec *_codecForDecoding;