From baa8ddfd2640e5138e8f1287df17e07007d2a3ed Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 9 Dec 2010 08:28:21 -0800
Subject: Minor bug fixes. Hunting down mantis #5259

---
 OpenSim/Services/GridService/HypergridLinker.cs       | 4 +++-
 OpenSim/Services/HypergridService/UserAgentService.cs | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Services')

diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index d5d0195..2184498 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -215,7 +215,9 @@ namespace OpenSim.Services.GridService
         
         public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
         {
-            m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, remoteRegionName, xloc, yloc);
+            m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", 
+                ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
+                remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
 
             reason = string.Empty;
             regInfo = new GridRegion();
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 3519250..12dda48 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Services.HypergridService
                     serverConfig = config.Configs["GatekeeperService"];
                     m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                 }
-                else if (!m_GridName.EndsWith("/"))
+                if (!m_GridName.EndsWith("/"))
                     m_GridName = m_GridName + "/";
             }
         }
-- 
cgit v1.1


From cefdee8aaf365d0395b44176ff46e48e933bf1bf Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 9 Dec 2010 16:52:37 -0800
Subject: Normalized ALL URLs with trailing /'s hopefully. Fixed show
 hyperlinks command. mantis #5259

---
 OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs   | 2 +-
 OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | 1 +
 OpenSim/Services/GridService/HypergridLinker.cs                      | 2 +-
 OpenSim/Services/LLLoginService/LLLoginService.cs                    | 5 +++++
 4 files changed, 8 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Services')

diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 0c41935..7ddcfa6 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
                 return false;
             }
 
-            string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
+            string uri = m_ServerURL + "homeagent/" + aCircuit.AgentID + "/";
 
             Console.WriteLine("   >>> LoginAgentToGrid <<< " + uri);
 
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index e2032d9..4e3cfa5 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -235,6 +235,7 @@ namespace OpenSim.Services.Connectors.Simulation
                 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
                 return null;
             }
+            
             // Add the input arguments
             args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
             args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 2184498..31c7b80 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -433,7 +433,7 @@ namespace OpenSim.Services.GridService
                 MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
                         r.RegionName, r.RegionID,
                         String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
-                        "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
+                        r.Data["serverURI"].ToString()));
             }
             return;
         }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 25d80bd..281b6e3 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -772,6 +772,8 @@ namespace OpenSim.Services.LLLoginService
                 {
                     aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
                 }
+                if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/"))
+                    aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/";
             }
 
             // New style: service keys  start with SRV_; override the previous
@@ -784,6 +786,9 @@ namespace OpenSim.Services.LLLoginService
                 {
                     string keyName = serviceKey.Replace("SRV_", "");
                     aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty);
+                    if (!aCircuit.ServiceURLs[keyName].ToString().EndsWith("/"))
+                        aCircuit.ServiceURLs[keyName] = aCircuit.ServiceURLs[keyName] + "/";
+
                     m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
                 }
             }
-- 
cgit v1.1


From 3053f5ba7dd22a68099b8b1dc6b41f389b6e7183 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 10 Dec 2010 03:08:31 +0000
Subject: minor: remove some compiler warnings

---
 OpenSim/Services/Interfaces/IUserAccountService.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'OpenSim/Services')

diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index c580078..9c992e0 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Services.Interfaces
                 if (str != string.Empty)
                 {
                     string[] parts = str.Split(new char[] { ';' });
-                    Dictionary<string, object> dic = new Dictionary<string, object>();
+//                    Dictionary<string, object> dic = new Dictionary<string, object>();
                     foreach (string s in parts)
                     {
                         string[] parts2 = s.Split(new char[] { '*' });
-- 
cgit v1.1


From 6f37290f4ccf0d3e516edcc38406cffaf35bcaac Mon Sep 17 00:00:00 2001
From: Marck
Date: Fri, 10 Dec 2010 17:48:45 +0100
Subject: Adjust hypergrid console commands to latest changes.

---
 OpenSim/Services/GridService/HypergridLinker.cs | 105 +++++++++---------------
 1 file changed, 41 insertions(+), 64 deletions(-)

(limited to 'OpenSim/Services')

diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 31c7b80..9863ba0 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -26,6 +26,7 @@
  */
 
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Net;
@@ -244,7 +245,9 @@ namespace OpenSim.Services.GridService
             GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
             if (region != null)
             {
-                m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID);
+                m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}",
+                    regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize,
+                    region.RegionName, region.RegionID);
                 reason = "Coordinates are already in use";
                 return false;
             }
@@ -273,7 +276,8 @@ namespace OpenSim.Services.GridService
                 region = m_GridService.GetRegionByUUID(scopeID, regionID);
                 if (region != null)
                 {
-                    m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
+                    m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
+                        region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
                     regInfo = region;
                     return true;
                 }
@@ -425,15 +429,14 @@ namespace OpenSim.Services.GridService
                 return;
             }
 
-            MainConsole.Instance.Output("Region Name                             Region UUID");
-            MainConsole.Instance.Output("Location                                URI");
-            MainConsole.Instance.Output("-------------------------------------------------------------------------------");
+            MainConsole.Instance.Output("Region Name");
+            MainConsole.Instance.Output("Location                         Region UUID");
+            MainConsole.Instance.Output(new string('-', 72));
             foreach (RegionData r in regions)
             {
-                MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
-                        r.RegionName, r.RegionID,
-                        String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
-                        r.Data["serverURI"].ToString()));
+                MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n",
+                        r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY,
+                            r.posX / Constants.RegionSize, r.posY / Constants.RegionSize)));
             }
             return;
         }
