Various stuff, cosmetic fixes, fiddling with IrcUsers and NetworkInfos in Buffers.
[quassel.git] / src / common / ircchannel.h
1 /***************************************************************************
2  *   Copyright (C) 2005/06 by The Quassel Team                             *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
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.                                   *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
20
21 #ifndef _IRCCHANNEL_H_
22 #define _IRCCHANNEL_H_
23
24 #include <QHash>
25 #include <QString>
26 #include <QStringList>
27 #include <QVariantMap>
28
29 class SignalProxy;
30 class NetworkInfo;
31 class IrcUser;
32
33 class IrcChannel : public QObject {
34   Q_OBJECT
35
36   Q_PROPERTY(QString name READ name STORED false)
37   Q_PROPERTY(QString topic READ topic WRITE setTopic STORED false)
38
39 public:
40   IrcChannel(const QString &channelname, NetworkInfo *networkInfo);
41   ~IrcChannel();
42
43   bool isKnownUser(IrcUser *ircuser) const;
44   bool isValidChannelUserMode(const QString &mode) const;
45
46   bool initialized() const;
47
48   QString name() const;
49   QString topic() const;
50
51   QList<IrcUser *> ircUsers() const;
52
53   QString userMode(IrcUser *ircuser) const;
54   QString userMode(const QString &nick) const;
55
56
57 public slots:  
58   void setTopic(const QString &topic);
59
60   void join(IrcUser *ircuser);
61   void join(const QString &nick);
62
63   void part(IrcUser *ircuser);
64   void part(const QString &nick);
65
66   void setUserModes(IrcUser *ircuser, const QString &modes);
67   void setUserModes(const QString &nick, const QString &modes);
68
69   void addUserMode(IrcUser *ircuser, const QString &mode);
70   void addUserMode(const QString &nick, const QString &mode);
71
72   void removeUserMode(IrcUser *ircuser, const QString &mode);
73   void removeUserMode(const QString &nick, const QString &mode);
74
75   // init geters
76   QVariantMap initUserModes() const;
77
78   // init seters
79   void initSetUserModes(const QVariantMap &usermodes);
80
81   void setInitialized();
82
83 signals:
84   void topicSet(QString topic);
85   void userModesSet(QString nick, QString modes);
86   void userModeAdded(QString nick, QString mode);
87   void userModeRemoved(QString nick, QString mode);
88
89   void ircUserJoined(IrcUser *ircuser);
90   void ircUserParted(IrcUser *ircuser);
91
92   void initDone();
93
94 private slots:
95    void ircUserDestroyed();
96
97 private:
98   bool _initialized;
99   QString _name;
100   QString _topic;
101
102   QHash<IrcUser *, QString> _userModes; 
103
104   NetworkInfo *networkInfo;
105 };
106
107 #endif