summaryrefslogtreecommitdiff
path: root/src/modules/m_cban.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-13 18:12:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-13 18:12:04 +0000
commit17d91b065e98963451e595d7697357a40a1c4425 (patch)
treeb7923a7069383257910df9dde29d4b5d1c4293cb /src/modules/m_cban.cpp
parenta09c6eb1ce2b91299137c42ff65d3e57468d3672 (diff)
Fixes for tokenization oddness with metadata, and weird behaviour of std::istringstream where the .str() method returns the whole string from the start to end, even AFTER youve read elements from it!
Use irc::tokenstream instead and add some overridden methods to it. This is smarter as it reuses code and allows us to format metadata the same way we format irc data. NOTE: If you run any old servers alongside new servers (this revision) you might see spurious colons on the start of reasons for svsholds, cbans and filters. These can safely be ignored) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7283 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cban.cpp')
-rw-r--r--src/modules/m_cban.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 04a99674d..3b6c4eccd 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -202,20 +202,19 @@ class ModuleCBan : public Module
std::string EncodeCBan(const CBan &ban)
{
std::ostringstream stream;
- stream << ban.chname << " " << ban.set_by << " " << ban.set_on << " " << ban.length << " " << ban.reason;
- return stream.str();
+ stream << ban.chname << " " << ban.set_by << " " << ban.set_on << " " << ban.length << " :" << ban.reason;
+ return stream.str();
}
CBan DecodeCBan(const std::string &data)
{
CBan res;
- std::istringstream stream(data);
- stream >> res.chname;
- stream >> res.set_by;
- stream >> res.set_on;
- stream >> res.length;
- res.reason = stream.str();
-
+ irc::tokenstream tokens(data);
+ tokens.GetToken(res.chname);
+ tokens.GetToken(res.set_by);
+ tokens.GetToken(res.set_on);
+ tokens.GetToken(res.length);
+ tokens.GetToken(res.reason);
return res;
}