summaryrefslogtreecommitdiff
path: root/src/misc.cpp
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2011-06-20 23:09:03 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2011-06-20 23:09:03 -0400
commit26018713913475aaaaac60a527fb93df76ec45c7 (patch)
treec3f7e6e3f847cc1c187af2359fb41b8e83d8fafd /src/misc.cpp
parenta3d0ab3d09cbb636b680ab5015646ccb3200a70c (diff)
Fix long-standing issue with the get token functions if the delimiter wasn't found in the string but you wanted the first "token".
Diffstat (limited to 'src/misc.cpp')
-rw-r--r--src/misc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/misc.cpp b/src/misc.cpp
index 73791a0cc..da07eaa28 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -416,7 +416,7 @@ bool isvalidchar(char c)
Anope::string myStrGetToken(const Anope::string &str, char dilim, int token_number)
{
if (str.empty() || str.find(dilim) == Anope::string::npos)
- return "";
+ return token_number ? "" : str;
Anope::string substring;
sepstream sep(str, dilim);
@@ -438,7 +438,7 @@ Anope::string myStrGetToken(const Anope::string &str, char dilim, int token_numb
Anope::string myStrGetTokenRemainder(const Anope::string &str, const char dilim, int token_number)
{
if (str.empty() || str.find(dilim) == Anope::string::npos)
- return "";
+ return token_number ? "" : str;
Anope::string substring;
sepstream sep(str, dilim);