summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-20 23:48:24 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-20 23:48:24 +0000
commit304cdf56ae13fe52925758735c5d7a34781b96b5 (patch)
tree06db28c2b561a0baecfbc953982c642004e62360
parenta16d415ee4a4b8a48f01c80919a11a026911c957 (diff)
Fix bad duplication of filters containing spaces across the network.
(filters containing spaces arent strictly allowed because they cant be defined via the /filter command, however we do define them in the config on chatspike so its worth supporting them. This will now translate space to \7 in the metadata, and translate it back at the receiving end. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6417 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_filter.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h
index 282592776..2889091f7 100644
--- a/src/modules/m_filter.h
+++ b/src/modules/m_filter.h
@@ -311,7 +311,13 @@ Version FilterBase::GetVersion()
std::string FilterBase::EncodeFilter(FilterResult* filter)
{
std::ostringstream stream;
- stream << filter->freeform << " " << filter->action << " " << filter->gline_time << " " << filter->reason;
+ std::string x = filter->freeform;
+
+ for (std::string::iterator n = x.begin(); n != x.end(); n++)
+ if (*n == ' ')
+ *n = '\7';
+
+ stream << x << " " << filter->action << " " << filter->gline_time << " " << filter->reason;
return stream.str();
}
@@ -319,10 +325,16 @@ FilterResult FilterBase::DecodeFilter(const std::string &data)
{
FilterResult res;
std::istringstream stream(data);
+
stream >> res.freeform;
stream >> res.action;
stream >> res.gline_time;
res.reason = stream.str();
+
+ for (std::string::iterator n = res.freeform.begin(); n != res.freeform.end(); n++)
+ if (*n == '\7')
+ *n = ' ';
+
return res;
}