aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs2
2 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index b693f2d..31bcded 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -94,6 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
94 protected Dictionary<UUID, UserFriendData> m_Friends = new Dictionary<UUID, UserFriendData>(); 94 protected Dictionary<UUID, UserFriendData> m_Friends = new Dictionary<UUID, UserFriendData>();
95 95
96 /// <summary> 96 /// <summary>
97 /// Maintain a record of clients that need to notify about their online status. This only
98 /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism.
99 /// </summary>
100 protected HashSet<UUID> m_NeedsToNotifyStatus = new HashSet<UUID>();
101
102 /// <summary>
97 /// Maintain a record of viewers that need to be sent notifications for friends that are online. This only 103 /// Maintain a record of viewers that need to be sent notifications for friends that are online. This only
98 /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism. 104 /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism.
99 /// </summary> 105 /// </summary>
@@ -324,6 +330,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
324 private void OnMakeRootAgent(ScenePresence sp) 330 private void OnMakeRootAgent(ScenePresence sp)
325 { 331 {
326 RecacheFriends(sp.ControllingClient); 332 RecacheFriends(sp.ControllingClient);
333
334 lock (m_NeedsToNotifyStatus)
335 {
336 if (m_NeedsToNotifyStatus.Remove(sp.UUID))
337 {
338 // Inform the friends that this user is online. This can only be done once the client is a Root Agent.
339 StatusChange(sp.UUID, true);
340 }
341 }
327 } 342 }
328 343
329 private void OnClientLogin(IClientAPI client) 344 private void OnClientLogin(IClientAPI client)
@@ -331,8 +346,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
331 UUID agentID = client.AgentId; 346 UUID agentID = client.AgentId;
332 347
333 //m_log.DebugFormat("[XXX]: OnClientLogin!"); 348 //m_log.DebugFormat("[XXX]: OnClientLogin!");
334 // Inform the friends that this user is online 349
335 StatusChange(agentID, true); 350 // Register that we need to send this user's status to friends. This can only be done
351 // once the client becomes a Root Agent, because as part of sending out the presence
352 // we also get back the presence of the HG friends, and we need to send that to the
353 // client, but that can only be done when the client is a Root Agent.
354 lock (m_NeedsToNotifyStatus)
355 m_NeedsToNotifyStatus.Add(agentID);
336 356
337 // Register that we need to send the list of online friends to this user 357 // Register that we need to send the list of online friends to this user
338 lock (m_NeedsListOfOnlineFriends) 358 lock (m_NeedsListOfOnlineFriends)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index d00945e..be12935 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -239,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
239 fList.Add(s.Substring(0, 36)); 239 fList.Add(s.Substring(0, 36));
240 } 240 }
241 241
242 // FIXME: also query the presence status of friends in other grids (like in HGStatusNotifier.Notify())
243
242 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray()); 244 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
243 foreach (PresenceInfo pi in presence) 245 foreach (PresenceInfo pi in presence)
244 { 246 {