summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp31
-rw-r--r--src/modules/m_alias.cpp3
2 files changed, 27 insertions, 7 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index bf0ca094f..24e76eb49 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -963,18 +963,24 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
if((ch == '#') && !in_quote)
in_comment = true;
- if(((ch == '\n') || (ch == '\r')) && in_quote)
+ /*if(((ch == '\n') || (ch == '\r')) && in_quote)
{
errorstream << "Got a newline within a quoted section, this is probably a typo: " << filename << ":" << linenumber << std::endl;
return false;
- }
+ }*/
switch(ch)
{
case '\n':
+ if (in_quote)
+ {
+ ServerInstance->Log(DEBUG, "Got \\n inside value");
+ line += '\n';
+ }
linenumber++;
case '\r':
- in_comment = false;
+ if (!in_quote)
+ in_comment = false;
case '\0':
continue;
case '\t':
@@ -1012,7 +1018,8 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o
}
}
- line += ch;
+ if (ch != '\r')
+ line += ch;
if(ch == '<')
{
@@ -1112,8 +1119,8 @@ bool ServerConfig::ParseLine(ConfigDataHash &target, std::string &line, long lin
bool in_quote;
got_name = got_key = in_quote = false;
-
- // std::cout << "ParseLine(data, '" << line << "', " << linenumber << ", stream)" << std::endl;
+
+ //std::cout << "ParseLine(data, '" << line << "', " << linenumber << ", stream)" << std::endl;
for(std::string::iterator c = line.begin(); c != line.end(); c++)
{
@@ -1172,6 +1179,16 @@ bool ServerConfig::ParseLine(ConfigDataHash &target, std::string &line, long lin
current_value += *c;
continue;
}
+ else if ((*c == '\n') && (in_quote))
+ {
+ /* Got a 'real' \n, treat it as part of the value */
+ current_value += '\n';
+ continue;
+ }
+ else if ((*c == '\r') && (in_quote))
+ /* Got a \r, drop it */
+ continue;
+
if (*c == '"')
{
if (!in_quote)
@@ -1183,7 +1200,7 @@ bool ServerConfig::ParseLine(ConfigDataHash &target, std::string &line, long lin
{
/* Leaving quotes, we have the value */
results.push_back(KeyVal(current_key, current_value));
-
+
// std::cout << "<" << tagname << ":" << current_key << "> " << current_value << std::endl;
in_quote = false;
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index c2b26db52..804e9c5b5 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -169,15 +169,18 @@ 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);
return 1;
}
else
{
+ ServerInstance->Log(DEBUG,"Multi line alias: '%s'", Aliases[i].replace_with.c_str());
irc::sepstream commands(Aliases[i].replace_with, '\n');
std::string command = "*";
while ((command = commands.GetToken()) != "")
{
+ ServerInstance->Log(DEBUG,"Execute: '%s'", command.c_str());
DoCommand(command, user, original_line);
}
return 1;