diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-10-11 00:39:51 -0700 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-10-11 00:39:51 -0700 |
commit | ac0ad5dc63f89dfc64f869f0babc1899e01ac867 (patch) | |
tree | ab0e41516319862f5c6b41484bc5cd0338e7bd33 /src/irc.cpp | |
parent | eb49457ff279721cc3cef10fe68fd75b4aa71833 (diff) | |
parent | 6032e4f4e7c1892a4e3f0a1a2007e4cd0fe99937 (diff) |
Merge pull request #1901 from laanwj/2012_10_remove_strlcpy
get rid of strlcpy.h
Diffstat (limited to 'src/irc.cpp')
-rw-r--r-- | src/irc.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/irc.cpp b/src/irc.cpp index ec7eea3cf4..17d5ff1a5a 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -5,9 +5,10 @@ #include "irc.h" #include "net.h" -#include "strlcpy.h" #include "base58.h" +#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith() + using namespace std; using namespace boost; @@ -324,30 +325,27 @@ void ThreadIRCSeed2(void* parg) if (vWords.size() < 2) continue; - char pszName[10000]; - pszName[0] = '\0'; + std::string strName; if (vWords[1] == "352" && vWords.size() >= 8) { // index 7 is limited to 16 characters // could get full length name at index 10, but would be different from join messages - strlcpy(pszName, vWords[7].c_str(), sizeof(pszName)); + strName = vWords[7].c_str(); printf("IRC got who\n"); } if (vWords[1] == "JOIN" && vWords[0].size() > 1) { // :username!username@50000007.F000000B.90000002.IP JOIN :#channelname - strlcpy(pszName, vWords[0].c_str() + 1, sizeof(pszName)); - if (strchr(pszName, '!')) - *strchr(pszName, '!') = '\0'; + strName = vWords[0].substr(1, vWords[0].find('!', 1) - 1); printf("IRC got join\n"); } - if (pszName[0] == 'u') + if (boost::algorithm::starts_with(strName, "u")) { CAddress addr; - if (DecodeAddress(pszName, addr)) + if (DecodeAddress(strName, addr)) { addr.nTime = GetAdjustedTime(); if (addrman.Add(addr, addrConnect, 51 * 60)) |