aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs4
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs50
-rw-r--r--OpenSim/Framework/AvatarWearable.cs7
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs28
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitDataTest.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs13
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs17
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs2
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs4
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs3
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs4
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
22 files changed, 135 insertions, 88 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 0d053e4..f4b35a6 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Framework
184 /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json 184 /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
185 /// </summary> 185 /// </summary>
186 /// <returns>map of the agent circuit data</returns> 186 /// <returns>map of the agent circuit data</returns>
187 public OSDMap PackAgentCircuitData() 187 public OSDMap PackAgentCircuitData(int wearablesCount)
188 { 188 {
189 OSDMap args = new OSDMap(); 189 OSDMap args = new OSDMap();
190 args["agent_id"] = OSD.FromUUID(AgentID); 190 args["agent_id"] = OSD.FromUUID(AgentID);
@@ -224,7 +224,7 @@ namespace OpenSim.Framework
224 { 224 {
225 args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); 225 args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
226 226
227 OSDMap appmap = Appearance.Pack(); 227 OSDMap appmap = Appearance.Pack(wearablesCount);
228 args["packed_appearance"] = appmap; 228 args["packed_appearance"] = appmap;
229 } 229 }
230 230
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 72c6bfc..50746a0 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -211,13 +211,12 @@ namespace OpenSim.Framework
211 211
212 m_serial = appearance.Serial; 212 m_serial = appearance.Serial;
213 213
214 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 214 ClearWearables();
215 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
216 m_wearables[i] = new AvatarWearable();
217 215
218 if (copyWearables && (appearance.Wearables != null)) 216 if (copyWearables && (appearance.Wearables != null))
219 { 217 {
220 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 218 m_wearables = new AvatarWearable[appearance.Wearables.Length];
219 for (int i = 0; i < appearance.Wearables.Length; i++)
221 SetWearable(i,appearance.Wearables[i]); 220 SetWearable(i,appearance.Wearables[i]);
222 } 221 }
223 222
@@ -247,7 +246,7 @@ namespace OpenSim.Framework
247 246
248 public void GetAssetsFrom(AvatarAppearance app) 247 public void GetAssetsFrom(AvatarAppearance app)
249 { 248 {
250 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 249 for (int i = 0; i < m_wearables.Length; i++)
251 { 250 {
252 for (int j = 0; j < m_wearables[i].Count; j++) 251 for (int j = 0; j < m_wearables[i].Count; j++)
253 { 252 {
@@ -262,8 +261,8 @@ namespace OpenSim.Framework
262 261
263 public void ClearWearables() 262 public void ClearWearables()
264 { 263 {
265 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 264 m_wearables = new AvatarWearable[AvatarWearable.LEGACY_VERSION_MAX_WEARABLES];
266 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 265 for (int i = 0; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; i++)
267 m_wearables[i] = new AvatarWearable(); 266 m_wearables[i] = new AvatarWearable();
268 } 267 }
269 268
@@ -470,11 +469,15 @@ namespace OpenSim.Framework
470// DEBUG ON 469// DEBUG ON
471// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); 470// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
472// DEBUG OFF 471// DEBUG OFF
472 if (wearableId >= m_wearables.Length)
473 {
474 int currentLength = m_wearables.Length;
475 Array.Resize(ref m_wearables, wearableId + 1);
476 for (int i = currentLength ; i < m_wearables.Length ; i++)
477 m_wearables[i] = new AvatarWearable();
478 }
473 m_wearables[wearableId].Clear(); 479 m_wearables[wearableId].Clear();
474 int count = wearable.Count; 480 for (int i = 0; i < wearable.Count; i++)
475 if (count > AvatarWearable.MAX_WEARABLES)
476 count = AvatarWearable.MAX_WEARABLES;
477 for (int i = 0; i < count; i++)
478 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); 481 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
479 } 482 }
480 483
@@ -714,7 +717,7 @@ namespace OpenSim.Framework
714 /// <summary> 717 /// <summary>
715 /// Create an OSDMap from the appearance data 718 /// Create an OSDMap from the appearance data
716 /// </summary> 719 /// </summary>
717 public OSDMap Pack() 720 public OSDMap Pack(int wearablesCount)
718 { 721 {
719 OSDMap data = new OSDMap(); 722 OSDMap data = new OSDMap();
720 723
@@ -722,9 +725,22 @@ namespace OpenSim.Framework
722 data["height"] = OSD.FromReal(m_avatarHeight); 725 data["height"] = OSD.FromReal(m_avatarHeight);
723 726
724 // Wearables 727 // Wearables
725 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); 728 //
726 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 729 // This will send as many or as few wearables as we have, unless a count
727 wears.Add(m_wearables[i].Pack()); 730 // is given. Used for legacy (pre 0.4) versions.
731 int count = wearablesCount;
732 if (wearablesCount == -1)
733 count = m_wearables.Length;
734 OSDArray wears = new OSDArray(count);
735 for (int i = 0; i < count; i++)
736 {
737 AvatarWearable dummyWearable = new AvatarWearable();
738
739 if (i < m_wearables.Length)
740 wears.Add(m_wearables[i].Pack());
741 else
742 wears.Add(dummyWearable.Pack());
743 }
728 data["wearables"] = wears; 744 data["wearables"] = wears;
729 745
730 // Avatar Textures 746 // Avatar Textures
@@ -782,8 +798,8 @@ namespace OpenSim.Framework
782 OSDArray wears = (OSDArray)(data["wearables"]); 798 OSDArray wears = (OSDArray)(data["wearables"]);
783 799
784 int count = wears.Count; 800 int count = wears.Count;
785 if (count > AvatarWearable.MAX_WEARABLES) 801
786 count = AvatarWearable.MAX_WEARABLES; 802 m_wearables = new AvatarWearable[count];
787 803
788 for (int i = 0; i < count; i++) 804 for (int i = 0; i < count; i++)
789 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); 805 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index e662d5f..80ed77f 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Framework
68 public static readonly int ALPHA = 13; 68 public static readonly int ALPHA = 13;
69 public static readonly int TATTOO = 14; 69 public static readonly int TATTOO = 14;
70 70
71 public static readonly int MAX_WEARABLES = 15; 71 public static readonly int LEGACY_VERSION_MAX_WEARABLES = 15;
72// public static readonly int PHYSICS = 15; 72// public static readonly int PHYSICS = 15;
73// public static int MAX_WEARABLES = 16; 73// public static int MAX_WEARABLES = 16;
74 74
@@ -225,8 +225,9 @@ namespace OpenSim.Framework
225 { 225 {
226 get 226 get
227 { 227 {
228 AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; 228 // We use the legacy count here because this is just a fallback anyway
229 for (int i = 0; i < MAX_WEARABLES; i++) 229 AvatarWearable[] defaultWearables = new AvatarWearable[LEGACY_VERSION_MAX_WEARABLES];
230 for (int i = 0; i < LEGACY_VERSION_MAX_WEARABLES; i++)
230 { 231 {
231 defaultWearables[i] = new AvatarWearable(); 232 defaultWearables[i] = new AvatarWearable();
232 } 233 }
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index a714d86..2fce155 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Framework
61 { 61 {
62 UUID AgentID { get; set; } 62 UUID AgentID { get; set; }
63 63
64 OSDMap Pack(); 64 OSDMap Pack(Object parms = null);
65 void Unpack(OSDMap map, IScene scene); 65 void Unpack(OSDMap map, IScene scene);
66 } 66 }
67 67
@@ -96,7 +96,7 @@ namespace OpenSim.Framework
96 96
97 public Dictionary<ulong, string> ChildrenCapSeeds = null; 97 public Dictionary<ulong, string> ChildrenCapSeeds = null;
98 98
99 public OSDMap Pack() 99 public OSDMap Pack(Object parms = null)
100 { 100 {
101 OSDMap args = new OSDMap(); 101 OSDMap args = new OSDMap();
102 args["message_type"] = OSD.FromString("AgentPosition"); 102 args["message_type"] = OSD.FromString("AgentPosition");
@@ -391,8 +391,18 @@ namespace OpenSim.Framework
391 391
392 public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>(); 392 public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
393 393
394 public virtual OSDMap Pack() 394 public virtual OSDMap Pack(Object parms = null)
395 { 395 {
396 int wearablesCount = -1;
397
398 if (parms != null)
399 {
400 Hashtable p = (Hashtable)parms;
401
402 if (p.ContainsKey("wearablesCount"))
403 wearablesCount = (int)p["wearablesCount"];
404 }
405
396// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 406// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
397 407
398 OSDMap args = new OSDMap(); 408 OSDMap args = new OSDMap();
@@ -493,7 +503,7 @@ namespace OpenSim.Framework
493 } 503 }
494 504
495 if (Appearance != null) 505 if (Appearance != null)
496 args["packed_appearance"] = Appearance.Pack(); 506 args["packed_appearance"] = Appearance.Pack(wearablesCount);
497 507
498 //if ((AgentTextures != null) && (AgentTextures.Length > 0)) 508 //if ((AgentTextures != null) && (AgentTextures.Length > 0))
499 //{ 509 //{
@@ -800,11 +810,7 @@ namespace OpenSim.Framework
800 { 810 {
801 OSDArray wears = (OSDArray)(args["wearables"]); 811 OSDArray wears = (OSDArray)(args["wearables"]);
802 812
803 int count = wears.Count; 813 for (int i = 0; i < wears.Count / 2; i++)
804 if (count > AvatarWearable.MAX_WEARABLES)
805 count = AvatarWearable.MAX_WEARABLES;
806
807 for (int i = 0; i < count / 2; i++)
808 { 814 {
809 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); 815 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
810 Appearance.SetWearable(i, awear); 816 Appearance.SetWearable(i, awear);
@@ -897,9 +903,9 @@ namespace OpenSim.Framework
897 903
898 public class CompleteAgentData : AgentData 904 public class CompleteAgentData : AgentData
899 { 905 {
900 public override OSDMap Pack() 906 public override OSDMap Pack(object parms = null)
901 { 907 {
902 return base.Pack(); 908 return base.Pack(parms);
903 } 909 }
904 910
905 public override void Unpack(OSDMap map, IScene scene) 911 public override void Unpack(OSDMap map, IScene scene)
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
index 95e9439..a2a2eea 100644
--- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
@@ -312,7 +312,7 @@ namespace OpenSim.Framework.Tests
312 Agent1Data.startpos = StartPos; 312 Agent1Data.startpos = StartPos;
313 313
314 OSDMap map2; 314 OSDMap map2;
315 OSDMap map = Agent1Data.PackAgentCircuitData(); 315 OSDMap map = Agent1Data.PackAgentCircuitData(-1);
316 try 316 try
317 { 317 {
318 string str = OSDParser.SerializeJsonString(map); 318 string str = OSDParser.SerializeJsonString(map);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 51c59e9..e20ab50 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -12233,10 +12233,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12233 cachedresp.WearableData = 12233 cachedresp.WearableData =
12234 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; 12234 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
12235 12235
12236 int maxWearablesLoop = cachedtex.WearableData.Length;
12237 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
12238 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
12239
12240 int cacheHits = 0; 12236 int cacheHits = 0;
12241 12237
12242 // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid 12238 // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
@@ -12250,6 +12246,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12250 cacheItems = p.Appearance.WearableCacheItems; 12246 cacheItems = p.Appearance.WearableCacheItems;
12251 } 12247 }
12252 12248
12249 int maxWearablesLoop = cachedtex.WearableData.Length;
12250 if (maxWearablesLoop > cacheItems.Length)
12251 maxWearablesLoop = cacheItems.Length;
12252
12253 if (cacheItems != null) 12253 if (cacheItems != null)
12254 { 12254 {
12255 for (int i = 0; i < maxWearablesLoop; i++) 12255 for (int i = 0; i < maxWearablesLoop; i++)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 0d3b39e..cdcd6b9 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -853,7 +853,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
853 853
854 if (invService.GetRootFolder(userID) != null) 854 if (invService.GetRootFolder(userID) != null)
855 { 855 {
856 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 856 for (int i = 0; i < appearance.Wearables.Length; i++)
857 { 857 {
858 for (int j = 0; j < appearance.Wearables[i].Count; j++) 858 for (int j = 0; j < appearance.Wearables[i].Count; j++)
859 { 859 {
@@ -1258,8 +1258,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1258 1258
1259 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 1259 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
1260 { 1260 {
1261 if (wear.Type < AvatarWearable.MAX_WEARABLES) 1261 // If the wearable type is larger than the current array, expand it
1262 avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero); 1262 if (avatAppearance.Wearables.Length <= wear.Type)
1263 {
1264 int currentLength = avatAppearance.Wearables.Length;
1265 AvatarWearable[] wears = avatAppearance.Wearables;
1266 Array.Resize(ref wears, wear.Type + 1);
1267 for (int i = currentLength ; i <= wear.Type ; i++)
1268 wears[i] = new AvatarWearable();
1269 avatAppearance.Wearables = wears;
1270 }
1271 avatAppearance.Wearables[wear.Type].Add(wear.ItemID, UUID.Zero);
1263 } 1272 }
1264 1273
1265 avatAppearance.GetAssetsFrom(sp.Appearance); 1274 avatAppearance.GetAssetsFrom(sp.Appearance);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 4d70c54..ed93f05 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -849,7 +849,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
849 // Let's create an agent there if one doesn't exist yet. 849 // Let's create an agent there if one doesn't exist yet.
850 // NOTE: logout will always be false for a non-HG teleport. 850 // NOTE: logout will always be false for a non-HG teleport.
851 bool logout = false; 851 bool logout = false;
852 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 852 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout))
853 { 853 {
854 m_interRegionTeleportFailures.Value++; 854 m_interRegionTeleportFailures.Value++;
855 855
@@ -948,7 +948,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
948 // destination region but the viewer cannot establish the connection (e.g. due to network issues between 948 // destination region but the viewer cannot establish the connection (e.g. due to network issues between
949 // the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then 949 // the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then
950 // there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail(). 950 // there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail().
951 if (!UpdateAgent(reg, finalDestination, agent, sp)) 951 if (!UpdateAgent(reg, finalDestination, agent, sp, ctx))
952 { 952 {
953 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) 953 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
954 { 954 {
@@ -1084,7 +1084,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1084 // Let's create an agent there if one doesn't exist yet. 1084 // Let's create an agent there if one doesn't exist yet.
1085 // NOTE: logout will always be false for a non-HG teleport. 1085 // NOTE: logout will always be false for a non-HG teleport.
1086 bool logout = false; 1086 bool logout = false;
1087 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 1087 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout))
1088 { 1088 {
1089 m_interRegionTeleportFailures.Value++; 1089 m_interRegionTeleportFailures.Value++;
1090 1090
@@ -1158,7 +1158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1158 // Send the Update. If this returns true, we know the client has contacted the destination 1158 // Send the Update. If this returns true, we know the client has contacted the destination
1159 // via CompleteMovementIntoRegion, so we can let go. 1159 // via CompleteMovementIntoRegion, so we can let go.
1160 // If it returns false, something went wrong, and we need to abort. 1160 // If it returns false, something went wrong, and we need to abort.
1161 if (!UpdateAgent(reg, finalDestination, agent, sp)) 1161 if (!UpdateAgent(reg, finalDestination, agent, sp, ctx))
1162 { 1162 {
1163 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) 1163 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
1164 { 1164 {
@@ -1280,13 +1280,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1280 sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); 1280 sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
1281 } 1281 }
1282 1282
1283 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 1283 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout)
1284 { 1284 {
1285 GridRegion source = new GridRegion(Scene.RegionInfo); 1285 GridRegion source = new GridRegion(Scene.RegionInfo);
1286 source.RawServerURI = m_GatekeeperURI; 1286 source.RawServerURI = m_GatekeeperURI;
1287 1287
1288 logout = false; 1288 logout = false;
1289 bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, out reason); 1289 bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, ctx, out reason);
1290 1290
1291 if (success) 1291 if (success)
1292 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); 1292 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
@@ -1294,9 +1294,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1294 return success; 1294 return success;
1295 } 1295 }
1296 1296
1297 protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp) 1297 protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp, EntityTransferContext ctx)
1298 { 1298 {
1299 return Scene.SimulationService.UpdateAgent(finalDestination, agent); 1299 return Scene.SimulationService.UpdateAgent(finalDestination, agent, ctx);
1300 } 1300 }
1301 1301
1302 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) 1302 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
@@ -1679,7 +1679,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1679 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1679 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1680 } 1680 }
1681 1681
1682 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) 1682 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx))
1683 { 1683 {
1684 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); 1684 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader);
1685 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1685 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
@@ -1695,7 +1695,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1695 return agent; 1695 return agent;
1696 } 1696 }
1697 1697
1698 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) 1698 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx)
1699 { 1699 {
1700 int ts = Util.EnvironmentTickCount(); 1700 int ts = Util.EnvironmentTickCount();
1701 try 1701 try
@@ -1718,7 +1718,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1718 // Beyond this point, extra cleanup is needed beyond removing transit state 1718 // Beyond this point, extra cleanup is needed beyond removing transit state
1719 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); 1719 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
1720 1720
1721 if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) 1721 if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx))
1722 { 1722 {
1723 // region doesn't take it 1723 // region doesn't take it
1724 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); 1724 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
@@ -2360,7 +2360,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2360 2360
2361 string reason = String.Empty; 2361 string reason = String.Empty;
2362 2362
2363 bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, out reason); 2363 EntityTransferContext ctx = new EntityTransferContext();
2364 bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, ctx, out reason);
2364 2365
2365 if (regionAccepted) 2366 if (regionAccepted)
2366 { 2367 {
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index dcc4746..1783e0a 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
263 } 263 }
264 } 264 }
265 265
266 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 266 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason, out bool logout)
267 { 267 {
268 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI); 268 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
269 reason = string.Empty; 269 reason = string.Empty;
@@ -308,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
308 } 308 }
309 } 309 }
310 310
311 return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout); 311 return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, ctx, out reason, out logout);
312 } 312 }
313 313
314 public void TriggerTeleportHome(UUID id, IClientAPI client) 314 public void TriggerTeleportHome(UUID id, IClientAPI client)
@@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
333 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance"); 333 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance");
334 334
335 // Check wearables 335 // Check wearables
336 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 336 for (int i = 0; i < sp.Appearance.Wearables.Length ; i++)
337 { 337 {
338 for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++) 338 for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++)
339 { 339 {
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
342 342
343 bool found = false; 343 bool found = false;
344 foreach (AvatarAppearance a in ExportedAppearance) 344 foreach (AvatarAppearance a in ExportedAppearance)
345 if (a.Wearables[i] != null) 345 if (i < a.Wearables.Length && a.Wearables[i] != null)
346 { 346 {
347 found = true; 347 found = true;
348 break; 348 break;
@@ -356,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
356 356
357 found = false; 357 found = false;
358 foreach (AvatarAppearance a in ExportedAppearance) 358 foreach (AvatarAppearance a in ExportedAppearance)
359 if (sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) 359 if (i < a.Wearables.Length && sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID)
360 { 360 {
361 found = true; 361 found = true;
362 break; 362 break;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 6cb15f6..3755650 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
185 * Agent-related communications 185 * Agent-related communications
186 */ 186 */
187 187
188 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 188 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason)
189 { 189 {
190 if (destination == null) 190 if (destination == null)
191 { 191 {
@@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
204 return false; 204 return false;
205 } 205 }
206 206
207 public bool UpdateAgent(GridRegion destination, AgentData cAgentData) 207 public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx)
208 { 208 {
209 if (destination == null) 209 if (destination == null)
210 return false; 210 return false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index cf19edd..0ebdbce 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -160,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
160 * Agent-related communications 160 * Agent-related communications
161 */ 161 */
162 162
163 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 163 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason)
164 { 164 {
165 if (destination == null) 165 if (destination == null)
166 { 166 {
@@ -170,27 +170,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
170 } 170 }
171 171
172 // Try local first 172 // Try local first
173 if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason)) 173 if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason))
174 return true; 174 return true;
175 175
176 // else do the remote thing 176 // else do the remote thing
177 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 177 if (!m_localBackend.IsLocalRegion(destination.RegionID))
178 { 178 {
179 return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); 179 return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason);
180 } 180 }
181 return false; 181 return false;
182 } 182 }
183 183
184 public bool UpdateAgent(GridRegion destination, AgentData cAgentData) 184 public bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx)
185 { 185 {
186 if (destination == null) 186 if (destination == null)
187 return false; 187 return false;
188 188
189 // Try local first 189 // Try local first
190 if (m_localBackend.IsLocalRegion(destination.RegionID)) 190 if (m_localBackend.IsLocalRegion(destination.RegionID))
191 return m_localBackend.UpdateAgent(destination, cAgentData); 191 return m_localBackend.UpdateAgent(destination, cAgentData, ctx);
192 192
193 return m_remoteConnector.UpdateAgent(destination, cAgentData); 193 return m_remoteConnector.UpdateAgent(destination, cAgentData, ctx);
194 } 194 }
195 195
196 public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) 196 public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 96d112d..568cd34 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -44,6 +44,7 @@ using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using GridRegion = OpenSim.Services.Interfaces.GridRegion; 46using GridRegion = OpenSim.Services.Interfaces.GridRegion;
47using OpenSim.Services.Interfaces;
47 48
48namespace OpenSim.Region.Framework.Scenes.Tests 49namespace OpenSim.Region.Framework.Scenes.Tests
49{ 50{
@@ -226,7 +227,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
226 // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and 227 // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and
227 // establish a child scene presence. We pass in the circuit code that the client has to connect with *** 228 // establish a child scene presence. We pass in the circuit code that the client has to connect with ***
228 // XXX: ViaLogin may not be correct here. 229 // XXX: ViaLogin may not be correct here.
229 scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason); 230 EntityTransferContext ctx = new EntityTransferContext();
231 scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, ctx, out reason);
230 232
231 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); 233 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
232 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); 234 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
@@ -287,4 +289,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
287// Assert.That(childPresence.IsChildAgent, Is.True); 289// Assert.That(childPresence.IsChildAgent, Is.True);
288 } 290 }
289 } 291 }
290} \ No newline at end of file 292}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index fae0bda..e945b30 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3114 if (appearanceModule != null) 3114 if (appearanceModule != null)
3115 { 3115 {
3116 appearanceModule.SaveBakedTextures(sp.UUID); 3116 appearanceModule.SaveBakedTextures(sp.UUID);
3117 OSDMap appearancePacked = sp.Appearance.Pack(); 3117 OSDMap appearancePacked = sp.Appearance.Pack(-1);
3118 3118
3119 TaskInventoryItem item 3119 TaskInventoryItem item
3120 = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); 3120 = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true);
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 0e6710d..f6a7e19 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -461,6 +461,7 @@ namespace OpenSim.Server.Handlers.Simulation
461 // This is the meaning of POST agent 461 // This is the meaning of POST agent
462 //m_regionClient.AdjustUserInformation(aCircuit); 462 //m_regionClient.AdjustUserInformation(aCircuit);
463 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); 463 //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
464
464 bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason); 465 bool result = CreateAgent(source, gatekeeper, destination, aCircuit, data.flags, data.fromLogin, out reason);
465 466
466 resp["reason"] = OSD.FromString(reason); 467 resp["reason"] = OSD.FromString(reason);
@@ -539,12 +540,15 @@ namespace OpenSim.Server.Handlers.Simulation
539 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) 540 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
540 { 541 {
541 reason = String.Empty; 542 reason = String.Empty;
543 // The data and protocols are already defined so this is just a dummy to satisfy the interface
544 // TODO: make this end-to-end
545 EntityTransferContext ctx = new EntityTransferContext();
542 if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0) 546 if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0)
543 { 547 {
544 Util.FireAndForget(x => 548 Util.FireAndForget(x =>
545 { 549 {
546 string r; 550 string r;
547 m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out r); 551 m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out r);
548 m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r); 552 m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r);
549 }); 553 });
550 554
@@ -553,7 +557,7 @@ namespace OpenSim.Server.Handlers.Simulation
553 else 557 else
554 { 558 {
555 559
556 bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); 560 bool ret = m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason);
557 m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason); 561 m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason);
558 return ret; 562 return ret;
559 } 563 }
@@ -739,7 +743,10 @@ namespace OpenSim.Server.Handlers.Simulation
739 // subclasses can override this 743 // subclasses can override this
740 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) 744 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
741 { 745 {
742 return m_SimulationService.UpdateAgent(destination, agent); 746 // The data and protocols are already defined so this is just a dummy to satisfy the interface
747 // TODO: make this end-to-end
748 EntityTransferContext ctx = new EntityTransferContext();
749 return m_SimulationService.UpdateAgent(destination, agent, ctx);
743 } 750 }
744 } 751 }
745 752
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 8abd046..1dcc82a 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -138,7 +138,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
138 Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); 138 Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI);
139 139
140 uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; 140 uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome;
141 return CreateAgent(source, home, aCircuit, flags, out reason); 141 EntityTransferContext ctx = new EntityTransferContext();
142 return CreateAgent(source, home, aCircuit, flags, ctx, out reason);
142 } 143 }
143 144
144 145
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index a397740..d355eab 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -152,7 +152,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
152 // <param name=""></param> 152 // <param name=""></param>
153 public bool SetAppearance(UUID userID, AvatarAppearance appearance) 153 public bool SetAppearance(UUID userID, AvatarAppearance appearance)
154 { 154 {
155 OSDMap map = appearance.Pack(); 155 OSDMap map = appearance.Pack(-1);
156 if (map == null) 156 if (map == null)
157 { 157 {
158 m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); 158 m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID);
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 3bf03cf..bb47e6b 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -98,13 +98,13 @@ namespace OpenSim.Services.Connectors.Simulation
98 args["teleport_flags"] = OSD.FromString(flags.ToString()); 98 args["teleport_flags"] = OSD.FromString(flags.ToString());
99 } 99 }
100 100
101 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 101 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason)
102 { 102 {
103 string tmp = String.Empty; 103 string tmp = String.Empty;
104 return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason); 104 return CreateAgent(source, destination, aCircuit, flags, ctx, out tmp, out reason);
105 } 105 }
106 106
107 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) 107 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason)
108 { 108 {
109 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); 109 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
110 reason = String.Empty; 110 reason = String.Empty;
@@ -121,7 +121,7 @@ namespace OpenSim.Services.Connectors.Simulation
121 121
122 try 122 try
123 { 123 {
124 OSDMap args = aCircuit.PackAgentCircuitData(); 124 OSDMap args = aCircuit.PackAgentCircuitData(-1);
125 PackData(args, source, aCircuit, destination, flags); 125 PackData(args, source, aCircuit, destination, flags);
126 126
127 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); 127 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
@@ -172,9 +172,9 @@ namespace OpenSim.Services.Connectors.Simulation
172 /// <summary> 172 /// <summary>
173 /// Send complete data about an agent in this region to a neighbor 173 /// Send complete data about an agent in this region to a neighbor
174 /// </summary> 174 /// </summary>
175 public bool UpdateAgent(GridRegion destination, AgentData data) 175 public bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx)
176 { 176 {
177 return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds 177 return UpdateAgent(destination, (IAgentData)data, ctx, 200000); // yes, 200 seconds
178 } 178 }
179 179
180 private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); 180 private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>();
@@ -235,7 +235,8 @@ namespace OpenSim.Services.Connectors.Simulation
235 } 235 }
236 } 236 }
237 237
238 success = UpdateAgent(destination, (IAgentData)pos, 10000); 238 EntityTransferContext ctx = new EntityTransferContext(); // Dummy, not needed for position
239 success = UpdateAgent(destination, (IAgentData)pos, ctx, 10000);
239 } 240 }
240 // we get here iff success == false 241 // we get here iff success == false
241 // blacklist sim for 2 minutes 242 // blacklist sim for 2 minutes
@@ -250,7 +251,7 @@ namespace OpenSim.Services.Connectors.Simulation
250 /// <summary> 251 /// <summary>
251 /// This is the worker function to send AgentData to a neighbor region 252 /// This is the worker function to send AgentData to a neighbor region
252 /// </summary> 253 /// </summary>
253 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) 254 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, EntityTransferContext ctx, int timeout)
254 { 255 {
255 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI); 256 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI);
256 257
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 8e10125..9643a8b 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -459,7 +459,7 @@ namespace OpenSim.Services.HypergridService
459 true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) 459 true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
460 return false; 460 return false;
461 461
462 return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, out reason); 462 return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason);
463 } 463 }
464 464
465 protected bool Authenticate(AgentCircuitData aCircuit) 465 protected bool Authenticate(AgentCircuitData aCircuit)
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index c65122a..317d006 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -281,7 +281,9 @@ namespace OpenSim.Services.HypergridService
281 } 281 }
282 else 282 else
283 { 283 {
284 success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason); 284 //TODO: Should there not be a call to QueryAccess here?
285 EntityTransferContext ctx = new EntityTransferContext();
286 success = m_GatekeeperConnector.CreateAgent(source, region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, ctx, out myExternalIP, out reason);
285 } 287 }
286 288
287 if (!success) 289 if (!success)
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index bd66dad..99b71b9 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -150,7 +150,8 @@ namespace OpenSim.Services.Interfaces
150 // Wearables 150 // Wearables
151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); 151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
152 152
153 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++) 153 // TODO: With COF, is this even needed?
154 for (int i = 0 ; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES ; i++)
154 { 155 {
155 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++) 156 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
156 { 157 {
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 3f6b009..4496a9f 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Services.Interfaces
74 /// <param name="aCircuit"></param> 74 /// <param name="aCircuit"></param>
75 /// <param name="flags"></param> 75 /// <param name="flags"></param>
76 /// <param name="reason">Reason message in the event of a failure.</param> 76 /// <param name="reason">Reason message in the event of a failure.</param>
77 bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); 77 bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason);
78 78
79 /// <summary> 79 /// <summary>
80 /// Full child agent update. 80 /// Full child agent update.
@@ -82,7 +82,7 @@ namespace OpenSim.Services.Interfaces
82 /// <param name="regionHandle"></param> 82 /// <param name="regionHandle"></param>
83 /// <param name="data"></param> 83 /// <param name="data"></param>
84 /// <returns></returns> 84 /// <returns></returns>
85 bool UpdateAgent(GridRegion destination, AgentData data); 85 bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx);
86 86
87 /// <summary> 87 /// <summary>
88 /// Short child agent update, mostly for position. 88 /// Short child agent update, mostly for position.
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 619a527..6681f1a 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -999,7 +999,7 @@ namespace OpenSim.Services.LLLoginService
999 region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) 999 region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
1000 return false; 1000 return false;
1001 1001
1002 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason); 1002 return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason);
1003 } 1003 }
1004 1004
1005 private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason) 1005 private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, IPEndPoint clientIP, out string reason)