aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2010-07-31 16:44:02 -0700
committerDiva Canto2010-07-31 16:44:02 -0700
commit63dd24a651ca872f51826896fc4c6bb73289a7c2 (patch)
treee41ede071737cb45e4ce8260cd7addf03b717974
parentImplemented console command "show hyperlinks". (diff)
downloadopensim-SC_OLD-63dd24a651ca872f51826896fc4c6bb73289a7c2.zip
opensim-SC_OLD-63dd24a651ca872f51826896fc4c6bb73289a7c2.tar.gz
opensim-SC_OLD-63dd24a651ca872f51826896fc4c6bb73289a7c2.tar.bz2
opensim-SC_OLD-63dd24a651ca872f51826896fc4c6bb73289a7c2.tar.xz
Show hyperlinks
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs54
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs50
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs58
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs42
4 files changed, 102 insertions, 102 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index 73c67d4..9656be1 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -306,37 +306,37 @@ namespace OpenSim.Data.MSSQL
306 return true; 306 return true;
307 } 307 }
308 return false; 308 return false;
309 } 309 }
310 310
311 public List<RegionData> GetDefaultRegions(UUID scopeID) 311 public List<RegionData> GetDefaultRegions(UUID scopeID)
312 { 312 {
313 return Get((int)RegionFlags.DefaultRegion, scopeID); 313 return Get((int)RegionFlags.DefaultRegion, scopeID);
314 } 314 }
315 315
316 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 316 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
317 { 317 {
318 // TODO: distance-sort results 318 // TODO: distance-sort results
319 return Get((int)RegionFlags.FallbackRegion, scopeID); 319 return Get((int)RegionFlags.FallbackRegion, scopeID);
320 } 320 }
321 321
322 public List<RegionData> GetHyperlinks(UUID scopeID) 322 public List<RegionData> GetHyperlinks(UUID scopeID)
323 { 323 {
324 return Get((int)RegionFlags.Hyperlink, scopeID); 324 return Get((int)RegionFlags.Hyperlink, scopeID);
325 } 325 }
326 326
327 private List<RegionData> Get(int regionFlags, UUID scopeID) 327 private List<RegionData> Get(int regionFlags, UUID scopeID)
328 { 328 {
329 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0"; 329 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
330 if (scopeID != UUID.Zero) 330 if (scopeID != UUID.Zero)
331 sql += " AND ScopeID = @scopeID"; 331 sql += " AND ScopeID = @scopeID";
332 332
333 using (SqlConnection conn = new SqlConnection(m_ConnectionString)) 333 using (SqlConnection conn = new SqlConnection(m_ConnectionString))
334 using (SqlCommand cmd = new SqlCommand(sql, conn)) 334 using (SqlCommand cmd = new SqlCommand(sql, conn))
335 { 335 {
336 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); 336 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
337 conn.Open(); 337 conn.Open();
338 return RunCommand(cmd); 338 return RunCommand(cmd);
339 } 339 }
340 } 340 }
341 } 341 }
342} 342}
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 6dc62c6..aec37e2 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -280,35 +280,35 @@ namespace OpenSim.Data.MySQL
280 } 280 }
281 281
282 return false; 282 return false;
283 } 283 }
284 284
285 public List<RegionData> GetDefaultRegions(UUID scopeID) 285 public List<RegionData> GetDefaultRegions(UUID scopeID)
286 { 286 {
287 return Get((int)RegionFlags.DefaultRegion, scopeID); 287 return Get((int)RegionFlags.DefaultRegion, scopeID);
288 } 288 }
289 289
290 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 290 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
291 { 291 {
292 // TODO: distance-sort results 292 // TODO: distance-sort results
293 return Get((int)RegionFlags.FallbackRegion, scopeID); 293 return Get((int)RegionFlags.FallbackRegion, scopeID);
294 } 294 }
295 295
296 public List<RegionData> GetHyperlinks(UUID scopeID) 296 public List<RegionData> GetHyperlinks(UUID scopeID)
297 { 297 {
298 return Get((int)RegionFlags.Hyperlink, scopeID); 298 return Get((int)RegionFlags.Hyperlink, scopeID);
299 } 299 }
300 300
301 private List<RegionData> Get(int regionFlags, UUID scopeID) 301 private List<RegionData> Get(int regionFlags, UUID scopeID)
302 { 302 {
303 string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0"; 303 string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
304 if (scopeID != UUID.Zero) 304 if (scopeID != UUID.Zero)
305 command += " and ScopeID = ?scopeID"; 305 command += " and ScopeID = ?scopeID";
306 306
307 MySqlCommand cmd = new MySqlCommand(command); 307 MySqlCommand cmd = new MySqlCommand(command);
308 308
309 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 309 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
310 310
311 return RunCommand(cmd); 311 return RunCommand(cmd);
312 } 312 }
313 } 313 }
314} 314}
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index 397b32d..f276d10 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Data.Null
49 if (Instance == null) 49 if (Instance == null)
50 Instance = this; 50 Instance = this;
51 //Console.WriteLine("[XXX] NullRegionData constructor"); 51 //Console.WriteLine("[XXX] NullRegionData constructor");
52 } 52 }
53 53
54 public List<RegionData> Get(string regionName, UUID scopeID) 54 public List<RegionData> Get(string regionName, UUID scopeID)
55 { 55 {
56 if (Instance != this) 56 if (Instance != this)
@@ -160,37 +160,37 @@ namespace OpenSim.Data.Null
160 m_regionData.Remove(regionID); 160 m_regionData.Remove(regionID);
161 161
162 return true; 162 return true;
163 } 163 }
164 164
165 public List<RegionData> GetDefaultRegions(UUID scopeID) 165 public List<RegionData> GetDefaultRegions(UUID scopeID)
166 { 166 {
167 return Get((int)RegionFlags.DefaultRegion, scopeID); 167 return Get((int)RegionFlags.DefaultRegion, scopeID);
168 } 168 }
169 169
170 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 170 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
171 { 171 {
172 return Get((int)RegionFlags.FallbackRegion, scopeID); 172 return Get((int)RegionFlags.FallbackRegion, scopeID);
173 } 173 }
174 174
175 public List<RegionData> GetHyperlinks(UUID scopeID) 175 public List<RegionData> GetHyperlinks(UUID scopeID)
176 { 176 {
177 return Get((int)RegionFlags.Hyperlink, scopeID); 177 return Get((int)RegionFlags.Hyperlink, scopeID);
178 } 178 }
179 179
180 private List<RegionData> Get(int regionFlags, UUID scopeID) 180 private List<RegionData> Get(int regionFlags, UUID scopeID)
181 { 181 {
182 if (Instance != this) 182 if (Instance != this)
183 return Instance.Get(regionFlags, scopeID); 183 return Instance.Get(regionFlags, scopeID);
184 184
185 List<RegionData> ret = new List<RegionData>(); 185 List<RegionData> ret = new List<RegionData>();
186 186
187 foreach (RegionData r in m_regionData.Values) 187 foreach (RegionData r in m_regionData.Values)
188 { 188 {
189 if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0) 189 if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
190 ret.Add(r); 190 ret.Add(r);
191 } 191 }
192 192
193 return ret; 193 return ret;
194 } 194 }
195 } 195 }
196} \ No newline at end of file 196} \ No newline at end of file
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 23f0004..1f53007 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -378,28 +378,28 @@ namespace OpenSim.Services.GridService
378 378
379 public void HandleShow(string module, string[] cmd) 379 public void HandleShow(string module, string[] cmd)
380 { 380 {
381 if (cmd.Length != 2) 381 if (cmd.Length != 2)
382 { 382 {
383 MainConsole.Instance.Output("Syntax: show hyperlinks"); 383 MainConsole.Instance.Output("Syntax: show hyperlinks");
384 return; 384 return;
385 }
386 List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
387 if (regions == null || regions.Count < 1)
388 {
389 MainConsole.Instance.Output("No hyperlinks");
390 return;
391 }
392
393 MainConsole.Instance.Output("Region Name Region UUID");
394 MainConsole.Instance.Output("Location URI");
395 MainConsole.Instance.Output("-------------------------------------------------------------------------------");
396 foreach (RegionData r in regions)
397 {
398 MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
399 r.RegionName, r.RegionID,
400 String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
401 "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
385 } 402 }
386 List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
387 if (regions == null || regions.Count < 1)
388 {
389 MainConsole.Instance.Output("No hyperlinks");
390 return;
391 }
392
393 MainConsole.Instance.Output("Region Name Region UUID");
394 MainConsole.Instance.Output("Location URI");
395 MainConsole.Instance.Output("-------------------------------------------------------------------------------");
396 foreach (RegionData r in regions)
397 {
398 MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
399 r.RegionName, r.RegionID,
400 String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
401 "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
402 }
403 return; 403 return;
404 } 404 }
405 405