From 329771bb20094d2c4587310f1c3c2b7342d837e6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Feb 2016 20:41:57 +0300 Subject: Update last seen also from online list. It lack account id, but can update time. --- src/actormanager.cpp | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'src/actormanager.cpp') diff --git a/src/actormanager.cpp b/src/actormanager.cpp index cc46ac34b..bfcc92e81 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -1965,22 +1965,30 @@ void ActorManager::updateNameId(const std::string &name, if (!mEnableIdCollecting) return; const int id = static_cast(beingId); - if (id < 2000000 || id >= 110000000) + if (id && + id < 2000000 || + id >= 110000000) + { return; + } if (mIdName.find(beingId) == mIdName.end() || mIdName[beingId].find(name) == mIdName[beingId].end()) { mIdName[beingId].insert(name); - std::string dir = settings.usersIdDir; const std::string idStr = toString(id); - dir.append(idStr); - dir.append("/"); - dir.append(stringToHexPath(name)); const std::string dateStr = getDateTimeString(); - Files::saveTextFile(dir, - "info.txt", - (name + "\n").append(dateStr)); + std::string dir; + if (beingId != BeingId_zero) + { + dir = settings.usersIdDir; + dir.append(idStr); + dir.append("/"); + dir.append(stringToHexPath(name)); + Files::saveTextFile(dir, + "info.txt", + (name + "\n").append(dateStr)); + } dir = settings.usersDir; dir.append(stringToHexPath(name)); @@ -1990,6 +1998,20 @@ void ActorManager::updateNameId(const std::string &name, } } +void ActorManager::updateSeenPlayers(const std::set + &onlinePlayers) +{ + if (!mEnableIdCollecting) + return; + + FOR_EACH (std::set::const_iterator, it, onlinePlayers) + { + const std::string name = *it; + if (!findBeingByName(name, ActorType::Player)) + updateNameId(name, BeingId_zero); + } +} + #ifdef EATHENA_SUPPORT void ActorManager::removeRoom(const int chatId) { -- cgit v1.2.3-70-g09d2