From 3ec8e8e40b39cdd1643618a9a416a6b17d6e8685 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 27 Dec 2009 16:01:36 +0000
Subject: Fix the spelling :/

---
 OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 096d5e1..6a71540 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4857,9 +4857,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
                 UserProfile.FirstLifeImage = Properties.FLImageID;
                 UserProfile.Image = Properties.ImageID;
                 UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL);
-                Userprofile.Flags &= ~3;
-                Userprofile.Flags |= Properties.AllowPublish ? 1 : 0;
-                Userprofile.Flags |= Properties.MaturePublish ? 2 : 0;
+                UserProfile.Flags &= ~3;
+                UserProfile.Flags |= Properties.AllowPublish ? 1 : 0;
+                UserProfile.Flags |= Properties.MaturePublish ? 2 : 0;
 
                 handlerUpdateAvatarProperties(this, UserProfile);
             }
-- 
cgit v1.1


From bca2afdb3ca73b743dfdec9a9e672efbdca87243 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 27 Dec 2009 16:07:13 +0000
Subject: One should not copy/paste so much :)

---
 OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 6a71540..f02c28b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4857,9 +4857,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
                 UserProfile.FirstLifeImage = Properties.FLImageID;
                 UserProfile.Image = Properties.ImageID;
                 UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL);
-                UserProfile.Flags &= ~3;
-                UserProfile.Flags |= Properties.AllowPublish ? 1 : 0;
-                UserProfile.Flags |= Properties.MaturePublish ? 2 : 0;
+                UserProfile.UserFlags &= ~3;
+                UserProfile.UserFlags |= Properties.AllowPublish ? 1 : 0;
+                UserProfile.UserFlags |= Properties.MaturePublish ? 2 : 0;
 
                 handlerUpdateAvatarProperties(this, UserProfile);
             }
-- 
cgit v1.1


From 0b5cdc539c767b526f14cb7e7d97fd83bea14424 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 29 Dec 2009 18:35:06 +0000
Subject: Change teleports so the TeleportFlags are sent to the destination
 sim. It can now determine if a connection is from login, teleport or
 crossing. Needed for a meaningful banlines implementation

---
 OpenSim/Client/Linden/LLProxyLoginModule.cs          |  2 +-
 OpenSim/Client/Linden/LLStandaloneLoginModule.cs     |  2 +-
 OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs  |  2 +-
 .../Framework/Communications/Clients/RegionClient.cs |  5 +++--
 .../CoreModules/InterGrid/OpenGridProtocolModule.cs  |  2 +-
 .../Interregion/LocalInterregionComms.cs             |  4 ++--
 .../Interregion/RESTInterregionComms.cs              | 17 +++++++++++------
 .../Region/Framework/Interfaces/IInterregionComms.cs |  2 +-
 .../Scenes/Hypergrid/HGSceneCommunicationService.cs  |  2 +-
 OpenSim/Region/Framework/Scenes/Scene.cs             | 20 ++++++++++++++++----
 .../Framework/Scenes/SceneCommunicationService.cs    |  4 ++--
 .../Framework/Scenes/Tests/ScenePresenceTests.cs     |  6 +++---
 OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs      |  2 +-
 13 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs
index efae234..9075f15 100644
--- a/OpenSim/Client/Linden/LLProxyLoginModule.cs
+++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs
@@ -268,7 +268,7 @@ namespace OpenSim.Client.Linden
                         else
                         {
                             string reason;
-                            if (scene.NewUserConnection(agentData, out reason))
+                            if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
                             {
                                 success = true;
                             }
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
index 8739ce5..8047f74 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
@@ -199,7 +199,7 @@ namespace OpenSim.Client.Linden
             Scene scene;
             if (TryGetRegion(regionHandle, out scene))
             {
-                return scene.NewUserConnection(agent, out reason);
+                return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
             }
             reason = "Region not found.";
             return false;
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
index 63381a4..7d71f18 100644
--- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
+++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
@@ -609,7 +609,7 @@ namespace OpenSim.Client.MXP.PacketHandler
                 agent.Appearance = new AvatarAppearance();
             }
             
-            return scene.NewUserConnection(agent, out reason);
+            return scene.NewUserConnection(agent, 0, out reason);
         }
 
         public void PrintDebugInformation()
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs
index 297b046..5ceaf39 100644
--- a/OpenSim/Framework/Communications/Clients/RegionClient.cs
+++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients
     {
         private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
-        public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, out string reason)
+        public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, uint teleportFlags, out string reason)
         {
             reason = String.Empty;
 
@@ -83,7 +83,8 @@ namespace OpenSim.Framework.Communications.Clients
             }
             // Add the regionhandle of the destination region
             ulong regionHandle = GetRegionHandle(region.RegionHandle);
-            args["destination_handle"] = OSD.FromString(regionHandle.ToString());
+            args["destination_handle"] = OSD.FromString(regionHandle.ToString());
+            args["teleport_flags"] = OSD.FromString(teleportFlags.ToString());
 
             string strBuffer = "";
             byte[] buffer = new byte[1];
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index c727cec..10a3232 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -557,7 +557,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
 
             // Call 'new user' event handler
             string reason;
-            if (!homeScene.NewUserConnection(agentData, out reason))
+            if (!homeScene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
             {
                 responseMap["connect"] = OSD.FromBoolean(false);
                 responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason));
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
index bdfe3b1..d68c683 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
          * Agent-related communications
          */
 
