diff options
author | Diva Canto | 2011-06-07 19:36:04 -0700 |
---|---|---|
committer | Diva Canto | 2011-06-07 19:36:04 -0700 |
commit | 3307db5d4aedec5cc31541e9a28a95abdd4999d0 (patch) | |
tree | 86d7b644e3b2cb1c77fa6e2b5c9ea7223e8e64f8 /OpenSim/Services/HypergridService | |
parent | This makes the display names work better for foreigners (diff) | |
download | opensim-SC_OLD-3307db5d4aedec5cc31541e9a28a95abdd4999d0.zip opensim-SC_OLD-3307db5d4aedec5cc31541e9a28a95abdd4999d0.tar.gz opensim-SC_OLD-3307db5d4aedec5cc31541e9a28a95abdd4999d0.tar.bz2 opensim-SC_OLD-3307db5d4aedec5cc31541e9a28a95abdd4999d0.tar.xz |
This hopefully fixes all issues with online/offline notifications across grids. http://opensimulator.org/mantis/view.php?id=5528
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r-- | OpenSim/Services/HypergridService/UserAgentService.cs | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 8d78f97..29d8b3d 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -324,14 +324,16 @@ namespace OpenSim.Services.HypergridService | |||
324 | return false; | 324 | return false; |
325 | } | 325 | } |
326 | 326 | ||
327 | public void StatusNotification(List<string> friends, UUID foreignUserID, bool online) | 327 | public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online) |
328 | { | 328 | { |
329 | if (m_FriendsService == null || m_PresenceService == null) | 329 | if (m_FriendsService == null || m_PresenceService == null) |
330 | { | 330 | { |
331 | m_log.WarnFormat("[USER AGENT SERVICE]: Unable to perform status notifications because friends or presence services are missing"); | 331 | m_log.WarnFormat("[USER AGENT SERVICE]: Unable to perform status notifications because friends or presence services are missing"); |
332 | return; | 332 | return new List<UUID>(); |
333 | } | 333 | } |
334 | 334 | ||
335 | List<UUID> localFriendsOnline = new List<UUID>(); | ||
336 | |||
335 | m_log.DebugFormat("[USER AGENT SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends", foreignUserID, friends.Count); | 337 | m_log.DebugFormat("[USER AGENT SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends", foreignUserID, friends.Count); |
336 | 338 | ||
337 | // First, let's double check that the reported friends are, indeed, friends of that user | 339 | // First, let's double check that the reported friends are, indeed, friends of that user |
@@ -372,8 +374,12 @@ namespace OpenSim.Services.HypergridService | |||
372 | 374 | ||
373 | if (friendSession != null) | 375 | if (friendSession != null) |
374 | { | 376 | { |
375 | ForwardStatusNotificationToSim(friendSession.RegionID, friendSession.UserID, foreignUserID, online); | 377 | ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online); |
376 | usersToBeNotified.Remove(friendSession.UserID.ToString()); | 378 | usersToBeNotified.Remove(friendSession.UserID.ToString()); |
379 | UUID id; | ||
380 | if (UUID.TryParse(friendSession.UserID, out id)) | ||
381 | localFriendsOnline.Add(id); | ||
382 | |||
377 | } | 383 | } |
378 | } | 384 | } |
379 | 385 | ||
@@ -388,9 +394,17 @@ namespace OpenSim.Services.HypergridService | |||
388 | m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url); | 394 | m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url); |
389 | } | 395 | } |
390 | } | 396 | } |
397 | |||
398 | // and finally, let's send the online friends | ||
399 | if (online) | ||
400 | { | ||
401 | return localFriendsOnline; | ||
402 | } | ||
403 | else | ||
404 | return new List<UUID>(); | ||
391 | } | 405 | } |
392 | 406 | ||
393 | protected void ForwardStatusNotificationToSim(UUID regionID, string user, UUID foreignUserID, bool online) | 407 | protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) |
394 | { | 408 | { |
395 | UUID userID; | 409 | UUID userID; |
396 | if (UUID.TryParse(user, out userID)) | 410 | if (UUID.TryParse(user, out userID)) |
@@ -398,15 +412,15 @@ namespace OpenSim.Services.HypergridService | |||
398 | if (m_FriendsLocalSimConnector != null) | 412 | if (m_FriendsLocalSimConnector != null) |
399 | { | 413 | { |
400 | m_log.DebugFormat("[USER AGENT SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline")); | 414 | m_log.DebugFormat("[USER AGENT SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline")); |
401 | m_FriendsLocalSimConnector.StatusNotify(userID, foreignUserID, online); | 415 | m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online); |
402 | } | 416 | } |
403 | else | 417 | else |
404 | { | 418 | { |
405 | GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID); | 419 | GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID); |
406 | if (region != null) | 420 | if (region != null) |
407 | { | 421 | { |
408 | m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, user, foreignUserID, (online ? "online" : "offline")); | 422 | m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); |
409 | m_FriendsSimConnector.StatusNotify(region, userID, foreignUserID, online); | 423 | m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); |
410 | } | 424 | } |
411 | } | 425 | } |
412 | } | 426 | } |