X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=e438b9c7966e1a81ad9d19a80dec75796e85a32c;hb=fedbdbbf696f1cc2b3343cfd63f91c3daaf74bed;hp=69ffbfc787396f59d9267e27ae7fd97123e16d09;hpb=278aef059d7652b2a4e1359d72bb4028524246d4;p=quassel.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 69ffbfc7..e438b9c7 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -23,6 +23,7 @@ #include "bufferinfo.h" #include "buffersyncer.h" #include "clientbacklogmanager.h" +#include "clientirclisthelper.h" #include "bufferviewmanager.h" #include "global.h" #include "identity.h" @@ -68,10 +69,13 @@ Client::Client(QObject *parent) _bufferSyncer(0), _backlogManager(new ClientBacklogManager(this)), _bufferViewManager(0), + _ircListHelper(new ClientIrcListHelper(this)), _connectedToCore(false), _syncedToCore(false) { _monitorBuffer = new Buffer(BufferInfo(), this); + _signalProxy->synchronize(_ircListHelper); + connect(_backlogManager, SIGNAL(backlog(BufferId, const QVariantList &)), this, SLOT(receiveBacklog(BufferId, const QVariantList &))); } @@ -83,6 +87,7 @@ Client::~Client() { void Client::init() { _currentCoreAccount = 0; _networkModel = new NetworkModel(this); + connect(this, SIGNAL(bufferUpdated(BufferInfo)), _networkModel, SLOT(bufferUpdated(BufferInfo))); connect(this, SIGNAL(networkRemoved(NetworkId)), @@ -235,7 +240,8 @@ void Client::coreNetworkCreated(NetworkId id) { } void Client::coreNetworkRemoved(NetworkId id) { - if(!_networks.contains(id)) return; + if(!_networks.contains(id)) + return; Network *net = _networks.take(id); emit networkRemoved(net->networkId()); net->deleteLater(); @@ -318,21 +324,26 @@ void Client::setSyncedToCore() { emit coreConnectionStateChanged(true); } +void Client::setSecuredConnection() { + emit securedConnection(); +} + void Client::disconnectFromCore() { if(!isConnected()) return; + _connectedToCore = false; if(socket) { socket->close(); socket->deleteLater(); } - _connectedToCore = false; _syncedToCore = false; - setCurrentCoreAccount(0); emit disconnected(); emit coreConnectionStateChanged(false); // Clear internal data. Hopefully nothing relies on it at this point. + setCurrentCoreAccount(0); + if(_bufferSyncer) { _bufferSyncer->deleteLater(); _bufferSyncer = 0; @@ -342,7 +353,7 @@ void Client::disconnectFromCore() { _bufferViewManager->deleteLater(); _bufferViewManager = 0; } - + _networkModel->clear(); QHash::iterator bufferIter = _buffers.begin(); @@ -497,7 +508,7 @@ void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) { void Client::receiveBacklog(BufferId bufferId, const QVariantList &msgs) { Buffer *buffer_ = buffer(bufferId); if(!buffer_) { - qWarning() << "Client::recvBacklogData(): received Backlog for unknown Buffer:" << bufferId; + qWarning() << "Client::receiveBacklog(): received Backlog for unknown Buffer:" << bufferId; return; } @@ -532,7 +543,7 @@ void Client::layoutMsg() { if(buffer->layoutMsg()) { layoutQueue.append(buffer); // Buffer has more messages in its queue --> Round Robin return; - } + } if(layoutQueue.isEmpty()) layoutTimer->stop(); @@ -546,25 +557,33 @@ void Client::checkForHighlight(Message &msg) { NotificationSettings notificationSettings; const Network *net = network(msg.bufferInfo().networkId()); if(net && !net->myNick().isEmpty()) { - if(notificationSettings.highlightCurrentNick()) { - QRegExp nickRegExp("^(.*\\W)?" + QRegExp::escape(net->myNick()) + "(\\W.*)?$"); + QStringList nickList; + if(notificationSettings.highlightNick() == NotificationSettings::CurrentNick) { + nickList << net->myNick(); + } else if(notificationSettings.highlightNick() == NotificationSettings::AllNicks) { + nickList = identity(net->identity())->nicks(); + } + foreach(QString nickname, nickList) { + QRegExp nickRegExp("^(.*\\W)?" + QRegExp::escape(nickname) + "(\\W.*)?$"); if((msg.type() & (Message::Plain | Message::Notice | Message::Action)) && !(msg.flags() & Message::Self) && nickRegExp.exactMatch(msg.text())) { - msg.setFlags(msg.flags() | Message::Highlight); - return; + msg.setFlags(msg.flags() | Message::Highlight); + return; } } + foreach(QVariant highlight, notificationSettings.highlightList()) { QVariantMap highlightRule = highlight.toMap(); if(!highlightRule["enable"].toBool()) continue; + Qt::CaseSensitivity caseSensitivity = highlightRule["cs"].toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive; QString name = highlightRule["name"].toString(); QRegExp userRegExp; if(highlightRule["regex"].toBool()) { - userRegExp = QRegExp(name); + userRegExp = QRegExp(name, caseSensitivity); } else { - userRegExp = QRegExp("^(.*\\W)?" + QRegExp::escape(name) + "(\\W.*)?$"); + userRegExp = QRegExp("^(.*\\W)?" + QRegExp::escape(name) + "(\\W.*)?$", caseSensitivity); } if((msg.type() & (Message::Plain | Message::Notice | Message::Action)) && !(msg.flags() & Message::Self) @@ -597,7 +616,7 @@ void Client::removeBuffer(BufferId id) { } void Client::bufferRemoved(BufferId bufferId) { - // first remove the buffer from has. this prohibits further lastSeenUpdates + // first remove the buffer from hash. this prohibits further lastSeenUpdates Buffer *buff = 0; if(_buffers.contains(bufferId)) { buff = _buffers.take(bufferId);