diff options
author | Diva Canto | 2011-05-24 09:38:03 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-24 09:38:03 -0700 |
commit | e19031849ec2957f7312d7e2417bd8c8da0efc53 (patch) | |
tree | af29b1a7625422ef9b249537b1e5a17617ddbc7c /OpenSim/Services | |
parent | HG friends: Status notifications working. Also initial logins get the online ... (diff) | |
download | opensim-SC_OLD-e19031849ec2957f7312d7e2417bd8c8da0efc53.zip opensim-SC_OLD-e19031849ec2957f7312d7e2417bd8c8da0efc53.tar.gz opensim-SC_OLD-e19031849ec2957f7312d7e2417bd8c8da0efc53.tar.bz2 opensim-SC_OLD-e19031849ec2957f7312d7e2417bd8c8da0efc53.tar.xz |
Added necessary code to drop inventory on hg friends using the profile window, but can't test because this mechanism doesn't seem to work without a profile service.
Diffstat (limited to 'OpenSim/Services')
4 files changed, 103 insertions, 11 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 46d30df..265bacf 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -470,7 +470,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
470 | { | 470 | { |
471 | if (hash == null) | 471 | if (hash == null) |
472 | { | 472 | { |
473 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 473 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); |
474 | reason = "Internal error 1"; | 474 | reason = "Internal error 1"; |
475 | return online; | 475 | return online; |
476 | } | 476 | } |
@@ -496,6 +496,70 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
496 | return online; | 496 | return online; |
497 | } | 497 | } |
498 | 498 | ||
499 | public Dictionary<string, object> GetServerURLs(UUID userID) | ||
500 | { | ||
501 | Hashtable hash = new Hashtable(); | ||
502 | hash["userID"] = userID.ToString(); | ||
503 | |||
504 | IList paramList = new ArrayList(); | ||
505 | paramList.Add(hash); | ||
506 | |||
507 | XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); | ||
508 | string reason = string.Empty; | ||
509 | |||
510 | // Send and get reply | ||
511 | Dictionary<string, object> serverURLs = new Dictionary<string,object>(); | ||
512 | XmlRpcResponse response = null; | ||
513 | try | ||
514 | { | ||
515 | response = request.Send(m_ServerURL, 10000); | ||
516 | } | ||
517 | catch (Exception e) | ||
518 | { | ||
519 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL); | ||
520 | reason = "Exception: " + e.Message; | ||
521 | return serverURLs; | ||
522 | } | ||
523 | |||
524 | if (response.IsFault) | ||
525 | { | ||
526 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString); | ||
527 | reason = "XMLRPC Fault"; | ||
528 | return serverURLs; | ||
529 | } | ||
530 | |||
531 | hash = (Hashtable)response.Value; | ||
532 | //foreach (Object o in hash) | ||
533 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
534 | try | ||
535 | { | ||
536 | if (hash == null) | ||
537 | { | ||
538 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
539 | reason = "Internal error 1"; | ||
540 | return serverURLs; | ||
541 | } | ||
542 | |||
543 | // Here is the actual response | ||
544 | foreach (object key in hash.Keys) | ||
545 | { | ||
546 | if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null) | ||
547 | { | ||
548 | string serverType = key.ToString().Substring(4); // remove "SRV_" | ||
549 | serverURLs.Add(serverType, hash[key].ToString()); | ||
550 | } | ||
551 | } | ||
552 | |||
553 | } | ||
554 | catch (Exception e) | ||
555 | { | ||
556 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
557 | reason = "Exception: " + e.Message; | ||
558 | } | ||
559 | |||
560 | return serverURLs; | ||
561 | } | ||
562 | |||
499 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) | 563 | private bool GetBoolResponse(XmlRpcRequest request, out string reason) |
500 | { | 564 | { |
501 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); | 565 | //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 0181533..e63f941 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Services.HypergridService | |||
67 | protected static IGatekeeperService m_GatekeeperService; | 67 | protected static IGatekeeperService m_GatekeeperService; |
68 | protected static IFriendsService m_FriendsService; | 68 | protected static IFriendsService m_FriendsService; |
69 | protected static IPresenceService m_PresenceService; | 69 | protected static IPresenceService m_PresenceService; |
70 | protected static IUserAccountService m_UserAccountService; | ||
70 | protected static IFriendsSimConnector m_FriendsLocalSimConnector; // standalone, points to HGFriendsModule | 71 | protected static IFriendsSimConnector m_FriendsLocalSimConnector; // standalone, points to HGFriendsModule |
71 | protected static FriendsSimConnector m_FriendsSimConnector; // grid | 72 | protected static FriendsSimConnector m_FriendsSimConnector; // grid |
72 | 73 | ||
@@ -102,6 +103,7 @@ namespace OpenSim.Services.HypergridService | |||
102 | string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty); | 103 | string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty); |
103 | string friendsService = serverConfig.GetString("FriendsService", String.Empty); | 104 | string friendsService = serverConfig.GetString("FriendsService", String.Empty); |
104 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); | 105 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); |
106 | string userAccountService = serverConfig.GetString("UserAccountService", String.Empty); | ||
105 | 107 | ||
106 | m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false); | 108 | m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false); |
107 | 109 | ||
@@ -115,6 +117,7 @@ namespace OpenSim.Services.HypergridService | |||
115 | m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args); | 117 | m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args); |
116 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args); | 118 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args); |
117 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); | 119 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); |
120 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args); | ||
118 | 121 | ||
119 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); | 122 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); |
120 | if (m_GridName == string.Empty) | 123 | if (m_GridName == string.Empty) |
@@ -457,6 +460,20 @@ namespace OpenSim.Services.HypergridService | |||
457 | 460 | ||
458 | return online; | 461 | return online; |
459 | } | 462 | } |
463 | |||
464 | public Dictionary<string, object> GetServerURLs(UUID userID) | ||
465 | { | ||
466 | if (m_UserAccountService == null) | ||
467 | { | ||
468 | m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get server URLs because user account service is missing"); | ||
469 | return new Dictionary<string, object>(); | ||
470 | } | ||
471 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID); | ||
472 | if (account != null) | ||
473 | return account.ServiceURLs; | ||
474 | |||
475 | return new Dictionary<string, object>(); | ||
476 | } | ||
460 | } | 477 | } |
461 | 478 | ||
462 | class TravelingAgentInfo | 479 | class TravelingAgentInfo |
diff --git a/OpenSim/Services/Interfaces/IGatekeeperService.cs b/OpenSim/Services/Interfaces/IGatekeeperService.cs index fa1ab1c..f1860cc 100644 --- a/OpenSim/Services/Interfaces/IGatekeeperService.cs +++ b/OpenSim/Services/Interfaces/IGatekeeperService.cs | |||
@@ -54,6 +54,7 @@ namespace OpenSim.Services.Interfaces | |||
54 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason); | 54 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, out string reason); |
55 | void LogoutAgent(UUID userID, UUID sessionID); | 55 | void LogoutAgent(UUID userID, UUID sessionID); |
56 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); | 56 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); |
57 | Dictionary<string, object> GetServerURLs(UUID userID); | ||
57 | 58 | ||
58 | void StatusNotification(List<string> friends, UUID userID, bool online); | 59 | void StatusNotification(List<string> friends, UUID userID, bool online); |
59 | List<UUID> GetOnlineFriends(UUID userID, List<string> friends); | 60 | List<UUID> GetOnlineFriends(UUID userID, List<string> friends); |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 2ca2d15..a5a728b 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -804,16 +804,13 @@ namespace OpenSim.Services.LLLoginService | |||
804 | // Old style: get the service keys from the DB | 804 | // Old style: get the service keys from the DB |
805 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) | 805 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) |
806 | { | 806 | { |
807 | if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty)) | 807 | if (kvp.Value != null) |
808 | { | ||
809 | aCircuit.ServiceURLs[kvp.Key] = m_LoginServerConfig.GetString(kvp.Key, string.Empty); | ||
810 | } | ||
811 | else | ||
812 | { | 808 | { |
813 | aCircuit.ServiceURLs[kvp.Key] = kvp.Value; | 809 | aCircuit.ServiceURLs[kvp.Key] = kvp.Value; |
810 | |||
811 | if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/")) | ||
812 | aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/"; | ||
814 | } | 813 | } |
815 | if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/")) | ||
816 | aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/"; | ||
817 | } | 814 | } |
818 | 815 | ||
819 | // New style: service keys start with SRV_; override the previous | 816 | // New style: service keys start with SRV_; override the previous |
@@ -821,16 +818,29 @@ namespace OpenSim.Services.LLLoginService | |||
821 | 818 | ||
822 | if (keys.Length > 0) | 819 | if (keys.Length > 0) |
823 | { | 820 | { |
821 | bool newUrls = false; | ||
824 | IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_")); | 822 | IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_")); |
825 | foreach (string serviceKey in serviceKeys) | 823 | foreach (string serviceKey in serviceKeys) |
826 | { | 824 | { |
827 | string keyName = serviceKey.Replace("SRV_", ""); | 825 | string keyName = serviceKey.Replace("SRV_", ""); |
828 | aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty); | 826 | string keyValue = m_LoginServerConfig.GetString(serviceKey, string.Empty); |
829 | if (!aCircuit.ServiceURLs[keyName].ToString().EndsWith("/")) | 827 | if (!keyValue.EndsWith("/")) |
830 | aCircuit.ServiceURLs[keyName] = aCircuit.ServiceURLs[keyName] + "/"; | 828 | keyValue = keyValue + "/"; |
829 | |||
830 | if (!account.ServiceURLs.ContainsKey(keyName) || (account.ServiceURLs.ContainsKey(keyName) && account.ServiceURLs[keyName] != keyValue)) | ||
831 | { | ||
832 | account.ServiceURLs[keyName] = keyValue; | ||
833 | newUrls = true; | ||
834 | } | ||
835 | aCircuit.ServiceURLs[keyName] = keyValue; | ||
831 | 836 | ||
832 | m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); | 837 | m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); |
833 | } | 838 | } |
839 | |||
840 | // The grid operator decided to override the defaults in the | ||
841 | // [LoginService] configuration. Let's store the correct ones. | ||
842 | if (newUrls) | ||
843 | m_UserAccountService.StoreUserAccount(account); | ||
834 | } | 844 | } |
835 | 845 | ||
836 | } | 846 | } |