the alias engine can now expand nicks to their hostnames
authorMarcus Eggenberger <egs@quassel-irc.org>
Mon, 11 Aug 2008 19:49:24 +0000 (21:49 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Mon, 11 Aug 2008 19:49:24 +0000 (21:49 +0200)
src/core/userinputhandler.cpp
src/qtui/settingspages/aliasesmodel.cpp

index bc3bb65..6167170 100644 (file)
@@ -368,6 +368,8 @@ void UserInputHandler::expand(const QString &alias, const BufferInfo &bufferInfo
   for(int i = 0; i < commands.count(); i++) {
     QString command = commands[i];
     for(int j = params.count(); j > 0; j--) {
+      IrcUser *ircUser = network()->ircUser(params[j - 1]);
+      command = command.replace(QString("$%1:hostname").arg(j), ircUser ? ircUser->host() : QString("*"));
       command = command.replace(QString("$%1").arg(j), params[j - 1]);
     }
     command = command.replace("$0", msg);
index 6504fae..a072330 100644 (file)
@@ -54,6 +54,7 @@ QVariant AliasesModel::data(const QModelIndex &index, int role) const {
       return "<b>The string the shortcut will be expanded to</b><br />"
        "<b>special variables:</b><br />"
        " - <b>$i</b> represenents the i'th parameter.<br />"
+       " - <b>$i:hostname</b> represents the hostname of the user identified by the i'th parameter or a * if unknown.<br />"
        " - <b>$0</b> the whole string.<br />"
        " - <b>$currentnick</b> your current nickname<br />"
        " - <b>$channelname</b> the name of the selected channel<br /><br />"