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 ***************************************************************************/
28 #include "quasselui.h"
32 //!\brief Encapsulates the contents of a single channel, query or server status context.
33 /** A Buffer maintains a list of existing nicks and their status. New messages can be appended using
34 * displayMsg(). A buffer displays its contents by way of a BufferWidget, which can be shown
35 * (and created on demand) by calling showWidget().
37 class Buffer : public QObject {
44 enum Type { ServerBuffer, ChannelBuffer, QueryBuffer };
52 Q_DECLARE_FLAGS(ActivityLevel, Activity)
54 Type bufferType() const;
55 bool isActive() const;
57 QString networkName() const;
58 QString bufferName() const;
59 QString displayName() const;
60 BufferId bufferId() const;
61 QList<AbstractUiMsg *> contents() const;
62 VarMap nickList() const;
63 QString topic() const;
64 QString ownNick() const;
65 bool isStatusBuffer() const;
68 void userInput(const BufferId &, QString);
69 void nickListChanged(VarMap nicks);
70 void topicSet(QString topic);
71 void ownNickSet(QString ownNick);
72 void bufferUpdated(Buffer *);
73 void bufferDestroyed(Buffer *);
75 void msgAppended(AbstractUiMsg *);
76 void msgPrepended(AbstractUiMsg *);
77 void layoutQueueEmpty();
80 void setActive(bool active = true);
81 void appendMsg(const Message &);
82 void prependMsg(const Message &);
84 void setTopic(QString);
85 //void setNicks(QStringList);
86 void addNick(QString nick, VarMap props);
87 void renameNick(QString oldnick, QString newnick);
88 void removeNick(QString nick);
89 void updateNick(QString nick, VarMap props);
90 void setOwnNick(QString nick);
92 void processUserInput(QString);
102 QString _networkName, _bufferName;
105 QList<Message> layoutQueue;
106 QList<AbstractUiMsg *> layoutedMsgs;
109 Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel)