X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=3cc3d07ab1c73c941fd0f0374e5c084155d38a47;hp=8c012acc781273d34b9137a85ec0ac580247f1e5;hb=6422c61b11d97f905b6a27f2d280e9ec0d8bb3e2;hpb=dba66762993507168b1a3de25cfd2d7bff0ff969 diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 8c012acc..3cc3d07a 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.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 * @@ -77,7 +77,8 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _ircParser(new IrcParser(this)), scriptEngine(new QScriptEngine(this)), _processMessages(false), - _ignoreListManager(this) + _ignoreListManager(this), + _highlightRuleManager(this) { SignalProxy *p = signalProxy(); p->setHeartBeatInterval(30); @@ -105,6 +106,9 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->attachSlot(SIGNAL(changePassword(PeerPtr,QString,QString,QString)), this, SLOT(changePassword(PeerPtr,QString,QString,QString))); p->attachSignal(this, SIGNAL(passwordChanged(PeerPtr,bool))); + p->attachSlot(SIGNAL(kickClient(int)), this, SLOT(kickClient(int))); + p->attachSignal(this, SIGNAL(disconnectFromCore())); + loadSettings(); initScriptEngine(); @@ -128,6 +132,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->synchronize(networkConfig()); p->synchronize(&_coreInfo); p->synchronize(&_ignoreListManager); + p->synchronize(&_highlightRuleManager); p->synchronize(transferManager()); // Restore session state if (restoreState) @@ -314,6 +319,9 @@ void CoreSession::recvMessageFromServer(NetworkId networkId, Message::Type type, if (_ignoreListManager.match(rawMsg, networkName) == IgnoreListManager::HardStrictness) return; + if (_highlightRuleManager.match(rawMsg, currentNetwork->myNick(), currentNetwork->identityPtr()->nicks())) + rawMsg.flags |= Message::Flag::Highlight; + _messageQueue << rawMsg; if (!_processMessages) { _processMessages = true; @@ -428,16 +436,16 @@ QString CoreSession::senderPrefixes(const QString &sender, const BufferInfo &buf { CoreNetwork *currentNetwork = network(bufferInfo.networkId()); if (!currentNetwork) { - return ""; + return {}; } if (bufferInfo.type() != BufferInfo::ChannelBuffer) { - return ""; + return {}; } IrcChannel *currentChannel = currentNetwork->ircChannel(bufferInfo.bufferName()); if (!currentChannel) { - return ""; + return {}; } const QString modes = currentChannel->userModes(nickFromMask(sender).toLower()); @@ -500,6 +508,9 @@ void CoreSession::createIdentity(const Identity &identity, const QVariantMap &ad createIdentity(coreIdentity); } +const QString CoreSession::strictSysident() { + return Core::instance()->strictSysIdent(_user); +} void CoreSession::createIdentity(const CoreIdentity &identity) { @@ -708,12 +719,26 @@ void CoreSession::globalAway(const QString &msg, const bool skipFormatting) } } -void CoreSession::changePassword(PeerPtr peer, const QString &userName, const QString &oldPassword, const QString &newPassword) -{ +void CoreSession::changePassword(PeerPtr peer, const QString &userName, const QString &oldPassword, const QString &newPassword) { + Q_UNUSED(peer); + bool success = false; UserId uid = Core::validateUser(userName, oldPassword); if (uid.isValid() && uid == user()) success = Core::changeUserPassword(uid, newPassword); - emit passwordChanged(peer, success); + signalProxy()->restrictTargetPeers(signalProxy()->sourcePeer(), [&]{ + emit passwordChanged(nullptr, success); + }); +} + +void CoreSession::kickClient(int peerId) { + auto peer = signalProxy()->peerById(peerId); + if (peer == nullptr) { + qWarning() << "Invalid peer Id: " << peerId; + return; + } + signalProxy()->restrictTargetPeers(peer, [&]{ + emit disconnectFromCore(); + }); }