-        public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
+        public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
         {
 
             foreach (Scene s in m_sceneList)
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
                 if (s.RegionInfo.RegionHandle == regionHandle)
                 {
 //                    m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
-                    return s.NewUserConnection(aCircuit, out reason);
+                    return s.NewUserConnection(aCircuit, teleportFlags, out reason);
                 }
             }
 
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 710e3ca..44458d1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -157,10 +157,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
          * Agent-related communications
          */
 
-        public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
+        public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
         {
             // Try local first
-            if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason))
+            if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, teleportFlags, out reason))
                 return true;
 
             // else do the remote thing
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
                 {
                     m_regionClient.SendUserInformation(regInfo, aCircuit);
 
-                    return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", out reason);
+                    return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", teleportFlags, out reason);
                 }
                 //else
                 //    m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
@@ -436,11 +436,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
             }
 
             OSDMap resp = new OSDMap(2);
-            string reason = String.Empty;
-
+            string reason = String.Empty;
+            uint teleportFlags = 0;
+            if (args.ContainsKey("teleport_flags"))
+            {
+                teleportFlags = args["teleport_flags"].AsUInteger();
+            }
+            
             // This is the meaning of POST agent
             m_regionClient.AdjustUserInformation(aCircuit);
-            bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, out reason);
+            bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, teleportFlags, out reason);
 
             resp["reason"] = OSD.FromString(reason);
             resp["success"] = OSD.FromBoolean(result);
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
index 8f4d3d5..2d6287f 100644
--- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces
     {
         #region Agents
 
-        bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason);
+        bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason);
 
         /// <summary>
         /// Full child agent update.
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 0f9c190..416826c 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
                         string reason = String.Empty;
 
                         //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
-                        if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason))
+                        if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
                         {
                             avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
                                                                                       reason));
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f79eb5d..0e1e2be 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3316,12 +3316,16 @@ namespace OpenSim.Region.Framework.Scenes
         /// Use NewUserConnection() directly if possible so the return type can refuse connections.
         /// At the moment nothing actually seems to use this event,
         /// as everything is switching to calling the NewUserConnection method directly.
+        /// 
+        /// Now obsoleting this because it doesn't handle teleportFlags propertly
+        /// 
         /// </summary>
         /// <param name="agent"></param>
+        [Obsolete("Please call NewUserConnection directly.")]
         public void HandleNewUserConnection(AgentCircuitData agent)
         {
             string reason;
-            NewUserConnection(agent, out reason);
+            NewUserConnection(agent, 0, out reason);
         }
 
         /// <summary>
@@ -3334,8 +3338,16 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="reason">Outputs the reason for the false response on this string</param>
         /// <returns>True if the region accepts this agent.  False if it does not.  False will 
         /// also return a reason.</returns>
-        public bool NewUserConnection(AgentCircuitData agent, out string reason)
+        public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
         {
+            //Teleport flags:
+            //
+            // TeleportFlags.ViaGodlikeLure - Border Crossing
+            // TeleportFlags.ViaLogin - Login
+            // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user
+            // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
+
+
             if (loginsdisabled)
             {
                 reason = "Logins Disabled";
@@ -3343,9 +3355,9 @@ namespace OpenSim.Region.Framework.Scenes
             }
             // Don't disable this log message - it's too helpful
             m_log.InfoFormat(
-                "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5})",
+                "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})",
                 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
-                agent.AgentID, agent.circuitcode);
+                agent.AgentID, agent.circuitcode, teleportFlags);
 
             reason = String.Empty;
             if (!AuthenticateUser(agent, out reason))
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index e649139..f49d072 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes
             string reason = String.Empty;
 
            
-            bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason);
+            bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
 
             if (regionAccepted && newAgent)
             {
@@ -810,7 +810,7 @@ namespace OpenSim.Region.Framework.Scenes
 
                         // Let's create an agent there if one doesn't exist yet. 
                         //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
-                        if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason))
+                        if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
                         {
                             avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
                                                                                       reason));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index f495022..f00dd66 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
             agent.child = true;
 
             string reason;
-            scene.NewUserConnection(agent, out reason);
+            scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
             testclient = new TestClient(agent, scene);
             scene.AddNewClient(testclient);
 
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
             if (acd1 == null)
                 fixNullPresence();
 
-            scene.NewUserConnection(acd1, out reason);
+            scene.NewUserConnection(acd1, 0, out reason);
             if (testclient == null)
                 testclient = new TestClient(acd1, scene);
             scene.AddNewClient(testclient);
@@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
 
             // Adding child agent to region 1001
             string reason;
-            scene2.NewUserConnection(acd1, out reason);
+            scene2.NewUserConnection(acd1,0, out reason);
             scene2.AddNewClient(testclient);
 
             ScenePresence presence = scene.GetScenePresence(agent1);
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 8b18d07..b13e8dd 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -382,7 +382,7 @@ namespace OpenSim.Tests.Common.Setup
 
             // We emulate the proper login sequence here by doing things in three stages
             // Stage 1: simulate login by telling the scene to expect a new user connection
-            scene.NewUserConnection(agentData, out reason);
+            scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason);
 
             // Stage 2: add the new client as a child agent to the scene
             TestClient client = new TestClient(agentData, scene);
-- 
cgit v1.1