X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientuserinputhandler.cpp;h=610a70210c7dff290d2bda57205c95fdb2401437;hp=296fc1cb344dc9089fb3088d6b3b28be587d8cfa;hb=b64a1e62e2168dc21e350fccc6c42b0d0d5e2a35;hpb=bc00bc7bc6137f5f14e53fbaac6c4a0ccdffd8a3 diff --git a/src/client/clientuserinputhandler.cpp b/src/client/clientuserinputhandler.cpp index 296fc1cb..610a7021 100644 --- a/src/client/clientuserinputhandler.cpp +++ b/src/client/clientuserinputhandler.cpp @@ -21,12 +21,16 @@ #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) { +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); }