@@ -461,11 +464,14 @@ namespace OpenSim.Services.GridService
             xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
             yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
             serverURI = cmdparams[2];
-            if (cmdparams.Length == 4)
-                remoteName = cmdparams[3];
+            if (cmdparams.Length > 3)
+                remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3);
             string reason = string.Empty;
             GridRegion regInfo;
-            TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason);
+            if (TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason))
+                MainConsole.Instance.Output("Hyperlink established");
+            else
+                MainConsole.Instance.Output("Failed to link region: " + reason);
         }
 
         private void RunHGCommand(string command, string[] cmdparams)
@@ -490,18 +496,6 @@ namespace OpenSim.Services.GridService
             }
             else if (command.Equals("link-region"))
             {
-                if (cmdparams.Length > 0 && cmdparams.Length < 5)
-                {
-                    RunLinkRegionCommand(cmdparams);
-                } 
-                else
-                {
-                    LinkRegionCmdUsage();
-                }
-                return;
-            }
-            else if (command.Equals("link-region"))
-            {
                 if (cmdparams.Length < 3)
                 {
                     if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
@@ -516,40 +510,24 @@ namespace OpenSim.Services.GridService
                 }
 
                 //this should be the prefererred way of setting up hg links now
-                if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) {
+                if (cmdparams[2].StartsWith("http"))
+                {
                     RunLinkRegionCommand(cmdparams);
                 } 
                 else if (cmdparams[2].Contains(":"))
                 {
                     // New format
-                    int xloc, yloc;
-                    string mapName;
-                    try
-                    {
-                        xloc = Convert.ToInt32(cmdparams[0]);
-                        yloc = Convert.ToInt32(cmdparams[1]);
-                        mapName = cmdparams[2];
-                        if (cmdparams.Length > 3)
-                            for (int i = 3; i < cmdparams.Length; i++)
-                                mapName += " " + cmdparams[i];
-
-                        //m_log.Info(">> MapName: " + mapName);
-                    }
-                    catch (Exception e)
+                    string[] parts = cmdparams[2].Split(':');
+                    if (parts.Length > 2)
                     {
-                        MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message);
-                        LinkRegionCmdUsage();
-                        return;
+                        // Insert remote region name
+                        ArrayList parameters = new ArrayList(cmdparams);
+                        parameters.Insert(3, parts[2]);
+                        cmdparams = (string[])parameters.ToArray(typeof(string));
                     }
+                    cmdparams[2] = "http://" + parts[0] + ':' + parts[1];
 
-                    // Convert cell coordinates given by the user to meters
-                    xloc = xloc * (int)Constants.RegionSize;
-                    yloc = yloc * (int)Constants.RegionSize;
-                    string reason = string.Empty;
-                    if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null)
-                        MainConsole.Instance.Output("Failed to link region: " + reason);
-                    else
-                        MainConsole.Instance.Output("Hyperlink established");
+                    RunLinkRegionCommand(cmdparams);
                 }
                 else
                 {
@@ -558,16 +536,12 @@ namespace OpenSim.Services.GridService
                     int xloc, yloc;
                     uint externalPort;
                     string externalHostName;
-                    string serverURI;
                     try
                     {
                         xloc = Convert.ToInt32(cmdparams[0]);
                         yloc = Convert.ToInt32(cmdparams[1]);
                         externalPort = Convert.ToUInt32(cmdparams[3]);
                         externalHostName = cmdparams[2];
-                        if ( cmdparams.Length == 4 ) {
-                            
-                        }
                         //internalPort = Convert.ToUInt32(cmdparams[4]);
                         //remotingPort = Convert.ToUInt32(cmdparams[5]);
                     }
@@ -584,27 +558,30 @@ namespace OpenSim.Services.GridService
                     string reason = string.Empty;
                     if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
                     {
-                        if (cmdparams.Length >= 5)
-                        {
-                            regInfo.RegionName = "";
-                            for (int i = 4; i < cmdparams.Length; i++)
-                                regInfo.RegionName += cmdparams[i] + " ";
-                        }
+                        // What is this? The GridRegion instance will be discarded anyway,
+                        // which effectively ignores any local name given with the command.
+                        //if (cmdparams.Length >= 5)
+                        //{
+                        //    regInfo.RegionName = "";
+                        //    for (int i = 4; i < cmdparams.Length; i++)
+                        //        regInfo.RegionName += cmdparams[i] + " ";
+                        //}
                     }
                 }
                 return;
             }
             else if (command.Equals("unlink-region"))
             {
-                if (cmdparams.Length < 1 || cmdparams.Length > 1)
+                if (cmdparams.Length < 1)
                 {
                     UnlinkRegionCmdUsage();
                     return;
                 }
-                if (TryUnlinkRegion(cmdparams[0]))
-                    MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]);
+                string region = string.Join(" ", cmdparams);
+                if (TryUnlinkRegion(region))
+                    MainConsole.Instance.Output("Successfully unlinked " + region);
                 else
-                    MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found.");
+                    MainConsole.Instance.Output("Unable to unlink " + region + ", region not found.");
             }
         }
 
-- 
cgit v1.1