1 /***************************************************************************
2 * Copyright (C) 2005/06 by The Quassel Team *
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) 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 program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
29 #include <QStringList>
33 class IrcUser : public QObject {
36 // Q_PROPERTY(QString user READ user WRITE setUser)
37 // Q_PROPERTY(QString host READ host WRITE setHost)
38 // Q_PROPERTY(QString nick READ nick WRITE setNick)
39 // Q_PROPERTY(QSet<QString> usermodes READ usermodes WRITE setUsermodes)
40 // Q_PROPERTY(QStringList channels READ channels)
43 IrcUser(QObject *parent = 0);
44 IrcUser(const QString &hostmask, QObject *parent = 0);
47 void setUser(const QString &user);
50 void setHost(const QString &host);
53 void setNick(const QString &nick);
56 void setUsermodes(const QSet<QString> &usermodes);
57 QSet<QString> usermodes() const;
59 void setChannelmode(const QString &channel, const QSet<QString> &channelmode);
60 QSet<QString> channelmode(const QString &channel) const;
62 void updateChannelmode(const QString &channel, const QString &channelmode, bool add=true);
63 void addChannelmode(const QString &channel, const QString &channelmode);
64 void removeChannelmode(const QString &channel, const QString &channelmode);
66 QStringList channels() const;
68 void joinChannel(const QString &channel);
69 void partChannel(const QString &channel);
72 inline bool operator==(const IrcUser &ircuser2) {
73 return (nick_.toLower() == ircuser2.nick().toLower());
76 inline bool operator==(const QString &nickname) {
77 return (nick_.toLower() == nickname.toLower());
84 QHash<QString, QSet<QString> > channelmodes_; //keys: channelnames; values: Set of Channelmodes
85 QSet<QString> usermodes_;
88 struct IrcUserException : public Exception {};
89 struct NoSuchChannelException : public IrcUserException {};
90 struct NoSuchNickException : public IrcUserException {};