From 41fab6fb5a3f500abf9aba8b5f8ef7d64605d124 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 7 Oct 2013 22:41:35 -0300 Subject: [PATCH] priorize following list in listusernamespartial --- src/twister.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/twister.cpp b/src/twister.cpp index ea254071..11014505 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -1191,6 +1191,17 @@ Value listusernamespartial(const Array& params, bool fHelp) set retStrings; + // priorize users in following list + BOOST_FOREACH(const string &user, m_following) + { + int toCompare = std::min( userStartsWith.size(), user.size() ); + if( memcmp( user.data(), userStartsWith.data(), toCompare ) == 0 ) + retStrings.insert( user ); + if( retStrings.size() >= count ) + break; + } + + // now the rest, the entire block chain for(CBlockIndex* pindex = pindexBest; pindex && retStrings.size() < count; pindex = pindex->pprev ) { CBlock block; if( !ReadBlockFromDisk(block, pindex) )