X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fhashcomp.cpp;h=4fee9fd55d2925be015b014296ae8ddfafde6caa;hb=dfb1e0da7823641ad648f9fbd19b43d2e6b0d7ad;hp=47c36b91bac176c03ff84124cbbc67d797d1cdb6;hpb=8b418f081f7ecbfdd51c84fae2298f927155fac0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 47c36b91b..4fee9fd55 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -193,8 +193,8 @@ size_t irc::insensitive::operator()(const std::string &s) const return t; } -irc::tokenstream::tokenstream(const std::string& msg, size_t start) - : message(msg, start) +irc::tokenstream::tokenstream(const std::string& msg, size_t start, size_t end) + : message(msg, start, end) , position(0) { } @@ -212,7 +212,7 @@ bool irc::tokenstream::GetMiddle(std::string& token) size_t separator = message.find(' ', position); if (separator == std::string::npos) { - token.assign(message, position); + token.assign(message, position, std::string::npos); position = message.length(); return true; } @@ -234,9 +234,8 @@ bool irc::tokenstream::GetTrailing(std::string& token) // If this is true then we have a token! if (message[position] == ':') { - token.assign(message, position + 1); + token.assign(message, position + 1, std::string::npos); position = message.length(); - ServerInstance->Logs->Log("HASHCOMP", LOG_DEBUG, "TRAILING %s next (none)", token.c_str()); return true; } @@ -288,6 +287,16 @@ bool irc::sepstream::StreamEnd() return this->pos > this->tokens.length(); } +bool irc::sepstream::Contains(const std::string& value) +{ + std::string token; + while (GetToken(token)) + if (value == token) + return true; + + return false; +} + irc::portparser::portparser(const std::string &source, bool allow_overlapped) : sep(source), in_range(0), range_begin(0), range_end(0), overlapped(allow_overlapped) {