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/Connectors | |
parent | This makes the display names work better for foreigners (diff) | |
download | opensim-SC-3307db5d4aedec5cc31541e9a28a95abdd4999d0.zip opensim-SC-3307db5d4aedec5cc31541e9a28a95abdd4999d0.tar.gz opensim-SC-3307db5d4aedec5cc31541e9a28a95abdd4999d0.tar.bz2 opensim-SC-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/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 046f755..853e524 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -404,7 +404,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
404 | GetBoolResponse(request, out reason); | 404 | GetBoolResponse(request, out reason); |
405 | } | 405 | } |
406 | 406 | ||
407 | public void StatusNotification(List<string> friends, UUID userID, bool online) | 407 | public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online) |
408 | { | 408 | { |
409 | Hashtable hash = new Hashtable(); | 409 | Hashtable hash = new Hashtable(); |
410 | hash["userID"] = userID.ToString(); | 410 | hash["userID"] = userID.ToString(); |
@@ -421,8 +421,59 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
421 | 421 | ||
422 | XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList); | 422 | XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList); |
423 | string reason = string.Empty; | 423 | string reason = string.Empty; |
424 | GetBoolResponse(request, out reason); | ||
425 | 424 | ||
425 | // Send and get reply | ||
426 | List<UUID> friendsOnline = new List<UUID>(); | ||
427 | XmlRpcResponse response = null; | ||
428 | try | ||
429 | { | ||
430 | response = request.Send(m_ServerURL, 10000); | ||
431 | } | ||
432 | catch (Exception e) | ||
433 | { | ||
434 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); | ||
435 | reason = "Exception: " + e.Message; | ||
436 | return friendsOnline; | ||
437 | } | ||
438 | |||
439 | if (response.IsFault) | ||
440 | { | ||
441 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); | ||
442 | reason = "XMLRPC Fault"; | ||
443 | return friendsOnline; | ||
444 | } | ||
445 | |||
446 | hash = (Hashtable)response.Value; | ||
447 | //foreach (Object o in hash) | ||
448 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
449 | try | ||
450 | { | ||
451 | if (hash == null) | ||
452 | { | ||
453 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
454 | reason = "Internal error 1"; | ||
455 | return friendsOnline; | ||
456 | } | ||
457 | |||
458 | // Here is the actual response | ||
459 | foreach (object key in hash.Keys) | ||
460 | { | ||
461 | if (key is string && ((string)key).StartsWith("friend_") && hash[key] != null) | ||
462 | { | ||
463 | UUID uuid; | ||
464 | if (UUID.TryParse(hash[key].ToString(), out uuid)) | ||
465 | friendsOnline.Add(uuid); | ||
466 | } | ||
467 | } | ||
468 | |||
469 | } | ||
470 | catch (Exception e) | ||
471 | { | ||
472 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
473 | reason = "Exception: " + e.Message; | ||
474 | } | ||
475 | |||
476 | return friendsOnline; | ||
426 | } | 477 | } |
427 | 478 | ||
428 | public List<UUID> GetOnlineFriends(UUID userID, List<string> friends) | 479 | public List<UUID> GetOnlineFriends(UUID userID, List<string> friends) |