aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs45
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 febd4ca..57dde76 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))
@@ -442,11 +442,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
442 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) 442 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
443 friendList.Add(fi); 443 friendList.Add(fi);
444 } 444 }
445 /*
445 foreach (FriendInfo fi in friendList) 446 foreach (FriendInfo fi in friendList)
446 { 447 {
447 // Notify about this user status 448 // Notify about this user status
448 StatusNotify(fi, agentID, online); 449 StatusNotify(fi, agentID, online);
449 } 450 }
451 */
452
453 StatusNotifyMass(friendList, agentID, online);
454 }
455 }
456
457 private void StatusNotifyMass(List<FriendInfo> friendList, UUID userID, bool online)
458 {
459 string[] friendIDs = new string[friendList.Count];
460 int notlocal = 0;
461 for (int x = 0; x < friendList.Count; x++)
462 {
463 UUID friendID = UUID.Zero;
464 if (UUID.TryParse(friendList[x].Friend, out friendID))
465 {
466 if (!LocalStatusNotification(userID, friendID, online))
467 {
468 friendIDs[notlocal++] = friendID.ToString();
469 }
470 }
471 }
472
473 PresenceInfo[] friendSessions = PresenceService.GetAgents(friendIDs);
474
475 for (int x = 0; x < friendSessions.GetLength(0); x++)
476 {
477 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
478 if (friendSession != null)
479 {
480 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
481 m_FriendsSimConnector.StatusNotify(region, userID, new UUID(friendIDs[x]), online);
482 }
450 } 483 }
451 } 484 }
452 485
@@ -459,7 +492,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
459 // Try local 492 // Try local
460 if (LocalStatusNotification(userID, friendID, online)) 493 if (LocalStatusNotification(userID, friendID, online))
461 return; 494 return;
462 495
463 // The friend is not here [as root]. Let's forward. 496 // The friend is not here [as root]. Let's forward.
464 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 497 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
465 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 498 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
@@ -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);
@@ -688,7 +721,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
688 // we're done 721 // we're done
689 return true; 722 return true;
690 } 723 }
691 724
692 return false; 725 return false;
693 } 726 }
694 727