X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientuserinputhandler.cpp;h=6b4668242588ed66d2b622a204a61611c4eda9cb;hp=2f89081093251cfa0a228a3d6823482275e045bd;hb=e8a39b4c3c92e193ab861a3fea84a261bb6fbd24;hpb=bc715c756677bee7cdb7109cc656e3e5f526c988 diff --git a/src/client/clientuserinputhandler.cpp b/src/client/clientuserinputhandler.cpp index 2f890810..6b466824 100644 --- a/src/client/clientuserinputhandler.cpp +++ b/src/client/clientuserinputhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 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 * @@ -20,18 +20,20 @@ #include "clientuserinputhandler.h" +#include "bufferinfo.h" #include "buffermodel.h" #include "client.h" #include "clientaliasmanager.h" +#include "clientbufferviewconfig.h" +#include "clientbufferviewmanager.h" +#include "clientignorelistmanager.h" #include "clientsettings.h" #include "execwrapper.h" +#include "ignorelistmanager.h" #include "ircuser.h" +#include "messagemodel.h" #include "network.h" #include "types.h" -#include "bufferinfo.h" -#include "clientbufferviewconfig.h" -#include "clientbufferviewmanager.h" -#include "messagemodel.h" #include @@ -62,7 +64,7 @@ void ClientUserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const if (!msg.startsWith('/')) { if (_nickRx.indexIn(msg) == 0) { const Network *net = Client::network(bufferInfo.networkId()); - IrcUser *user = net ? net->ircUser(_nickRx.cap(1)) : 0; + IrcUser *user = net ? net->ircUser(_nickRx.cap(1)) : nullptr; if (user) user->setLastSpokenTo(bufferInfo.bufferId(), QDateTime::currentDateTime().toUTC()); } @@ -116,6 +118,35 @@ void ClientUserInputHandler::handleQuery(const BufferInfo &bufferInfo, const QSt } +void ClientUserInputHandler::handleIgnore(const BufferInfo &bufferInfo, const QString &text) +{ + if (text.isEmpty()) { + emit Client::instance()->displayIgnoreList(""); + return; + } + // If rule contains no ! or @, we assume it is just a nickname, and turn it into an ignore rule for that nick + QString rule = (text.contains('!') || text.contains('@')) ? text : text + "!*@*"; + + Client::ignoreListManager()->requestAddIgnoreListItem( + IgnoreListManager::IgnoreType::SenderIgnore, + rule, + false, + // Use a dynamic ignore rule, for reversibility + IgnoreListManager::StrictnessType::SoftStrictness, + // Use current network as scope + IgnoreListManager::ScopeType::NetworkScope, + Client::network(bufferInfo.networkId())->networkName(), + true + ); +} + +void ClientUserInputHandler::handleList(const BufferInfo &bufferInfo, const QString &text) +{ + // Pass along any potential search parameters, list channels immediately + Client::instance()->displayChannelList(bufferInfo.networkId(), text, true); +} + + void ClientUserInputHandler::switchBuffer(const NetworkId &networkId, const QString &bufferName) { BufferId newBufId = Client::networkModel()->bufferId(networkId, bufferName);