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 ***************************************************************************/
23 #include "chatwidget.h"
24 #include "bufferwidget.h"
27 Buffer::Buffer(QString netname, QString bufname) {
28 Buffer(BufferId(0, netname, bufname));
34 Buffer::Buffer(BufferId bufid) {
36 _networkName = bufid.network();
37 _bufferName = bufid.buffer();
39 if(_bufferName.isEmpty()) type = ServerBuffer;
40 else if(isChannelName(_bufferName)) type = ChannelBuffer;
41 else type = QueryBuffer;
46 s.beginGroup(QString("GUI/BufferStates/%1/%2").arg(netname).arg(bufname));
47 state->splitterState = s.value("Splitter").toByteArray();
50 emit bufferUpdated(this);
57 s.beginGroup(QString("GUI/BufferStates/%1/%2").arg(networkName).arg(bufferName));
58 s.setValue("Splitter", state->splitterState);
62 emit bufferDestroyed(this);
70 void Buffer::setActive(bool a) {
73 emit bufferUpdated(this);
77 void Buffer::appendChatLine(ChatLine *line) {
79 emit chatLineAppended(line);
82 void Buffer::prependChatLine(ChatLine *line) {
84 emit chatLinePrepended(line);
87 void Buffer::processUserInput(QString msg) {
88 // TODO User Input processing (plugins) -> well, this goes through MainWin into Core for processing... so...
89 emit userInput(id, msg);
92 void Buffer::setTopic(QString t) {
95 emit bufferUpdated(this);
98 void Buffer::addNick(QString nick, VarMap props) {
99 if(nick == ownNick()) setActive(true);
101 emit nickListChanged(nicks);
104 void Buffer::updateNick(QString nick, VarMap props) {
106 emit nickListChanged(nicks);
109 void Buffer::renameNick(QString oldnick, QString newnick) {
110 QVariant v = nicks.take(oldnick);
112 emit nickListChanged(nicks);
115 void Buffer::removeNick(QString nick) {
116 if(nick == ownNick()) setActive(false);
118 emit nickListChanged(nicks);
121 void Buffer::setOwnNick(QString nick) {
123 emit ownNickSet(nick);
126 /****************************************************************************************/
129 /****************************************************************************************/