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 ***************************************************************************/
30 #include "bufferinfo.h"
32 #include <QVariantMap>
34 //!\brief Encapsulates the contents of a single channel, query or server status context.
35 /** A Buffer maintains a list of existing nicks and their status.
37 class Buffer : public QObject {
41 Buffer(BufferInfo, QObject *parent = 0);
56 Q_DECLARE_FLAGS(ActivityLevel, Activity)
58 bool isStatusBuffer() const;
59 Type bufferType() const;
60 bool isActive() const;
62 BufferInfo bufferInfo() const;
63 void updateBufferInfo(BufferInfo bufferid);
66 NetworkId networkId() const;
68 QString networkName() const;
71 QList<AbstractUiMsg *> contents() const;
73 QVariantMap nickList() const;
74 QString topic() const;
75 QString ownNick() const;
77 //! Returns a pointer to the associated IrcChannel object for the buffer.
78 /** A buffer has an IrcChannel object only if it is a channel buffer
79 * (i.e. bufferType() == ChannelType), and if it is active at the moment.
80 * \returns A pointer to the associated IrcChannel object, if the buffer is a channel and online; 0 else.
82 IrcChannel *ircChannel() const;
85 void userInput(const BufferInfo &, QString);
86 void nickListChanged(QVariantMap nicks);
87 void topicSet(QString topic);
88 void ownNickSet(QString ownNick);
89 void bufferUpdated(Buffer *);
91 void msgAppended(AbstractUiMsg *);
92 void msgPrepended(AbstractUiMsg *);
93 void layoutQueueEmpty();
96 void setActive(bool active = true);
97 void appendMsg(const Message &);
98 void prependMsg(const Message &);
100 void setIrcChannel(IrcChannel *chan = 0);
103 // void setTopic(QString);
104 // //void setNicks(QStringList);
105 // void addNick(QString nick, QVariantMap props);
106 // void renameNick(QString oldnick, QString newnick);
107 // void removeNick(QString nick);
108 // void updateNick(QString nick, QVariantMap props);
109 // void setOwnNick(QString nick);
111 void processUserInput(QString);
114 BufferInfo _bufferInfo;
118 IrcChannel *_ircChannel;
120 QList<Message> layoutQueue;
121 QList<AbstractUiMsg *> layoutedMsgs;
124 Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel)