コード例 #1
0
ファイル: coreuserinputhandler.cpp プロジェクト: AlD/quassel
void CoreUserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const QString &msg)
{
    if (msg.isEmpty())
        return;

    AliasManager::CommandList list = coreSession()->aliasManager().processInput(bufferInfo, msg);

    for (int i = 0; i < list.count(); i++) {
        QString cmd = list.at(i).second.section(' ', 0, 0).remove(0, 1).toUpper();
        QString payload = list.at(i).second.section(' ', 1);
        handle(cmd, Q_ARG(BufferInfo, list.at(i).first), Q_ARG(QString, payload));
    }
}
コード例 #2
0
// this would be the place for a client-side hook
void ClientUserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const QString &msg)
{
    if (msg.isEmpty())
        return;

    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());
        }
    }

    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();
        QString payload = clist.at(i).second.section(' ', 1);
        handle(cmd, Q_ARG(BufferInfo, clist.at(i).first), Q_ARG(QString, payload));
    }
}