From: Marcus Eggenberger Date: Mon, 11 Aug 2008 19:49:24 +0000 (+0200) Subject: the alias engine can now expand nicks to their hostnames X-Git-Tag: 0.3.0~62 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=94be5fb31afd8f3befa8cb2cf1b3c2e5ef3cdba5;hp=b9a73f8181f4cee4b5b226b4a641796f04e85179 the alias engine can now expand nicks to their hostnames --- diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index bc3bb654..61671707 100644 --- a/src/core/userinputhandler.cpp +++ b/src/core/userinputhandler.cpp @@ -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); diff --git a/src/qtui/settingspages/aliasesmodel.cpp b/src/qtui/settingspages/aliasesmodel.cpp index 6504fae5..a0723305 100644 --- a/src/qtui/settingspages/aliasesmodel.cpp +++ b/src/qtui/settingspages/aliasesmodel.cpp @@ -54,6 +54,7 @@ QVariant AliasesModel::data(const QModelIndex &index, int role) const { return "The string the shortcut will be expanded to
" "special variables:
" " - $i represenents the i'th parameter.
" + " - $i:hostname represents the hostname of the user identified by the i'th parameter or a * if unknown.
" " - $0 the whole string.
" " - $currentnick your current nickname
" " - $channelname the name of the selected channel

"