1 /***************************************************************************
2 * Copyright (C) 2005-07 by the Quassel IRC 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) 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 ***************************************************************************/
31 #include "bufferinfo.h"
33 #include <QVariantMap>
35 //!\brief Encapsulates the contents of a single channel, query or server status context.
36 /** A Buffer maintains a list of existing nicks and their status.
38 class Buffer : public QObject {
42 Buffer(BufferInfo, QObject *parent = 0);
57 Q_DECLARE_FLAGS(ActivityLevel, Activity)
59 bool isStatusBuffer() const;
60 Type bufferType() const;
61 bool isActive() const;
63 BufferInfo bufferInfo() const;
64 void updateBufferInfo(BufferInfo bufferid);
67 NetworkId networkId() const;
69 QString networkName() const;
72 QList<AbstractUiMsg *> contents() const;
74 QVariantMap nickList() const;
75 QString topic() const;
76 QString ownNick() const;
78 //! Returns a pointer to the associated IrcChannel object for the buffer.
79 /** A buffer has an IrcChannel object only if it is a channel buffer
80 * (i.e. bufferType() == ChannelType), and if it is active at the moment.
81 * \returns A pointer to the associated IrcChannel object, if the buffer is a channel and online; 0 else.
83 IrcChannel *ircChannel() const;
84 NickModel *nickModel() const;
87 void userInput(const BufferInfo &, QString);
88 void nickListChanged(QVariantMap nicks);
89 void topicSet(QString topic);
90 void ownNickSet(QString ownNick);
91 void bufferUpdated(Buffer *);
93 void msgAppended(AbstractUiMsg *);
94 void msgPrepended(AbstractUiMsg *);
95 void layoutQueueEmpty();
98 void setActive(bool active = true);
99 void appendMsg(const Message &);
100 void prependMsg(const Message &);
102 void setIrcChannel(IrcChannel *chan = 0);
105 // void setTopic(QString);
106 // //void setNicks(QStringList);
107 // void addNick(QString nick, QVariantMap props);
108 // void renameNick(QString oldnick, QString newnick);
109 // void removeNick(QString nick);
110 // void updateNick(QString nick, QVariantMap props);
111 // void setOwnNick(QString nick);
113 void processUserInput(QString);
116 BufferInfo _bufferInfo;
120 QPointer<IrcChannel> _ircChannel;
121 QPointer<NickModel> _nickModel;
123 QList<Message> layoutQueue;
124 QList<AbstractUiMsg *> layoutedMsgs;
127 Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel)