diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-23 18:06:26 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-23 18:06:26 +0000 |
commit | deb85740798d3438563628736c0e83edb6966b6e (patch) | |
tree | a8ad119fa9d1624a174cded210aba05a1af36173 /src/modules | |
parent | 3f3d3d302899aacf8b49fcc871265c965d1fb0fc (diff) |
Add some stuff to change how we process a token sepeperated stream
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7800 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_alias.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_cloaking.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_http_client.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_samode.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 13 |
6 files changed, 18 insertions, 19 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index a8f079bf1..2bf4440b0 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -104,12 +104,12 @@ class ModuleAlias : public Module std::string word; for (int j = 0; j < index; j++) - word = ss.GetToken(); + ss.GetToken(word); if (everything_after) { - std::string more = "*"; - while ((more = ss.GetToken()) != "") + std::string more; + while (ss.GetToken(more)) { word.append(" "); word.append(more); @@ -201,8 +201,8 @@ class ModuleAlias : public Module else { irc::sepstream commands(Aliases[i].replace_with, '\n'); - std::string command = "*"; - while ((command = commands.GetToken()) != "") + std::string command; + while (commands.GetToken(command)) { DoCommand(command, user, safe); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 20e821e85..ad7a7e337 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -192,7 +192,7 @@ class CloakUser : public ModeHandler for (int j = 0; j < 4; j++) { - octet[j] = seps.GetToken(); + seps.GetToken(octet[j]); i[j] = atoi(octet[j].c_str()); } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 341f2b861..fd88651c0 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -92,10 +92,8 @@ class cmd_helpop : public command_t irc::sepstream stream(value, '\n'); std::string token = "*"; - while ((token = stream.GetToken()) != "") - { + while (stream.GetToken(token)) user->WriteServ("NOTICE %s :%s", user->nick, token.c_str()); - } user->WriteServ("NOTICE %s :*** End of HELPOP", user->nick); } diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index aa97242e0..a2f80687f 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -176,10 +176,10 @@ bool HTTPSocket::ParseURL(const std::string &iurl) for (int p = 0;; p++) { - std::string part = tokenizer.GetToken(); - if (part.empty() && tokenizer.StreamEnd()) + std::string part; + if (!tokenizer.GetToken(part)) break; - + if ((p == 0) && (part[part.length() - 1] == ':')) { // Protocol ('http:') diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index f4f00f55a..7f3e9f428 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -47,7 +47,7 @@ class cmd_samode : public command_t std::deque<std::string> n; irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse()); std::string one = "*"; - while ((one = spaced.GetToken()) != "") + while (spaced.GetToken(one)) n.push_back(one); Event rmode((char *)&n, NULL, "send_mode"); diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index c939f2349..2b4b6d301 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -341,9 +341,9 @@ void TreeSocket::SendCapabilities() this->WriteLine("CAPAB START"); /* Send module names, split at 509 length */ - std::string item = "*"; + std::string item; std::string line = "CAPAB MODULES "; - while ((item = modulelist.GetToken()) != "") + while (modulelist.GetToken(item)) { if (line.length() + item.length() + 1 > 509) { @@ -384,8 +384,9 @@ void TreeSocket::SendCapabilities() bool TreeSocket::HasItem(const std::string &list, const std::string &item) { irc::commasepstream seplist(list); - std::string item2 = "*"; - while ((item2 = seplist.GetToken()) != "") + std::string item2; + + while (seplist.GetToken(item2)) { if (item2 == item) return true; @@ -397,9 +398,9 @@ bool TreeSocket::HasItem(const std::string &list, const std::string &item) std::string TreeSocket::ListDifference(const std::string &one, const std::string &two) { irc::commasepstream list_one(one); - std::string item = "*"; + std::string item; std::string result; - while ((item = list_one.GetToken()) != "") + while (list_one.GetToken(item)) { if (!HasItem(two, item)) { |