mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 11:25:39 +08:00
we do need to ship the cached friends around on teleports (friends must come from grid)
This commit is contained in:
@@ -389,16 +389,10 @@ namespace OpenSim.Framework
|
||||
// Appearance
|
||||
public AvatarAppearance Appearance;
|
||||
|
||||
// DEBUG ON
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// DEBUG OFF
|
||||
|
||||
// Scripted
|
||||
public ControllerData[] Controllers;
|
||||
|
||||
public string CallbackURI; // to remove
|
||||
public string CallbackURI;
|
||||
public string NewCallbackURI;
|
||||
|
||||
// These two must have the same Count
|
||||
@@ -407,6 +401,10 @@ namespace OpenSim.Framework
|
||||
|
||||
public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
|
||||
|
||||
public List<UUID> CachedFriendsOnline;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public void SetLookAt(Vector3 value)
|
||||
{
|
||||
if (value.X == 0 && value.Y == 0)
|
||||
@@ -424,7 +422,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public virtual OSDMap Pack(EntityTransferContext ctx)
|
||||
{
|
||||
// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
|
||||
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
|
||||
|
||||
OSDMap args = new OSDMap();
|
||||
args["message_type"] = OSD.FromString("AgentData");
|
||||
@@ -575,6 +573,16 @@ namespace OpenSim.Framework
|
||||
args["parent_part"] = OSD.FromUUID(ParentPart);
|
||||
args["sit_offset"] = OSD.FromString(SitOffset.ToString());
|
||||
|
||||
if(CachedFriendsOnline != null && CachedFriendsOnline.Count > 0)
|
||||
{
|
||||
OSDArray cfonl = new OSDArray(CachedFriendsOnline.Count);
|
||||
{
|
||||
foreach(UUID id in CachedFriendsOnline)
|
||||
cfonl.Add(id);
|
||||
}
|
||||
args["cfonline"] = cfonl;
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -871,6 +879,14 @@ namespace OpenSim.Framework
|
||||
ParentPart = tmp.AsUUID();
|
||||
if (args.TryGetValue("sit_offset", out tmp) && tmp != null)
|
||||
Vector3.TryParse(tmp.AsString(), out SitOffset);
|
||||
|
||||
if (args.TryGetValue("cfonline", out tmp) && tmp != null)
|
||||
{
|
||||
OSDArray cfonl = (OSDArray)tmp;
|
||||
CachedFriendsOnline = new List<UUID>(cfonl.Count);
|
||||
foreach(OSD o in cfonl)
|
||||
CachedFriendsOnline.Add(o.AsUUID());
|
||||
}
|
||||
}
|
||||
|
||||
public AgentData()
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
}
|
||||
}
|
||||
|
||||
public void CacheFriendOnline(UUID userID, UUID friendID, bool online)
|
||||
public virtual void CacheFriendOnline(UUID userID, UUID friendID, bool online)
|
||||
{
|
||||
if (!m_OnlineFriendsCache.TryGetValue(userID, out HashSet<UUID> friends))
|
||||
{
|
||||
@@ -292,6 +292,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
else
|
||||
friends.Remove(friendID);
|
||||
}
|
||||
public virtual List<UUID> GetCachedFriendsOnline(UUID userID)
|
||||
{
|
||||
if (m_OnlineFriendsCache.TryGetValue(userID, out HashSet<UUID> friends))
|
||||
{
|
||||
List<UUID> friendslst = new List<UUID>(friends.Count);
|
||||
foreach(UUID id in friends)
|
||||
friendslst.Add(id);
|
||||
return friendslst;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnMakeRootAgent(ScenePresence sp)
|
||||
{
|
||||
|
||||
@@ -99,5 +99,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
bool IsFriendOnline(UUID userID, UUID friendID);
|
||||
void CacheFriendsOnline(UUID userID, List<UUID> friendsOnline, bool online);
|
||||
void CacheFriendOnline(UUID userID, UUID friendOnline, bool online);
|
||||
List<UUID> GetCachedFriendsOnline(UUID userID);
|
||||
}
|
||||
}
|
||||
@@ -4947,6 +4947,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
else
|
||||
cAgent.ActiveGroupTitle = Grouptitle;
|
||||
}
|
||||
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
if (friendsModule != null)
|
||||
{
|
||||
cAgent.CachedFriendsOnline = friendsModule.GetCachedFriendsOnline(UUID);
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyFrom(AgentData cAgent)
|
||||
@@ -5107,6 +5113,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock (m_originRegionIDAccessLock)
|
||||
m_originRegionID = cAgent.RegionID;
|
||||
|
||||
if (cAgent.CachedFriendsOnline != null)
|
||||
{
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
friendsModule?.CacheFriendsOnline(UUID, cAgent.CachedFriendsOnline, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool CopyAgent(out IAgentData agent)
|
||||
|
||||
Reference in New Issue
Block a user