summaryrefslogtreecommitdiff
path: root/src/modules/m_alias.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-22 17:35:33 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-22 17:35:33 +0000
commitc65590448cb15be3902b64c379fc0cb189c3d60c (patch)
treee608c9457829325ed78d85b0137af0e28ec0d2bf /src/modules/m_alias.cpp
parent8f8459533be2c9954e2bec948dee7570d50b094d (diff)
Fix for alias var names within aliases
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6059 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_alias.cpp')
-rw-r--r--src/modules/m_alias.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 55241c278..4e32f2856 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -144,7 +144,13 @@ class ModuleAlias : public Module
std::string compare = original_line.substr(command.length());
while (*(compare.c_str()) == ' ')
compare.erase(compare.begin());
-
+
+ std::string safe(original_line);
+
+ /* Escape out any $ symbols in the user provided text */
+
+ SearchAndReplace(safe, "$", "\r");
+
for (unsigned int i = 0; i < Aliases.size(); i++)
{
if (Aliases[i].text == c)
@@ -184,7 +190,7 @@ class ModuleAlias : public Module
if (crlf == std::string::npos)
{
ServerInstance->Log(DEBUG,"Single line alias: '%s'", Aliases[i].replace_with.c_str());
- DoCommand(Aliases[i].replace_with, user, original_line);
+ DoCommand(Aliases[i].replace_with, user, safe);
return 1;
}
else
@@ -195,7 +201,7 @@ class ModuleAlias : public Module
while ((command = commands.GetToken()) != "")
{
ServerInstance->Log(DEBUG,"Execute: '%s'", command.c_str());
- DoCommand(command, user, original_line);
+ DoCommand(command, user, safe);
}
return 1;
}
@@ -238,6 +244,9 @@ class ModuleAlias : public Module
SearchAndReplace(newline, "$host", user->host);
SearchAndReplace(newline, "$vhost", user->dhost);
+ /* Unescape any variable names in the user text before sending */
+ SearchAndReplace(newline, "\r", "$");
+
irc::tokenstream ss(newline);
const char* parv[127];
int x = 0;