X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient%2Fclient.cpp;h=58058871bc790071e8addd36bce645aef5704864;hb=68878dc8366f2f4a0afe132847aad9a51a80cdbf;hp=0a19351e8cf12da975da946a0a9d686a4aebbb27;hpb=c1722505b4906fe59c48aad54e6545a17afb78d7;p=quassel.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 0a19351e..58058871 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -56,7 +56,6 @@ #include QPointer Client::instanceptr = 0; -Quassel::Features Client::_coreFeatures = 0; /*** Initialization/destruction ***/ @@ -107,6 +106,7 @@ Client::Client(QObject *parent) _inputHandler(0), _networkConfig(0), _ignoreListManager(0), + _highlightRuleManager(0), _transferManager(0), _transferModel(new TransferModel(this)), _messageModel(0), @@ -161,6 +161,7 @@ void Client::init() p->attachSlot(SIGNAL(passwordChanged(PeerPtr,bool)), this, SLOT(corePasswordChanged(PeerPtr,bool))); p->attachSignal(this, SIGNAL(requestKickClient(int)), SIGNAL(kickClient(int))); + p->attachSlot(SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore())); //connect(mainUi(), SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &))); connect(mainUi(), SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore())); @@ -186,9 +187,9 @@ AbstractUi *Client::mainUi() } -void Client::setCoreFeatures(Quassel::Features features) +bool Client::isCoreFeatureEnabled(Quassel::Feature feature) { - _coreFeatures = features; + return coreConnection()->peer() ? coreConnection()->peer()->hasFeature(feature) : false; } @@ -419,16 +420,23 @@ void Client::setSyncedToCore() _ignoreListManager = new ClientIgnoreListManager(this); p->synchronize(ignoreListManager()); + // create Core-Side HighlightRuleManager + Q_ASSERT(!_highlightRuleManager); + _highlightRuleManager = new HighlightRuleManager(this); + p->synchronize(highlightRuleManager()); + +/* not ready yet // create TransferManager and DccConfig if core supports them Q_ASSERT(!_dccConfig); Q_ASSERT(!_transferManager); - if (coreFeatures() & Quassel::DccFileTransfer) { + if (isCoreFeatureEnabled(Quassel::Feature::DccFileTransfer)) { _dccConfig = new DccConfig(this); p->synchronize(dccConfig()); _transferManager = new ClientTransferManager(this); _transferModel->setManager(_transferManager); p->synchronize(transferManager()); } +*/ // trigger backlog request once all active bufferviews are initialized connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); @@ -452,7 +460,7 @@ void Client::finishConnectionInitialization() disconnect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); requestInitialBacklog(); - if (coreFeatures().testFlag(Quassel::BufferActivitySync)) + if (isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) bufferSyncer()->markActivitiesChanged(); } @@ -475,7 +483,6 @@ void Client::disconnectFromCore() void Client::setDisconnectedFromCore() { _connected = false; - _coreFeatures = 0; emit disconnected(); emit coreConnectionStateChanged(false); @@ -507,6 +514,11 @@ void Client::setDisconnectedFromCore() _ignoreListManager = 0; } + if (_highlightRuleManager) { + _highlightRuleManager->deleteLater(); + _highlightRuleManager = nullptr; + } + if (_transferManager) { _transferModel->setManager(nullptr); _transferManager->deleteLater(); @@ -687,7 +699,8 @@ void Client::changePassword(const QString &oldPassword, const QString &newPasswo } -void Client::kickClient(int peerId) { +void Client::kickClient(int peerId) +{ emit instance()->requestKickClient(peerId); }