mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
try improve profiles online indication a bit more
This commit is contained in:
@@ -268,11 +268,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
friends = new HashSet<UUID>();
|
||||
m_OnlineFriendsCache[userID] = friends;
|
||||
}
|
||||
foreach (UUID friendID in friendsOnline)
|
||||
if (online)
|
||||
{
|
||||
if (online)
|
||||
foreach (UUID friendID in friendsOnline)
|
||||
friends.Add(friendID);
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (UUID friendID in friendsOnline)
|
||||
friends.Remove(friendID);
|
||||
}
|
||||
}
|
||||
@@ -374,6 +377,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
lock (m_Friends)
|
||||
{
|
||||
foreach(HashSet<UUID> friends in m_OnlineFriendsCache.Values)
|
||||
friends.Remove(agentID);
|
||||
m_OnlineFriendsCache.Remove(agentID);
|
||||
if (m_Friends.TryGetValue(agentID, out UserFriendData friendsData))
|
||||
{
|
||||
|
||||
@@ -238,10 +238,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
// FIXME: also query the presence status of friends in other grids (like in HGStatusNotifier.Notify())
|
||||
|
||||
PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
|
||||
if (presence.Length == 0)
|
||||
return;
|
||||
|
||||
if (!m_OnlineFriendsCache.TryGetValue(userID, out HashSet<UUID> friends))
|
||||
{
|
||||
friends = new HashSet<UUID>();
|
||||
m_OnlineFriendsCache[userID] = friends;
|
||||
}
|
||||
|
||||
foreach (PresenceInfo pi in presence)
|
||||
{
|
||||
if (UUID.TryParse(pi.UserID, out UUID presenceID))
|
||||
{
|
||||
online.Add(presenceID);
|
||||
friends.Add(presenceID);
|
||||
}
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID);
|
||||
|
||||
@@ -1842,7 +1842,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
||||
if(client.SceneAgent is ScenePresence sp && sp.IsViewerUIGod)
|
||||
{
|
||||
Services.Interfaces.PresenceInfo[] pi = Scene.PresenceService?.GetAgents(new string[] { agent.ToString() });
|
||||
return pi != null && pi.Length > 0;
|
||||
return pi is not null && pi.Length > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user