diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-13 18:12:04 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-13 18:12:04 +0000 |
commit | 17d91b065e98963451e595d7697357a40a1c4425 (patch) | |
tree | b7923a7069383257910df9dde29d4b5d1c4293cb /src/hashcomp.cpp | |
parent | a09c6eb1ce2b91299137c42ff65d3e57468d3672 (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/hashcomp.cpp')
-rw-r--r-- | src/hashcomp.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 0a7264576..630faba4b 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -215,6 +215,30 @@ bool irc::tokenstream::GetToken(std::string &token) return false; } +bool irc::tokenstream::GetToken(irc::string &token) +{ + std::string stdstring; + bool returnval = GetToken(stdstring); + token = assign(stdstring); + return returnval; +} + +bool irc::tokenstream::GetToken(int &token) +{ + std::string tok; + bool returnval = GetToken(tok); + token = ConvToInt(tok); + return returnval; +} + +bool irc::tokenstream::GetToken(long &token) +{ + std::string tok; + bool returnval = GetToken(tok); + token = ConvToInt(tok); + return returnval; +} + irc::sepstream::sepstream(const std::string &source, char seperator) : tokens(source), sep(seperator) { last_starting_position = tokens.begin(); |