diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 0c81f44..8f84d81 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
72 | 72 | ||
73 | protected List<Scene> m_Scenes = new List<Scene>(); | 73 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
234 | newFriends.RegionID = UUID.Zero; | 234 | newFriends.RegionID = UUID.Zero; |
235 | 235 | ||
236 | m_Friends.Add(client.AgentId, newFriends); | 236 | m_Friends.Add(client.AgentId, newFriends); |
237 | 237 | ||
238 | //StatusChange(client.AgentId, true); | 238 | //StatusChange(client.AgentId, true); |
239 | } | 239 | } |
240 | 240 | ||
@@ -289,7 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
289 | 289 | ||
290 | // Inform the friends that this user is online | 290 | // Inform the friends that this user is online |
291 | StatusChange(agentID, true); | 291 | StatusChange(agentID, true); |
292 | 292 | ||
293 | // Register that we need to send the list of online friends to this user | 293 | // Register that we need to send the list of online friends to this user |
294 | lock (m_NeedsListOfFriends) | 294 | lock (m_NeedsListOfFriends) |
295 | if (!m_NeedsListOfFriends.Contains(agentID)) | 295 | if (!m_NeedsListOfFriends.Contains(agentID)) |
@@ -439,11 +439,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
439 | if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) | 439 | if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) |
440 | friendList.Add(fi); | 440 | friendList.Add(fi); |
441 | } | 441 | } |
442 | /* | ||
442 | foreach (FriendInfo fi in friendList) | 443 | foreach (FriendInfo fi in friendList) |
443 | { | 444 | { |
444 | // Notify about this user status | 445 | // Notify about this user status |
445 | StatusNotify(fi, agentID, online); | 446 | StatusNotify(fi, agentID, online); |
446 | } | 447 | } |
448 | */ | ||
449 | |||
450 | StatusNotifyMass(friendList, agentID, online); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | private void StatusNotifyMass(List<FriendInfo> friendList, UUID userID, bool online) | ||
455 | { | ||
456 | string[] friendIDs = new string[friendList.Count]; | ||
457 | int notlocal = 0; | ||
458 | for (int x = 0; x < friendList.Count; x++) | ||
459 | { | ||
460 | UUID friendID = UUID.Zero; | ||
461 | if (UUID.TryParse(friendList[x].Friend, out friendID)) | ||
462 | { | ||
463 | if (!LocalStatusNotification(userID, friendID, online)) | ||
464 | { | ||
465 | friendIDs[notlocal++] = friendID.ToString(); | ||
466 | } | ||
467 | } | ||
468 | } | ||
469 | |||
470 | PresenceInfo[] friendSessions = PresenceService.GetAgents(friendIDs); | ||
471 | |||
472 | for (int x = 0; x < friendSessions.GetLength(0); x++) | ||
473 | { | ||
474 | PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); | ||
475 | if (friendSession != null) | ||
476 | { | ||
477 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
478 | m_FriendsSimConnector.StatusNotify(region, userID, new UUID(friendIDs[x]), online); | ||
479 | } | ||
447 | } | 480 | } |
448 | } | 481 | } |
449 | 482 | ||
@@ -456,7 +489,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
456 | // Try local | 489 | // Try local |
457 | if (LocalStatusNotification(userID, friendID, online)) | 490 | if (LocalStatusNotification(userID, friendID, online)) |
458 | return; | 491 | return; |
459 | 492 | ||
460 | // The friend is not here [as root]. Let's forward. | 493 | // The friend is not here [as root]. Let's forward. |
461 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 494 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
462 | if (friendSessions != null && friendSessions.Length > 0) | 495 | if (friendSessions != null && friendSessions.Length > 0) |
@@ -476,7 +509,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
476 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 509 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
477 | { | 510 | { |
478 | if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) | 511 | if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) |
479 | { | 512 | { |
480 | // we got a friendship offer | 513 | // we got a friendship offer |
481 | UUID principalID = new UUID(im.fromAgentID); | 514 | UUID principalID = new UUID(im.fromAgentID); |
482 | UUID friendID = new UUID(im.toAgentID); | 515 | UUID friendID = new UUID(im.toAgentID); |
@@ -701,7 +734,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
701 | // we're done | 734 | // we're done |
702 | return true; | 735 | return true; |
703 | } | 736 | } |
704 | 737 | ||
705 | return false; | 738 | return false; |
706 | } | 739 | } |
707 | 740 | ||