X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientuserinputhandler.cpp;h=610a70210c7dff290d2bda57205c95fdb2401437;hp=31e8cb359d7c7bf9186402faa02a0ec02dd4be92;hb=127d1fd9e75d33f1a6a4cd4d30c259b00686c4ff;hpb=03a20917d9b3fe8c7651843b1d3d0ab2f50e90ef diff --git a/src/client/clientuserinputhandler.cpp b/src/client/clientuserinputhandler.cpp index 31e8cb35..610a7021 100644 --- a/src/client/clientuserinputhandler.cpp +++ b/src/client/clientuserinputhandler.cpp @@ -21,13 +21,17 @@ #include #include "client.h" +#include "clientaliasmanager.h" #include "clientuserinputhandler.h" #include "clientsettings.h" +#include "execwrapper.h" #include "ircuser.h" #include "network.h" -ClientUserInputHandler::ClientUserInputHandler(QObject *parent) : QObject(parent) { - NickCompletionSettings s; +ClientUserInputHandler::ClientUserInputHandler(QObject *parent) +: QObject(parent) +{ + TabCompletionSettings s; s.notify("CompletionSuffix", this, SLOT(completionSuffixChanged(QVariant))); completionSuffixChanged(s.completionSuffix()); } @@ -41,16 +45,28 @@ void ClientUserInputHandler::completionSuffixChanged(const QVariant &v) { // this would be the place for a client-side hook void ClientUserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const QString &msg) { - // check if we addressed a user and update its timestamp in that case - if(bufferInfo.type() == BufferInfo::ChannelBuffer) { - if(!msg.startsWith('/')) { - if(_nickRx.indexIn(msg) == 0) { - const Network *net = Client::network(bufferInfo.networkId()); - IrcUser *user = net ? net->ircUser(_nickRx.cap(1)) : 0; - if(user) - user->setLastSpokenTo(bufferInfo.bufferId(), QDateTime::currentDateTime().toUTC()); - } + + if(!msg.startsWith('/')) { + if(_nickRx.indexIn(msg) == 0) { + const Network *net = Client::network(bufferInfo.networkId()); + IrcUser *user = net ? net->ircUser(_nickRx.cap(1)) : 0; + if(user) + user->setLastSpokenTo(bufferInfo.bufferId(), QDateTime::currentDateTime().toUTC()); } } - emit sendInput(bufferInfo, msg); + + AliasManager::CommandList clist = Client::aliasManager()->processInput(bufferInfo, msg); + + for(int i = 0; i < clist.count(); i++) { + QString cmd = clist.at(i).second.section(' ', 0, 0).remove(0, 1).toUpper(); + if(cmd == "EXEC") + handleExec(clist.at(i).first, clist.at(i).second.section(' ', 1)); + else + emit sendInput(clist.at(i).first, clist.at(i).second); + } +} + +void ClientUserInputHandler::handleExec(const BufferInfo &bufferInfo, const QString &execString) { + ExecWrapper *exec = new ExecWrapper(this); // gets suicidal when it's done + exec->start(bufferInfo, execString); }