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
***************************************************************************/
27
#include "chatwidget.h"
33
class ChatWidgetContents;
37
//!\brief Encapsulates the contents of a single channel, query or server status context.
38
/** A Buffer maintains a list of existing nicks and their status. New messages can be appended using
39
* displayMsg(). A buffer displays its contents by way of a BufferWidget, which can be shown
40
* (and created on demand) by calling showWidget().
42
class Buffer : public QObject {
46
//Buffer(QString network, QString buffer);
51
enum Type { ServerBuffer, ChannelBuffer, QueryBuffer };
59
Q_DECLARE_FLAGS(ActivityLevel, Activity)
61
Type bufferType() { return type; }
62
bool isActive() { return active; }
64
QString networkName() { return _networkName; }
65
QString bufferName() { return _bufferName; }
66
QString displayName();
67
BufferId bufferId() { return id; }
68
QList<ChatLine *> contents() { return lines; }
69
VarMap nickList() { return nicks; }
70
QString topic() { return _topic; }
71
QString ownNick() { return _ownNick; }
72
bool isStatusBuffer() { return bufferType() == ServerBuffer; }
75
void userInput(BufferId, QString);
76
//void msgDisplayed(Message);
77
void chatLineAppended(ChatLine *);
78
void chatLinePrepended(ChatLine *);
79
void nickListChanged(VarMap nicks);
80
void topicSet(QString topic);
81
void ownNickSet(QString ownNick);
82
void bufferUpdated(Buffer *);
83
void bufferDestroyed(Buffer *);
86
void setActive(bool active = true);
87
//void displayMsg(Message);
88
//void prependMessages(QList<Message>); // for backlog
89
void appendChatLine(ChatLine *);
90
void prependChatLine(ChatLine *);
91
//void prependChatLines(QList<ChatLine *>);
92
//void recvStatusMsg(QString msg);
93
void setTopic(QString);
94
//void setNicks(QStringList);
95
void addNick(QString nick, VarMap props);
96
void renameNick(QString oldnick, QString newnick);
97
void removeNick(QString nick);
98
void updateNick(QString nick, VarMap props);
99
void setOwnNick(QString nick);
101
void processUserInput(QString);
111
QString _networkName, _bufferName;
114
//QList<Message> _contents;
115
QList<ChatLine *> lines;
118
Q_DECLARE_OPERATORS_FOR_FLAGS(Buffer::ActivityLevel)