1 /***************************************************************************
2 * Copyright (C) 2005/06 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 ***************************************************************************/
21 #ifndef _IRCCHANNEL_H_
22 #define _IRCCHANNEL_H_
26 #include <QStringList>
27 #include <QVariantMap>
29 #include "syncableobject.h"
35 class IrcChannel : public SyncableObject {
38 Q_PROPERTY(QString name READ name STORED false)
39 Q_PROPERTY(QString topic READ topic WRITE setTopic STORED false)
42 IrcChannel(const QString &channelname, NetworkInfo *networkInfo);
45 bool isKnownUser(IrcUser *ircuser) const;
46 bool isValidChannelUserMode(const QString &mode) const;
48 bool initialized() const;
51 QString topic() const;
53 QList<IrcUser *> ircUsers() const;
55 QString userModes(IrcUser *ircuser) const;
56 QString userModes(const QString &nick) const;
58 QTextCodec *codecForEncoding() const;
59 QTextCodec *codecForDecoding() const;
60 void setCodecForEncoding(const QString &codecName);
61 void setCodecForEncoding(QTextCodec *codec);
62 void setCodecForDecoding(const QString &codecName);
63 void setCodecForDecoding(QTextCodec *codec);
65 QString decodeString(const QByteArray &text) const;
66 QByteArray encodeString(const QString string) const;
69 void setTopic(const QString &topic);
71 void join(IrcUser *ircuser);
72 void join(const QString &nick);
74 void part(IrcUser *ircuser);
75 void part(const QString &nick);
77 void setUserModes(IrcUser *ircuser, const QString &modes);
78 void setUserModes(const QString &nick, const QString &modes);
80 void addUserMode(IrcUser *ircuser, const QString &mode);
81 void addUserMode(const QString &nick, const QString &mode);
83 void removeUserMode(IrcUser *ircuser, const QString &mode);
84 void removeUserMode(const QString &nick, const QString &mode);
87 QVariantMap initUserModes() const;
90 void initSetUserModes(const QVariantMap &usermodes);
92 void setInitialized();
95 void topicSet(QString topic);
96 void userModesSet(QString nick, QString modes);
97 //void userModesSet(IrcUser *ircuser, QString modes);
98 void userModeAdded(QString nick, QString mode);
99 //void userModeAdded(IrcUser *ircuser, QString mode);
100 void userModeRemoved(QString nick, QString mode);
101 //void userModeRemoved(IrcUser *ircuser, QString mode);
103 void ircUserJoined(IrcUser *ircuser);
104 void ircUserParted(IrcUser *ircuser);
105 void ircUserNickSet(IrcUser *ircuser, QString nick);
106 void ircUserModeAdded(IrcUser *ircuser, QString mode);
107 void ircUserModeRemoved(IrcUser *ircuser, QString mode);
108 void ircUserModesSet(IrcUser *ircuser, QString modes);
113 void ircUserDestroyed();
114 void ircUserNickSet(QString nick);
121 QHash<IrcUser *, QString> _userModes;
123 NetworkInfo *networkInfo;
125 QTextCodec *_codecForEncoding;
126 QTextCodec *_codecForDecoding;