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 | |
parent | HG friends: Status notifications working. Also initial logins get the online ... (diff) | |
download | opensim-SC-e19031849ec2957f7312d7e2417bd8c8da0efc53.zip opensim-SC-e19031849ec2957f7312d7e2417bd8c8da0efc53.tar.gz opensim-SC-e19031849ec2957f7312d7e2417bd8c8da0efc53.tar.bz2 opensim-SC-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')
9 files changed, 195 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 52791cb..429dda7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
110 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) | 110 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) |
111 | { | 111 | { |
112 | string userAssetServer = string.Empty; | 112 | string userAssetServer = string.Empty; |
113 | if (IsForeignUser(avatarID, out userAssetServer) && m_OutboundPermission) | 113 | if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) |
114 | { | 114 | { |
115 | Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); | 115 | Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); |
116 | } | 116 | } |
@@ -180,10 +180,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
180 | public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | 180 | public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) |
181 | { | 181 | { |
182 | string userAssetServer = string.Empty; | 182 | string userAssetServer = string.Empty; |
183 | if (IsForeignUser(sender, out userAssetServer)) | 183 | if (IsForeignUser(sender, out userAssetServer) && userAssetServer != string.Empty) |
184 | m_assMapper.Get(item.AssetID, sender, userAssetServer); | 184 | m_assMapper.Get(item.AssetID, sender, userAssetServer); |
185 | 185 | ||
186 | if (IsForeignUser(receiver, out userAssetServer) && m_OutboundPermission) | 186 | if (IsForeignUser(receiver, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) |
187 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); | 187 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); |
188 | } | 188 | } |
189 | 189 | ||
@@ -203,9 +203,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
203 | if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 203 | if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) |
204 | { | 204 | { |
205 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 205 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); |
206 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); return true; | 206 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | else | ||
210 | { | ||
211 | assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); | ||
212 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | ||
213 | } | ||
214 | return true; | ||
209 | } | 215 | } |
210 | 216 | ||
211 | return false; | 217 | return false; |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 795de09..4d073b2 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Region.Framework; | |||
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Services.Connectors.Hypergrid; | ||
38 | 39 | ||
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | using log4net; | 41 | using log4net; |
@@ -47,7 +48,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
47 | public UUID Id; | 48 | public UUID Id; |
48 | public string FirstName; | 49 | public string FirstName; |
49 | public string LastName; | 50 | public string LastName; |
50 | public string ProfileURL; | 51 | public string HomeURL; |
52 | public Dictionary<string, object> ServerURLs; | ||
51 | } | 53 | } |
52 | 54 | ||
53 | public class UserManagementModule : ISharedRegionModule, IUserManagement | 55 | public class UserManagementModule : ISharedRegionModule, IUserManagement |
@@ -224,6 +226,34 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
224 | return "(hippos)"; | 226 | return "(hippos)"; |
225 | } | 227 | } |
226 | 228 | ||
229 | public string GetUserHomeURL(UUID userID) | ||
230 | { | ||
231 | if (m_UserCache.ContainsKey(userID)) | ||
232 | return m_UserCache[userID].HomeURL; | ||
233 | |||
234 | return string.Empty; | ||
235 | } | ||
236 | |||
237 | public string GetUserServerURL(UUID userID, string serverType) | ||
238 | { | ||
239 | if (m_UserCache.ContainsKey(userID)) | ||
240 | { | ||
241 | UserData userdata = m_UserCache[userID]; | ||
242 | if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) | ||
243 | return userdata.ServerURLs[serverType].ToString(); | ||
244 | |||
245 | if (userdata.HomeURL != string.Empty) | ||
246 | { | ||
247 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); | ||
248 | userdata.ServerURLs = uConn.GetServerURLs(userID); | ||
249 | if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) | ||
250 | return userdata.ServerURLs[serverType].ToString(); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | return string.Empty; | ||
255 | } | ||
256 | |||
227 | public void AddUser(UUID id, string creatorData) | 257 | public void AddUser(UUID id, string creatorData) |
228 | { | 258 | { |
229 | if (m_UserCache.ContainsKey(id)) | 259 | if (m_UserCache.ContainsKey(id)) |
@@ -249,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
249 | string[] parts = creatorData.Split(';'); | 279 | string[] parts = creatorData.Split(';'); |
250 | if (parts.Length >= 1) | 280 | if (parts.Length >= 1) |
251 | { | 281 | { |
252 | user.ProfileURL = parts[0]; | 282 | user.HomeURL = parts[0]; |
253 | try | 283 | try |
254 | { | 284 | { |
255 | Uri uri = new Uri(parts[0]); | 285 | Uri uri = new Uri(parts[0]); |
@@ -274,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
274 | lock (m_UserCache) | 304 | lock (m_UserCache) |
275 | m_UserCache[id] = user; | 305 | m_UserCache[id] = user; |
276 | 306 | ||
277 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); | 307 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.HomeURL); |
278 | } | 308 | } |
279 | 309 | ||
280 | public void AddUser(UUID uuid, string first, string last, string profileURL) | 310 | public void AddUser(UUID uuid, string first, string last, string profileURL) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 3f63db3..eef60a1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -58,6 +58,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
58 | 58 | ||
59 | private List<Scene> m_Scenes = new List<Scene>(); | 59 | private List<Scene> m_Scenes = new List<Scene>(); |
60 | 60 | ||
61 | protected IUserManagement m_UserManagement; | ||
62 | protected IUserManagement UserManagementModule | ||
63 | { | ||
64 | get | ||
65 | { | ||
66 | if (m_UserManagement == null) | ||
67 | m_UserManagement = m_Scenes[0].RequestModuleInterface<IUserManagement>(); | ||
68 | return m_UserManagement; | ||
69 | } | ||
70 | } | ||
71 | |||
61 | public Type ReplaceableInterface | 72 | public Type ReplaceableInterface |
62 | { | 73 | { |
63 | get { return null; } | 74 | get { return null; } |
@@ -206,6 +217,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
206 | return; | 217 | return; |
207 | } | 218 | } |
208 | } | 219 | } |
220 | else | ||
221 | { | ||
222 | inventoryURL = UserManagementModule.GetUserServerURL(userID, "InventoryServerURI"); | ||
223 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
224 | } | ||
209 | } | 225 | } |
210 | } | 226 | } |
211 | } | 227 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 2904ee8..9cac3b0 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs | |||
@@ -8,6 +8,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
8 | public interface IUserManagement | 8 | public interface IUserManagement |
9 | { | 9 | { |
10 | string GetUserName(UUID uuid); | 10 | string GetUserName(UUID uuid); |
11 | string GetUserHomeURL(UUID uuid); | ||
12 | string GetUserServerURL(UUID uuid, string serverType); | ||
11 | void AddUser(UUID uuid, string userData); | 13 | void AddUser(UUID uuid, string userData); |
12 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); | 14 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); |
13 | } | 15 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 7a9fb4b..e51fe0b 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs | |||
@@ -83,6 +83,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
83 | 83 | ||
84 | server.AddXmlRPCHandler("status_notification", StatusNotification, false); | 84 | server.AddXmlRPCHandler("status_notification", StatusNotification, false); |
85 | server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); | 85 | server.AddXmlRPCHandler("get_online_friends", GetOnlineFriends, false); |
86 | server.AddXmlRPCHandler("get_server_urls", GetServerURLs, false); | ||
86 | 87 | ||
87 | server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); | 88 | server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP, proxy).Handler); |
88 | } | 89 | } |
@@ -256,7 +257,6 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
256 | ids.Add(requestData[key].ToString()); | 257 | ids.Add(requestData[key].ToString()); |
257 | } | 258 | } |
258 | 259 | ||
259 | // let's spawn a thread for this, because it may take a long time... | ||
260 | List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids); | 260 | List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids); |
261 | if (online.Count > 0) | 261 | if (online.Count > 0) |
262 | { | 262 | { |
@@ -266,8 +266,38 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
266 | hash["friend_" + i.ToString()] = id.ToString(); | 266 | hash["friend_" + i.ToString()] = id.ToString(); |
267 | i++; | 267 | i++; |
268 | } | 268 | } |
269 | } | ||
270 | else | ||
271 | hash["result"] = "No Friends Online"; | ||
272 | } | ||
273 | |||
274 | XmlRpcResponse response = new XmlRpcResponse(); | ||
275 | response.Value = hash; | ||
276 | return response; | ||
277 | |||
278 | } | ||
279 | |||
280 | public XmlRpcResponse GetServerURLs(XmlRpcRequest request, IPEndPoint remoteClient) | ||
281 | { | ||
282 | Hashtable hash = new Hashtable(); | ||
269 | 283 | ||
284 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
285 | //string host = (string)requestData["host"]; | ||
286 | //string portstr = (string)requestData["port"]; | ||
287 | if (requestData.ContainsKey("userID")) | ||
288 | { | ||
289 | string userID_str = (string)requestData["userID"]; | ||
290 | UUID userID = UUID.Zero; | ||
291 | UUID.TryParse(userID_str, out userID); | ||
292 | |||
293 | Dictionary<string, object> serverURLs = m_HomeUsersService.GetServerURLs(userID); | ||
294 | if (serverURLs.Count > 0) | ||
295 | { | ||
296 | foreach (KeyValuePair<string, object> kvp in serverURLs) | ||
297 | hash["SRV_" + kvp.Key] = kvp.Value.ToString(); | ||
270 | } | 298 | } |
299 | else | ||
300 | hash["result"] = "No Service URLs"; | ||
271 | } | 301 | } |
272 | 302 | ||
273 | XmlRpcResponse response = new XmlRpcResponse(); | 303 | XmlRpcResponse response = new XmlRpcResponse(); |
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 | } |