1 /***************************************************************************
2 * Copyright (C) 2005-07 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 ***************************************************************************/
24 IrcUser::IrcUser(QObject *parent)
28 IrcUser::IrcUser(const QString &hostmask, QObject *parent)
30 nick_(nickFromMask(hostmask)),
31 user_(userFromMask(hostmask)),
32 host_(hostFromMask(hostmask)) {
38 void IrcUser::setUser(const QString &user) {
42 QString IrcUser::user() const {
46 void IrcUser::setHost(const QString &host) {
50 QString IrcUser::host() const {
54 void IrcUser::setNick(const QString &nick) {
58 QString IrcUser::nick() const {
62 void IrcUser::setUsermodes(const QSet<QString> &usermodes) {
63 usermodes_ = usermodes;
66 QSet<QString> IrcUser::usermodes() const {
70 void IrcUser::setChannelmode(const QString &channel, const QSet<QString> &channelmode) {
71 if(channelmodes_.contains(channel))
72 channelmodes_[channel] |= channelmode;
74 channelmodes_[channel] = channelmode;
77 QSet<QString> IrcUser::channelmode(const QString &channel) const {
78 if(channelmodes_.contains(channel))
79 //throw NoSuchChannelException();
80 Q_ASSERT(false); // FIXME: exception disabled for qtopia testing
82 return QSet<QString>();
85 void IrcUser::updateChannelmode(const QString &channel, const QString &channelmode, bool add) {
87 addChannelmode(channel, channelmode);
89 removeChannelmode(channel, channelmode);
92 void IrcUser::addChannelmode(const QString &channel, const QString &channelmode) {
93 if(!channelmodes_.contains(channel))
94 channelmodes_[channel] = QSet<QString>();
95 channelmodes_[channel] << channelmode;
98 void IrcUser::removeChannelmode(const QString &channel, const QString &channelmode) {
99 if(channelmodes_.contains(channel))
100 channelmodes_[channel].remove(channelmode);
103 QStringList IrcUser::channels() const {
104 return channelmodes_.keys();
107 void IrcUser::joinChannel(const QString &channel) {
108 if(!channelmodes_.contains(channel))
109 channelmodes_[channel] = QSet<QString>();
112 void IrcUser::partChannel(const QString &channel) {
113 channelmodes_.remove(channel);