X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=bac736b0c3c74eda9fb53f46c68d9bfb79d5b632;hp=93c5e2155e6bb209ac39fcb62e44a0c9c7e209bd;hb=af456476e906a564d9faf3381b8bc3111fdb2bbd;hpb=fb011e52bc6613198a65e037f0752f6361339aeb diff --git a/src/client/client.cpp b/src/client/client.cpp index 93c5e215..bac736b0 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -35,10 +35,14 @@ #include "messagemodel.h" #include "network.h" #include "networkmodel.h" +#include "quassel.h" #include "quasselui.h" #include "signalproxy.h" #include "util.h" +#include +#include + QPointer Client::instanceptr = 0; AccountId Client::_currentCoreAccount = 0; @@ -76,7 +80,8 @@ Client::Client(QObject *parent) _messageModel(0), _messageProcessor(0), _connectedToCore(false), - _syncedToCore(false) + _syncedToCore(false), + _debugLog(&_debugLogBuffer) { _signalProxy->synchronize(_ircListHelper); } @@ -275,6 +280,7 @@ void Client::setSyncedToCore() { connect(bufferSyncer(), SIGNAL(lastSeenMsgSet(BufferId, MsgId)), _networkModel, SLOT(setLastSeenMsgId(BufferId, MsgId))); connect(bufferSyncer(), SIGNAL(bufferRemoved(BufferId)), this, SLOT(bufferRemoved(BufferId))); connect(bufferSyncer(), SIGNAL(bufferRenamed(BufferId, QString)), this, SLOT(bufferRenamed(BufferId, QString))); + connect(networkModel(), SIGNAL(setLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &))); signalProxy()->synchronize(bufferSyncer()); // create a new BufferViewManager @@ -302,6 +308,7 @@ void Client::disconnectedFromCore() { emit disconnected(); emit coreConnectionStateChanged(false); + backlogManager()->reset(); messageProcessor()->reset(); // Clear internal data. Hopefully nothing relies on it at this point. @@ -361,9 +368,9 @@ void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) { //recvMessage(net, Message::server("", QString("[STATUS] %1").arg(msg))); } -void Client::recvMessage(const Message &msg_) { - Message msg = msg_; - messageProcessor()->process(msg); +void Client::recvMessage(const Message &msg) { + Message msg_ = msg; + messageProcessor()->process(msg_); } void Client::setBufferLastSeenMsg(BufferId id, const MsgId &msgId) { @@ -401,3 +408,16 @@ void Client::bufferRenamed(BufferId bufferId, const QString &newName) { networkModel()->setData(bufferIndex, newName, Qt::DisplayRole); } } + +void Client::logMessage(QtMsgType type, const char *msg) { + fprintf(stderr, "%s\n", msg); + fflush(stderr); + if(type == QtFatalMsg) { + Quassel::logFatalMessage(msg); + } else { + QString msgString = QString("%1\n").arg(msg); + instance()->_debugLog << msgString; + emit instance()->logUpdated(msgString); + } +} +