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, Network *network);
45 bool isKnownUser(IrcUser *ircuser) const;
46 bool isValidChannelUserMode(const QString &mode) const;
49 QString topic() const;
51 QList<IrcUser *> ircUsers() const;
53 QString userModes(IrcUser *ircuser) const;
54 QString userModes(const QString &nick) const;
56 QTextCodec *codecForEncoding() const;
57 QTextCodec *codecForDecoding() const;
58 void setCodecForEncoding(const QString &codecName);
59 void setCodecForEncoding(QTextCodec *codec);
60 void setCodecForDecoding(const QString &codecName);
61 void setCodecForDecoding(QTextCodec *codec);
63 QString decodeString(const QByteArray &text) const;
64 QByteArray encodeString(const QString string) const;
67 void setTopic(const QString &topic);
69 void join(IrcUser *ircuser);
70 void join(const QString &nick);
72 void part(IrcUser *ircuser);
73 void part(const QString &nick);
75 void setUserModes(IrcUser *ircuser, const QString &modes);
76 void setUserModes(const QString &nick, const QString &modes);
78 void addUserMode(IrcUser *ircuser, const QString &mode);
79 void addUserMode(const QString &nick, const QString &mode);
81 void removeUserMode(IrcUser *ircuser, const QString &mode);
82 void removeUserMode(const QString &nick, const QString &mode);
85 QVariantMap initUserModes() const;
88 void initSetUserModes(const QVariantMap &usermodes);
91 void topicSet(QString topic);
92 void userModesSet(QString nick, QString modes);
93 //void userModesSet(IrcUser *ircuser, QString modes);
94 void userModeAdded(QString nick, QString mode);
95 //void userModeAdded(IrcUser *ircuser, QString mode);
96 void userModeRemoved(QString nick, QString mode);
97 //void userModeRemoved(IrcUser *ircuser, QString mode);
99 void ircUserJoined(IrcUser *ircuser);
100 void ircUserParted(IrcUser *ircuser);
101 void ircUserNickSet(IrcUser *ircuser, QString nick);
102 void ircUserModeAdded(IrcUser *ircuser, QString mode);
103 void ircUserModeRemoved(IrcUser *ircuser, QString mode);
104 void ircUserModesSet(IrcUser *ircuser, QString modes);
107 void ircUserDestroyed();
108 void ircUserNickSet(QString nick);
115 QHash<IrcUser *, QString> _userModes;
119 QTextCodec *_codecForEncoding;
120 QTextCodec *_codecForDecoding;