From 304cdf56ae13fe52925758735c5d7a34781b96b5 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 20 Jan 2007 23:48:24 +0000 Subject: 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 --- src/modules/m_filter.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/modules') 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; } -- cgit v1.3.1-10-gc9f91