summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-03 20:41:57 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-03 20:41:57 +0300
commit329771bb20094d2c4587310f1c3c2b7342d837e6 (patch)
treea9bcf6cf296a9a7ca3fac16730d3cc76fb938a20
parent601a1969d813672d7cc65edc3bd873067c551e4d (diff)
downloadplus-329771bb20094d2c4587310f1c3c2b7342d837e6.tar.gz
plus-329771bb20094d2c4587310f1c3c2b7342d837e6.tar.bz2
plus-329771bb20094d2c4587310f1c3c2b7342d837e6.tar.xz
plus-329771bb20094d2c4587310f1c3c2b7342d837e6.zip
Update last seen also from online list.
It lack account id, but can update time.
-rw-r--r--src/actormanager.cpp38
-rw-r--r--src/actormanager.h2
-rw-r--r--src/gui/windows/whoisonline.cpp4
3 files changed, 36 insertions, 8 deletions
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<int>(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<std::string>
+ &onlinePlayers)
+{
+ if (!mEnableIdCollecting)
+ return;
+
+ FOR_EACH (std::set<std::string>::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)
{
diff --git a/src/actormanager.h b/src/actormanager.h
index 6e9020d20..2738181f7 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -359,6 +359,8 @@ class ActorManager final: public ConfigListener
void updateNameId(const std::string &name,
const BeingId beingId);
+ void updateSeenPlayers(const std::set<std::string> &onlinePlayers);
+
size_t size() const
{ return mActors.size(); }
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 81225ba33..d51af6b05 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -346,6 +346,8 @@ void WhoIsOnline::loadList(const std::vector<OnlinePlayer*> &list)
chatWindow->updateOnline(mOnlineNicks);
if (socialWindow)
socialWindow->updateActiveList();
+ if (actorManager)
+ actorManager->updateSeenPlayers(mOnlineNicks);
}
updateSize();
mFriends.clear();
@@ -681,6 +683,8 @@ void WhoIsOnline::slowLogic()
chatWindow->updateOnline(mOnlineNicks);
if (socialWindow)
socialWindow->updateActiveList();
+ if (actorManager)
+ actorManager->updateSeenPlayers(mOnlineNicks);
}
}
break;