aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-25 13:37:43 +0000
committerJustin Clarke Casey2008-04-25 13:37:43 +0000
commit46c8d7a5e10433dfb47ccec9da3fb86ddb0bb08d (patch)
tree0252cdf27f3199a1c86ab24b388ecb362f149962 /OpenSim/Region/Communications
parent* Fixes the object pay box to default to -2,-2,-2,-2,-2. Fixes mantis 1045. (diff)
downloadopensim-SC_OLD-46c8d7a5e10433dfb47ccec9da3fb86ddb0bb08d.zip
opensim-SC_OLD-46c8d7a5e10433dfb47ccec9da3fb86ddb0bb08d.tar.gz
opensim-SC_OLD-46c8d7a5e10433dfb47ccec9da3fb86ddb0bb08d.tar.bz2
opensim-SC_OLD-46c8d7a5e10433dfb47ccec9da3fb86ddb0bb08d.tar.xz
From: Dr Scofield <hud@zurich.ibm.com>
the patch below adds support for start_location = uri:region&x&y&z to OpenSim which allows us to provide -url secondlife:///region/X/Y/Z to the SecondLife client during start up --- which will take you directly to region "region" at position X, Y, Z. also, i did increase the default Z value from 70 to 128 as we otherwise have the problem that on some regions we'd end up inside a mountain instead of on top of it.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs5
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs72
2 files changed, 64 insertions, 13 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 2960a62..c48292a 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -180,7 +180,10 @@ namespace OpenSim.Region.Communications.Local
180 180
181 public RegionInfo RequestClosestRegion(string regionName) 181 public RegionInfo RequestClosestRegion(string regionName)
182 { 182 {
183 // Don't use this method. It's only for SLURLS and Logins 183 foreach(RegionInfo regInfo in m_regions.Values)
184 {
185 if (regInfo.RegionName == regionName) return regInfo;
186 }
184 return null; 187 return null;
185 } 188 }
186 189
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index c4823f4..1e30a7a 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Text.RegularExpressions;
32using libsecondlife; 33using libsecondlife;
33using log4net; 34using log4net;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -119,9 +120,18 @@ namespace OpenSim.Region.Communications.Local
119 } 120 }
120 } 121 }
121 122
123 private Regex reURI = new Regex(@"^uri:(?<region>[^&]+)&(?<x>\d+)&(?<y>\d+)&(?<z>\d+)$");
124
122 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest) 125 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
123 { 126 {
124 ulong currentRegion = 0; 127 ulong currentRegion = 0;
128
129 uint locX = 0;
130 uint locY = 0;
131 uint locZ = 0;
132 bool specificStartLocation = false;
133
134 // get start location
125 if (startLocationRequest == "last") 135 if (startLocationRequest == "last")
126 { 136 {
127 currentRegion = theUser.CurrentAgent.Handle; 137 currentRegion = theUser.CurrentAgent.Handle;
@@ -132,27 +142,62 @@ namespace OpenSim.Region.Communications.Local
132 } 142 }
133 else 143 else
134 { 144 {
135 m_log.Info("[LOGIN]: Got Custom Login URL, but can't process it"); 145 // use last location as default
136 // LocalBackEndServices can't possibly look up a region by name :(
137 // TODO: Parse string in the following format: 'uri:RegionName&X&Y&Z'
138 currentRegion = theUser.CurrentAgent.Handle; 146 currentRegion = theUser.CurrentAgent.Handle;
147
148 Match uriMatch = reURI.Match(startLocationRequest);
149 if (null == uriMatch)
150 {
151 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, but can't process it", startLocationRequest);
152 }
153 else
154 {
155 string region = uriMatch.Groups["region"].ToString();
156
157 RegionInfo r = m_Parent.GridService.RequestClosestRegion(region);
158 if (null == r)
159 {
160 m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}",
161 startLocationRequest, region);
162 }
163 else
164 {
165 currentRegion = r.RegionHandle;
166 locX = UInt32.Parse(uriMatch.Groups["x"].ToString());
167 locY = UInt32.Parse(uriMatch.Groups["y"].ToString());
168 locZ = UInt32.Parse(uriMatch.Groups["z"].ToString());
169 specificStartLocation = true;
170 }
171 }
139 } 172 }
140 173
174 RegionInfo homeReg = m_Parent.GridService.RequestNeighbourInfo(theUser.HomeRegion);
141 RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion); 175 RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
142 176
143 if (reg != null) 177 if ((homeReg != null) && (reg != null))
144 { 178 {
145 response.Home = "{'region_handle':[r" + (reg.RegionLocX * Constants.RegionSize).ToString() + ",r" + 179 response.Home = "{'region_handle':[r" +
146 (reg.RegionLocY * Constants.RegionSize).ToString() + "], " + 180 (homeReg.RegionLocX * Constants.RegionSize).ToString() + ",r" +
147 "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + 181 (homeReg.RegionLocY * Constants.RegionSize).ToString() + "], " +
148 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + 182 "'position':[r" +
149 "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + 183 theUser.HomeLocation.X.ToString() + ",r" +
150 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; 184 theUser.HomeLocation.Y.ToString() + ",r" +
185 theUser.HomeLocation.Z.ToString() + "], " +
186 "'look_at':[r" +
187 theUser.HomeLocation.X.ToString() + ",r" +
188 theUser.HomeLocation.Y.ToString() + ",r" +
189 theUser.HomeLocation.Z.ToString() + "]}";
151 string capsPath = Util.GetRandomCapsPath(); 190 string capsPath = Util.GetRandomCapsPath();
152 response.SimAddress = reg.ExternalEndPoint.Address.ToString(); 191 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
153 response.SimPort = (uint) reg.ExternalEndPoint.Port; 192 response.SimPort = (uint) reg.ExternalEndPoint.Port;
154 response.RegionX = reg.RegionLocX; 193 response.RegionX = reg.RegionLocX;
155 response.RegionY = reg.RegionLocY ; 194 response.RegionY = reg.RegionLocY;
195
196 m_log.DebugFormat(
197 "[CAPS][LOGIN]: RegionX {0} RegionY {0}", response.RegionX, response.RegionY);
198
199 // can be: last, home, safe, url
200 if (specificStartLocation) response.StartLocation = "url";
156 201
157 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + 202 response.SeedCapability = "http://" + reg.ExternalHostName + ":" +
158 serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; 203 serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
@@ -176,7 +221,10 @@ namespace OpenSim.Region.Communications.Local
176 _login.Session = response.SessionID; 221 _login.Session = response.SessionID;
177 _login.SecureSession = response.SecureSessionID; 222 _login.SecureSession = response.SecureSessionID;
178 _login.CircuitCode = (uint) response.CircuitCode; 223 _login.CircuitCode = (uint) response.CircuitCode;
179 _login.StartPos = new LLVector3(128, 128, 70); 224 if (specificStartLocation)
225 _login.StartPos = new LLVector3(locX, locY, locZ);
226 else
227 _login.StartPos = new LLVector3(128, 128, 128);
180 _login.CapsPath = capsPath; 228 _login.CapsPath = capsPath;
181 229
182 m_log.InfoFormat( 230 m_log.InfoFormat(