diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index baafd7d..1d711a8 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | |||
@@ -44,10 +44,12 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private IGatekeeperService m_GatekeeperService; | 46 | private IGatekeeperService m_GatekeeperService; |
47 | private IHypergridService m_HypergridService; | ||
47 | 48 | ||
48 | public HypergridHandlers(IGatekeeperService gatekeeper) | 49 | public HypergridHandlers(IGatekeeperService gatekeeper, IHypergridService hyper) |
49 | { | 50 | { |
50 | m_GatekeeperService = gatekeeper; | 51 | m_GatekeeperService = gatekeeper; |
52 | m_HypergridService = hyper; | ||
51 | } | 53 | } |
52 | 54 | ||
53 | /// <summary> | 55 | /// <summary> |
@@ -80,6 +82,36 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
80 | return response; | 82 | return response; |
81 | } | 83 | } |
82 | 84 | ||
85 | /// <summary> | ||
86 | /// A local region wants to establish a grid-wide hyperlink to another region | ||
87 | /// </summary> | ||
88 | /// <param name="request"></param> | ||
89 | /// <returns></returns> | ||
90 | public XmlRpcResponse LinkRegionByDescRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
91 | { | ||
92 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
93 | //string host = (string)requestData["host"]; | ||
94 | //string portstr = (string)requestData["port"]; | ||
95 | string descriptor = (string)requestData["region_desc"]; | ||
96 | |||
97 | UUID regionID = UUID.Zero; | ||
98 | string imageURL = string.Empty; | ||
99 | ulong regionHandle = 0; | ||
100 | string reason = string.Empty; | ||
101 | |||
102 | bool success = m_HypergridService.LinkRegion(descriptor, out regionID, out regionHandle, out imageURL, out reason); | ||
103 | |||
104 | Hashtable hash = new Hashtable(); | ||
105 | hash["result"] = success.ToString(); | ||
106 | hash["uuid"] = regionID.ToString(); | ||
107 | hash["handle"] = regionHandle.ToString(); | ||
108 | hash["region_image"] = imageURL; | ||
109 | |||
110 | XmlRpcResponse response = new XmlRpcResponse(); | ||
111 | response.Value = hash; | ||
112 | return response; | ||
113 | } | ||
114 | |||
83 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | 115 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) |
84 | { | 116 | { |
85 | Hashtable requestData = (Hashtable)request.Params[0]; | 117 | Hashtable requestData = (Hashtable)request.Params[0]; |
@@ -111,5 +143,38 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
111 | 143 | ||
112 | } | 144 | } |
113 | 145 | ||
146 | public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) | ||
147 | { | ||
148 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
149 | //string host = (string)requestData["host"]; | ||
150 | //string portstr = (string)requestData["port"]; | ||
151 | string userID_str = (string)requestData["userID"]; | ||
152 | UUID userID = UUID.Zero; | ||
153 | UUID.TryParse(userID_str, out userID); | ||
154 | |||
155 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; | ||
156 | GridRegion regInfo = m_GatekeeperService.GetHomeRegion(userID, out position, out lookAt); | ||
157 | |||
158 | Hashtable hash = new Hashtable(); | ||
159 | if (regInfo == null) | ||
160 | hash["result"] = "false"; | ||
161 | else | ||
162 | { | ||
163 | hash["result"] = "true"; | ||
164 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
165 | hash["x"] = regInfo.RegionLocX.ToString(); | ||
166 | hash["y"] = regInfo.RegionLocY.ToString(); | ||
167 | hash["region_name"] = regInfo.RegionName; | ||
168 | hash["hostname"] = regInfo.ExternalHostName; | ||
169 | hash["http_port"] = regInfo.HttpPort.ToString(); | ||
170 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
171 | hash["position"] = position.ToString(); | ||
172 | hash["lookAt"] = lookAt.ToString(); | ||
173 | } | ||
174 | XmlRpcResponse response = new XmlRpcResponse(); | ||
175 | response.Value = hash; | ||
176 | return response; | ||
177 | |||
178 | } | ||
114 | } | 179 | } |
115 | } | 180 | } |