-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
*
- * InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2005-2009 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
*
- * This program is free but copyrighted software; see
- * the file COPYING for details.
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
*
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
/* $Core */
#include "inspircd.h"
#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
size_t nspace::hash_compare<irc::string, std::less<irc::string> >::operator()(const irc::string &s) const
#else
- size_t CoreExport nspace::hash<irc::string>::operator()(const irc::string &s) const
+ size_t CoreExport irc::hash::operator()(const irc::string &s) const
#endif
{
register size_t t = 0;
{
std::string::iterator lsp = last_starting_position;
- for(; n != tokens.end(); ++n)
+ while (n != tokens.end())
{
- if(*n == sep || n+1 == tokens.end())
+ if ((*n == sep) || (n+1 == tokens.end()))
{
last_starting_position = n+1;
- token = std::string(lsp, n+1 == tokens.end() ? ++n : n++);
- return true;
+ token = std::string(lsp, n+1 == tokens.end() ? n+1 : n++);
+
+ while ((token.length()) && (token.find_last_of(sep) == token.length() - 1))
+ token.erase(token.end() - 1);
+
+ if (token.empty())
+ n++;
+
+ return n == tokens.end() ? false : true;
}
+
+ n++;
}
token = "";
bool irc::sepstream::StreamEnd()
{
- return n == tokens.end();
+ return ((n + 1) == tokens.end());
}
irc::sepstream::~sepstream()