From 4cffdf15ba320b71650ade9edddec2286b1c5258 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 19 Oct 2011 00:34:54 +0100 Subject: [PATCH] Make ScopeID optional for http GetAccount and GetAccounts If not specified then it assumes UUID.Zero. as occurs elsewhere in the codebase --- .../UserAccountServerPostHandler.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 32da44f2ed..f987383553 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -117,7 +117,6 @@ namespace OpenSim.Server.Handlers.UserAccounts } return FailureResult(); - } byte[] GetAccount(Dictionary request) @@ -126,13 +125,7 @@ namespace OpenSim.Server.Handlers.UserAccounts UUID scopeID = UUID.Zero; Dictionary result = new Dictionary(); - if (!request.ContainsKey("ScopeID")) - { - result["result"] = "null"; - return ResultToBytes(result); - } - - if (!UUID.TryParse(request["ScopeID"].ToString(), out scopeID)) + if (request.ContainsKey("ScopeID") && !UUID.TryParse(request["ScopeID"].ToString(), out scopeID)) { result["result"] = "null"; return ResultToBytes(result); @@ -174,11 +167,11 @@ namespace OpenSim.Server.Handlers.UserAccounts byte[] GetAccounts(Dictionary request) { - if (!request.ContainsKey("ScopeID") || !request.ContainsKey("query")) + if (!request.ContainsKey("query")) return FailureResult(); UUID scopeID = UUID.Zero; - if (!UUID.TryParse(request["ScopeID"].ToString(), out scopeID)) + if (request.ContainsKey("ScopeID") && !UUID.TryParse(request["ScopeID"].ToString(), out scopeID)) return FailureResult(); string query = request["query"].ToString(); @@ -187,7 +180,9 @@ namespace OpenSim.Server.Handlers.UserAccounts Dictionary result = new Dictionary(); if ((accounts == null) || ((accounts != null) && (accounts.Count == 0))) + { result["result"] = "null"; + } else { int i = 0; @@ -208,7 +203,7 @@ namespace OpenSim.Server.Handlers.UserAccounts byte[] StoreAccount(Dictionary request) { UUID principalID = UUID.Zero; - if (!(request.ContainsKey("PrincipalID") && UUID.TryParse(request["PrincipalID"].ToString(), out principalID))) + if (request.ContainsKey("PrincipalID") && !UUID.TryParse(request["PrincipalID"].ToString(), out principalID)) return FailureResult(); UUID scopeID = UUID.Zero;