diff --git a/gridserver/src/GridHttp.cs b/gridserver/src/GridHttp.cs index bbaf2c83c3..41cbdb98e7 100644 --- a/gridserver/src/GridHttp.cs +++ b/gridserver/src/GridHttp.cs @@ -70,8 +70,31 @@ namespace OpenGridServices Hashtable requestData = (Hashtable)request.Params[0]; switch(request.MethodName) { - case "get_simulator_info": - + case "get_sim_info": + Console.WriteLine("get_sim_info"); + uint req_handle=(uint)requestData["region_handle"]; + SimProfile TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle); + string RecvKey=""; + string caller=(string)requestData["caller"]; + switch(caller) { + case "userserver": + RecvKey=OpenGrid_Main.thegrid.UserRecvKey; + break; + case "assetserver": + RecvKey=OpenGrid_Main.thegrid.AssetRecvKey; + break; + } + if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) { + XmlRpcResponse SimInfoResp = new XmlRpcResponse(); + SimInfoResp.Value=TheSim; + return(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp)); + } else { + XmlRpcResponse SimErrorResp = new XmlRpcResponse(); + Hashtable SimErrorData = new Hashtable(); + SimErrorData["error"]="sim not found"; + SimErrorResp.Value=SimErrorData; + return(XmlRpcResponseSerializer.Singleton.Serialize(SimErrorResp)); + } break; } diff --git a/gridserver/src/Main.cs b/gridserver/src/Main.cs index 2553b00ee9..eb7c1fd937 100644 --- a/gridserver/src/Main.cs +++ b/gridserver/src/Main.cs @@ -50,6 +50,7 @@ namespace OpenGridServices public string UserRecvKey; public GridHTTPServer _httpd; + public SimProfileManager _regionmanager; [STAThread] public static void Main( string[] args ) diff --git a/userserver/src/UserHttp.cs b/userserver/src/UserHttp.cs index ee80b76081..e520a41e49 100644 --- a/userserver/src/UserHttp.cs +++ b/userserver/src/UserHttp.cs @@ -111,7 +111,7 @@ namespace OpenGridServices LLUUID AgentID = TheUser.UUID; TheUser.InitSessionData(); SimProfile SimInfo = new SimProfile(); - + SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle,OpenUser_Main.userserver.GridURL,OpenUser_Main.userserver.GridSendKey,OpenUser_Main.userserver.GridRecvKey); XmlRpcResponse LoginGoodResp = new XmlRpcResponse(); Hashtable LoginGoodData = new Hashtable(); diff --git a/userserver/src/UserProfiles.cs b/userserver/src/UserProfiles.cs index 00866ff19e..78d106452b 100644 --- a/userserver/src/UserProfiles.cs +++ b/userserver/src/UserProfiles.cs @@ -32,6 +32,7 @@ using System.Text; using System.Collections; using System.Collections.Generic; using libsecondlife; +using Nwc.XmlRpc; using ServerConsole; namespace OpenGridServices @@ -111,6 +112,7 @@ namespace OpenGridServices Circuits = new Dictionary(); InventoryFolders = new Dictionary(); InventoryItems = new Dictionary(); + homeregionhandle=0; } public void InitSessionData() { @@ -156,7 +158,19 @@ namespace OpenGridServices public string recvkey; - public SimProfile() { + public SimProfile LoadFromGrid(uint region_handle, string GridURL, string SendKey, string RecvKey) { + Hashtable GridReqParams = new Hashtable(); + GridReqParams["region_handle"]=region_handle; + GridReqParams["caller"]="userserver"; + GridReqParams["authkey"]=SendKey; + ArrayList SendParams = new ArrayList(); + SendParams.Add(GridReqParams); + XmlRpcResponse GridResp = new XmlRpcRequest("get_sim_info",SendParams).Send(GridURL,3000); + + return (SimProfile)GridResp.Value; + } + + public SimProfile() { }