aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2010-09-13 16:16:40 +0100
committerMelanie2010-09-13 16:17:38 +0100
commit6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e (patch)
tree1e7bf4fddcf559886c6b2babf13cf4b2ca8829a1 /OpenSim/Region/CoreModules
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentFix unit test SceneSetupHelpers to load the mock simulation data store (diff)
downloadopensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.zip
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.gz
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.bz2
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.xz
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please don't use until I do the companion commit to modules later on.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs431
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs18
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs54
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs118
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs98
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
34 files changed, 458 insertions, 494 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 100b55c..e1c0949 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
49 49
50 protected Scene m_scene = null; 50 protected Scene m_scene = null;
51 51
52 public string Name { get { return "Attachments Module"; } } 52 public string Name { get { return "Attachments Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 53 public Type ReplaceableInterface { get { return null; } }
54 54
55 public void Initialise(IConfigSource source) {} 55 public void Initialise(IConfigSource source) {}
56 56
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
81 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; 81 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
82 client.OnObjectAttach += AttachObject; 82 client.OnObjectAttach += AttachObject;
83 client.OnObjectDetach += DetachObject; 83 client.OnObjectDetach += DetachObject;
84 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; 84 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
85 } 85 }
86 86
87 public void UnsubscribeFromClientEvents(IClientAPI client) 87 public void UnsubscribeFromClientEvents(IClientAPI client)
@@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
90 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; 90 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
91 client.OnObjectAttach -= AttachObject; 91 client.OnObjectAttach -= AttachObject;
92 client.OnObjectDetach -= DetachObject; 92 client.OnObjectDetach -= DetachObject;
93 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; 93 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
@@ -174,12 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
174 UUID itemID = UUID.Zero; 174 UUID itemID = UUID.Zero;
175 if (sp != null) 175 if (sp != null)
176 { 176 {
177 foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) 177 foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
178 { 178 {
179 itemID = grp.GetFromItemID(); 179 itemID = grp.GetFromItemID();
180 if (itemID != UUID.Zero) 180 if (itemID != UUID.Zero)
181 DetachSingleAttachmentToInv(itemID, remoteClient); 181 DetachSingleAttachmentToInv(itemID, remoteClient);
182 } 182 }
183 } 183 }
184 184
185 if (group.GetFromItemID() == UUID.Zero) 185 if (group.GetFromItemID() == UUID.Zero)
@@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
232 232
233 public UUID RezSingleAttachmentFromInventory( 233 public UUID RezSingleAttachmentFromInventory(
234 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) 234 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
235 { 235 {
236 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); 236 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
237 237
238 if (updateInventoryStatus) 238 if (updateInventoryStatus)
@@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
248 if (null == att) 248 if (null == att)
249 return UUID.Zero; 249 return UUID.Zero;
250 else 250 else
251 return att.UUID; 251 return att.UUID;
252 } 252 }
253 253
254 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 254 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
255 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) 255 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
311 } 311 }
312 312
313 return null; 313 return null;
314 } 314 }
315 315
316 public UUID SetAttachmentInventoryStatus( 316 public UUID SetAttachmentInventoryStatus(
317 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 317 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
@@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
456 456
457 // We can NOT use the dictionries here, as we are looking 457 // We can NOT use the dictionries here, as we are looking
458 // for an entity by the fromAssetID, which is NOT the prim UUID 458 // for an entity by the fromAssetID, which is NOT the prim UUID
459 List<EntityBase> detachEntities = m_scene.GetEntities(); 459 EntityBase[] detachEntities = m_scene.GetEntities();
460 SceneObjectGroup group; 460 SceneObjectGroup group;
461 461
462 foreach (EntityBase entity in detachEntities) 462 foreach (EntityBase entity in detachEntities)
@@ -495,7 +495,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
495 sog.RootPart.IsAttachment = false; 495 sog.RootPart.IsAttachment = false;
496 sog.AbsolutePosition = sog.RootPart.AttachedPos; 496 sog.AbsolutePosition = sog.RootPart.AttachedPos;
497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); 497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
498 sog.SetAttachmentPoint(attachmentPoint); 498 sog.SetAttachmentPoint(attachmentPoint);
499 } 499 }
500 500
501 /// <summary> 501 /// <summary>
@@ -622,7 +622,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
622 // In case it is later dropped again, don't let 622 // In case it is later dropped again, don't let
623 // it get cleaned up 623 // it get cleaned up
624 so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); 624 so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
625 so.HasGroupChanged = false; 625 so.HasGroupChanged = false;
626 } 626 }
627 } 627 }
628} 628}
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 032e55a..25322a1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
132 try 132 try
133 { 133 {
134 deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true); 134 deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
135 if(killingAvatar != null) 135 if (killingAvatar != null)
136 killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname); 136 killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
137 } 137 }
138 catch (InvalidOperationException) 138 catch (InvalidOperationException)
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
143 } 143 }
144 144
145 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) 145 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
146 { 146 {
147 try 147 try
148 { 148 {
149 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 149 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index ca0b7ad..a49e71e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
54 public UUID PrincipalID; 54 public UUID PrincipalID;
55 public FriendInfo[] Friends; 55 public FriendInfo[] Friends;
56 public int Refcount; 56 public int Refcount;
57 public UUID RegionID;
58 57
59 public bool IsFriend(string friend) 58 public bool IsFriend(string friend)
60 { 59 {
@@ -68,6 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
68 } 67 }
69 } 68 }
70 69
70 private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 72
73 protected List<Scene> m_Scenes = new List<Scene>(); 73 protected List<Scene> m_Scenes = new List<Scene>();
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
79 protected Dictionary<UUID, UserFriendData> m_Friends = 79 protected Dictionary<UUID, UserFriendData> m_Friends =
80 new Dictionary<UUID, UserFriendData>(); 80 new Dictionary<UUID, UserFriendData>();
81 81
82 protected List<UUID> m_NeedsListOfFriends = new List<UUID>(); 82 protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
83 83
84 protected IPresenceService PresenceService 84 protected IPresenceService PresenceService
85 { 85 {
@@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
146 // Instantiate the request handler 146 // Instantiate the request handler
147 IHttpServer server = MainServer.GetHttpServer((uint)mPort); 147 IHttpServer server = MainServer.GetHttpServer((uint)mPort);
148 server.AddStreamHandler(new FriendsRequestHandler(this)); 148 server.AddStreamHandler(new FriendsRequestHandler(this));
149
150 } 149 }
151 150
152 if (m_FriendsService == null) 151 if (m_FriendsService == null)
@@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
173 scene.EventManager.OnNewClient += OnNewClient; 172 scene.EventManager.OnNewClient += OnNewClient;
174 scene.EventManager.OnClientClosed += OnClientClosed; 173 scene.EventManager.OnClientClosed += OnClientClosed;
175 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 174 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
176 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
177 scene.EventManager.OnClientLogin += OnClientLogin; 175 scene.EventManager.OnClientLogin += OnClientLogin;
178 } 176 }
179 177
@@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
198 196
199 public uint GetFriendPerms(UUID principalID, UUID friendID) 197 public uint GetFriendPerms(UUID principalID, UUID friendID)
200 { 198 {
201 if (!m_Friends.ContainsKey(principalID)) 199 FriendInfo[] friends = GetFriends(principalID);
202 return 0; 200 foreach (FriendInfo fi in friends)
203
204 UserFriendData data = m_Friends[principalID];
205
206 string searchFor = friendID.ToString();
207 foreach (FriendInfo fi in data.Friends)
208 { 201 {
209 if (fi.Friend == searchFor) 202 if (fi.Friend == friendID.ToString())
210 return (uint)fi.TheirFlags; 203 return (uint)fi.TheirFlags;
211 } 204 }
205
212 return 0; 206 return 0;
213 } 207 }
214 208
@@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
218 client.OnApproveFriendRequest += OnApproveFriendRequest; 212 client.OnApproveFriendRequest += OnApproveFriendRequest;
219 client.OnDenyFriendRequest += OnDenyFriendRequest; 213 client.OnDenyFriendRequest += OnDenyFriendRequest;
220 client.OnTerminateFriendship += OnTerminateFriendship; 214 client.OnTerminateFriendship += OnTerminateFriendship;
221
222 client.OnGrantUserRights += OnGrantUserRights; 215 client.OnGrantUserRights += OnGrantUserRights;
223 216
224 lock (m_Friends) 217 // Asynchronously fetch the friends list or increment the refcount for the existing
225 { 218 // friends list
226 if (m_Friends.ContainsKey(client.AgentId)) 219 Util.FireAndForget(
220 delegate(object o)
227 { 221 {
228 m_Friends[client.AgentId].Refcount++; 222 lock (m_Friends)
229 return; 223 {
230 } 224 UserFriendData friendsData;
231 225 if (m_Friends.TryGetValue(client.AgentId, out friendsData))
232 UserFriendData newFriends = new UserFriendData(); 226 {
233 227 friendsData.Refcount++;
234 newFriends.PrincipalID = client.AgentId; 228 }
235 newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); 229 else
236 newFriends.Refcount = 1; 230 {
237 newFriends.RegionID = UUID.Zero; 231 friendsData = new UserFriendData();
232 friendsData.PrincipalID = client.AgentId;
233 friendsData.Friends = FriendsService.GetFriends(client.AgentId);
234 friendsData.Refcount = 1;
238 235
239 m_Friends.Add(client.AgentId, newFriends); 236 m_Friends[client.AgentId] = friendsData;
240 } 237 }
241 238 }
239 }
240 );
242 } 241 }
243 242
244 private void OnClientClosed(UUID agentID, Scene scene) 243 private void OnClientClosed(UUID agentID, Scene scene)
245 { 244 {
246 ScenePresence sp = scene.GetScenePresence(agentID); 245 ScenePresence sp = scene.GetScenePresence(agentID);
247 if (sp != null && !sp.IsChildAgent) 246 if (sp != null && !sp.IsChildAgent)
247 {
248 // do this for root agents closing out 248 // do this for root agents closing out
249 StatusChange(agentID, false); 249 StatusChange(agentID, false);
250 }
250 251
251 lock (m_Friends) 252 lock (m_Friends)
252 if (m_Friends.ContainsKey(agentID)) 253 {
254 UserFriendData friendsData;
255 if (m_Friends.TryGetValue(agentID, out friendsData))
253 { 256 {
254 if (m_Friends[agentID].Refcount == 1) 257 friendsData.Refcount--;
258 if (friendsData.Refcount <= 0)
255 m_Friends.Remove(agentID); 259 m_Friends.Remove(agentID);
256 else
257 m_Friends[agentID].Refcount--;
258 } 260 }
259 }
260
261 private void OnMakeRootAgent(ScenePresence sp)
262 {
263 UUID agentID = sp.ControllingClient.AgentId;
264
265 if (m_Friends.ContainsKey(agentID))
266 {
267 // This is probably an overkill, but just
268 // to make sure we have the latest and greatest
269 // friends list -- always pull OnMakeRoot
270 m_Friends[agentID].Friends =
271 m_FriendsService.GetFriends(agentID);
272
273 m_Friends[agentID].RegionID =
274 sp.ControllingClient.Scene.RegionInfo.RegionID;
275 } 261 }
276 } 262 }
277 263
278 264 private void OnMakeRootAgent(ScenePresence sp)
279 private void OnMakeChildAgent(ScenePresence sp)
280 { 265 {
281 UUID agentID = sp.ControllingClient.AgentId; 266 UUID agentID = sp.ControllingClient.AgentId;
282 267 UpdateFriendsCache(agentID);
283 if (m_Friends.ContainsKey(agentID))
284 {
285 if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID)
286 m_Friends[agentID].RegionID = UUID.Zero;
287 }
288 } 268 }
289 269
290 private void OnClientLogin(IClientAPI client) 270 private void OnClientLogin(IClientAPI client)
@@ -296,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
296 276
297 // Register that we need to send the list of online friends to this user 277 // Register that we need to send the list of online friends to this user
298 lock (m_NeedsListOfFriends) 278 lock (m_NeedsListOfFriends)
299 if (!m_NeedsListOfFriends.Contains(agentID)) 279 m_NeedsListOfFriends.Add(agentID);
300 {
301 m_NeedsListOfFriends.Add(agentID);
302 }
303 } 280 }
304 281
305 public void SendFriendsOnlineIfNeeded(IClientAPI client) 282 public void SendFriendsOnlineIfNeeded(IClientAPI client)
306 { 283 {
307 UUID agentID = client.AgentId; 284 UUID agentID = client.AgentId;
308 if (m_NeedsListOfFriends.Contains(agentID)) 285
286 // Check if the online friends list is needed
287 lock (m_NeedsListOfFriends)
309 { 288 {
310 if (!m_Friends.ContainsKey(agentID)) 289 if (!m_NeedsListOfFriends.Remove(agentID))
311 {
312 m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
313 return; 290 return;
314 } 291 }
315
316 //
317 // Send the friends online
318 //
319 List<UUID> online = GetOnlineFriends(agentID);
320 if (online.Count > 0)
321 {
322 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
323 client.SendAgentOnline(online.ToArray());
324 }
325
326 //
327 // Send outstanding friendship offers
328 //
329 if (m_Friends.ContainsKey(agentID))
330 {
331 List<string> outstanding = new List<string>();
332 292
333 foreach (FriendInfo fi in m_Friends[agentID].Friends) 293 // Send the friends online
334 if (fi.TheirFlags == -1) 294 List<UUID> online = GetOnlineFriends(agentID);
335 outstanding.Add(fi.Friend); 295 if (online.Count > 0)
296 {
297 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
298 client.SendAgentOnline(online.ToArray());
299 }
336 300
337 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); 301 // Send outstanding friendship offers
338 foreach (string fid in outstanding) 302 List<string> outstanding = new List<string>();
339 { 303 FriendInfo[] friends = GetFriends(agentID);
340 try 304 foreach (FriendInfo fi in friends)
341 { 305 {
342 im.fromAgentID = new Guid(fid); 306 if (fi.TheirFlags == -1)
343 } 307 outstanding.Add(fi.Friend);
344 catch 308 }
345 {
346 continue;
347 }
348 309
349 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); 310 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
350 im.fromAgentName = account.FirstName + " " + account.LastName; 311 "Will you be my friend?", true, Vector3.Zero);
351 312
352 PresenceInfo presence = null; 313 foreach (string fid in outstanding)
353 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); 314 {
354 if (presences != null && presences.Length > 0) 315 UUID fromAgentID;
355 presence = presences[0]; 316 if (!UUID.TryParse(fid, out fromAgentID))
356 if (presence != null) 317 continue;
357 im.offline = 0;
358 318
359 im.imSessionID = im.fromAgentID; 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
360 321
361 // Finally 322 im.fromAgentID = fromAgentID.Guid;
362 LocalFriendshipOffered(agentID, im); 323 im.fromAgentName = account.FirstName + " " + account.LastName;
363 } 324 im.offline = (byte)((presence == null) ? 1 : 0);
364 } 325 im.imSessionID = im.fromAgentID;
365 326
366 lock (m_NeedsListOfFriends) 327 // Finally
367 m_NeedsListOfFriends.Remove(agentID); 328 LocalFriendshipOffered(agentID, im);
368 } 329 }
369 } 330 }
370 331
@@ -373,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
373 List<string> friendList = new List<string>(); 334 List<string> friendList = new List<string>();
374 List<UUID> online = new List<UUID>(); 335 List<UUID> online = new List<UUID>();
375 336
376 foreach (FriendInfo fi in m_Friends[userID].Friends) 337 FriendInfo[] friends = GetFriends(userID);
338 foreach (FriendInfo fi in friends)
377 { 339 {
378 if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) 340 if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
379 friendList.Add(fi.Friend); 341 friendList.Add(fi.Friend);
380 } 342 }
381 343
382 if (friendList.Count == 0) 344 if (friendList.Count > 0)
383 // no friends whatsoever 345 {
384 return online; 346 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
385 347 foreach (PresenceInfo pi in presence)
386 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); 348 {
387 349 UUID presenceID;
388 foreach (PresenceInfo pi in presence) 350 if (UUID.TryParse(pi.UserID, out presenceID))
389 online.Add(new UUID(pi.UserID)); 351 online.Add(presenceID);
390 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); 352 }
353 }
391 354
392 return online; 355 return online;
393 } 356 }
394 357
395 // 358 /// <summary>
396 // Find the client for a ID 359 /// Find the client for a ID
397 // 360 /// </summary>
398 public IClientAPI LocateClientObject(UUID agentID) 361 public IClientAPI LocateClientObject(UUID agentID)
399 { 362 {
400 Scene scene = GetClientScene(agentID); 363 Scene scene = GetClientScene(agentID);
401 if (scene == null) 364 if (scene != null)
402 return null; 365 {
403 366 ScenePresence presence = scene.GetScenePresence(agentID);
404 ScenePresence presence = scene.GetScenePresence(agentID); 367 if (presence != null)
405 if (presence == null) 368 return presence.ControllingClient;
406 return null; 369 }
407 370
408 return presence.ControllingClient; 371 return null;
409 } 372 }
410 373
411 // 374 /// <summary>
412 // Find the scene for an agent 375 /// Find the scene for an agent
413 // 376 /// </summary>
414 private Scene GetClientScene(UUID agentId) 377 private Scene GetClientScene(UUID agentId)
415 { 378 {
416 lock (m_Scenes) 379 lock (m_Scenes)
@@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
418 foreach (Scene scene in m_Scenes) 381 foreach (Scene scene in m_Scenes)
419 { 382 {
420 ScenePresence presence = scene.GetScenePresence(agentId); 383 ScenePresence presence = scene.GetScenePresence(agentId);
421 if (presence != null) 384 if (presence != null && !presence.IsChildAgent)
422 { 385 return scene;
423 if (!presence.IsChildAgent)
424 return scene;
425 }
426 } 386 }
427 } 387 }
388
428 return null; 389 return null;
429 } 390 }
430 391
@@ -435,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
435 /// <param name="online"></param> 396 /// <param name="online"></param>
436 private void StatusChange(UUID agentID, bool online) 397 private void StatusChange(UUID agentID, bool online)
437 { 398 {
438 //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); 399 FriendInfo[] friends = GetFriends(agentID);
439 if (m_Friends.ContainsKey(agentID)) 400 if (friends.Length > 0)
440 { 401 {
441 //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
442 List<FriendInfo> friendList = new List<FriendInfo>(); 402 List<FriendInfo> friendList = new List<FriendInfo>();
443 foreach (FriendInfo fi in m_Friends[agentID].Friends) 403 foreach (FriendInfo fi in friends)
444 { 404 {
445 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) 405 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
446 friendList.Add(fi); 406 friendList.Add(fi);
447 } 407 }
448 408
449 Util.FireAndForget(delegate 409 Util.FireAndForget(
450 { 410 delegate
451 foreach (FriendInfo fi in friendList)
452 { 411 {
453 //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); 412 foreach (FriendInfo fi in friendList)
454 // Notify about this user status 413 {
455 StatusNotify(fi, agentID, online); 414 //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
415 // Notify about this user status
416 StatusNotify(fi, agentID, online);
417 }
456 } 418 }
457 }); 419 );
458 } 420 }
459 else
460 m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
461 } 421 }
462 422
463 private void StatusNotify(FriendInfo friend, UUID userID, bool online) 423 private void StatusNotify(FriendInfo friend, UUID userID, bool online)
464 { 424 {
465 UUID friendID = UUID.Zero; 425 UUID friendID;
466
467 if (UUID.TryParse(friend.Friend, out friendID)) 426 if (UUID.TryParse(friend.Friend, out friendID))
468 { 427 {
469 // Try local 428 // Try local
@@ -471,35 +430,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
471 return; 430 return;
472 431
473 // The friend is not here [as root]. Let's forward. 432 // The friend is not here [as root]. Let's forward.
474 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 433 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
475 if (friendSessions != null && friendSessions.Length > 0) 434 if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
476 { 435 {
477 PresenceInfo friendSession = null; 436 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
478 foreach (PresenceInfo pinfo in friendSessions) 437 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
479 if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad 438 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
480 {
481 friendSession = pinfo;
482 break;
483 }
484
485 if (friendSession != null)
486 {
487 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
488 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
489 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
490 }
491 } 439 }
492
493 // Friend is not online. Ignore.
494 } 440 }
495 else 441 else
442 {
496 m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); 443 m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
444 }
497 } 445 }
498 446
499 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 447 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
500 { 448 {
501 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) 449 if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
502 { 450 {
503 // we got a friendship offer 451 // we got a friendship offer
504 UUID principalID = new UUID(im.fromAgentID); 452 UUID principalID = new UUID(im.fromAgentID);
505 UUID friendID = new UUID(im.toAgentID); 453 UUID friendID = new UUID(im.toAgentID);
@@ -529,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
529 return; 477 return;
530 478
531 // The prospective friend is not here [as root]. Let's forward. 479 // The prospective friend is not here [as root]. Let's forward.
532 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 480 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
533 if (friendSessions != null && friendSessions.Length > 0) 481 if (friendSession != null)
534 { 482 {
535 PresenceInfo friendSession = friendSessions[0]; 483 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
536 if (friendSession != null) 484 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
537 {
538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
539 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
540 }
541 } 485 }
542 // If the prospective friend is not online, he'll get the message upon login. 486 // If the prospective friend is not online, he'll get the message upon login.
543 } 487 }
@@ -548,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
548 492
549 FriendsService.StoreFriend(agentID, friendID.ToString(), 1); 493 FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
550 FriendsService.StoreFriend(friendID, agentID.ToString(), 1); 494 FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
551 // update the local cache
552 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
553 495
496 // Update the local cache
497 UpdateFriendsCache(agentID);
554 498
555 // 499 //
556 // Notify the friend 500 // Notify the friend
@@ -564,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
564 } 508 }
565 509
566 // The friend is not here 510 // The friend is not here
567 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 511 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
568 if (friendSessions != null && friendSessions.Length > 0) 512 if (friendSession != null)
569 { 513 {
570 PresenceInfo friendSession = friendSessions[0]; 514 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
571 if (friendSession != null) 515 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
572 { 516 client.SendAgentOnline(new UUID[] { friendID });
573 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
574 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
575 client.SendAgentOnline(new UUID[] { friendID });
576 }
577 } 517 }
578 } 518 }
579 519
@@ -592,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
592 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 532 if (LocalFriendshipDenied(agentID, client.Name, friendID))
593 return; 533 return;
594 534
595 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 535 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
596 if (friendSessions != null && friendSessions.Length > 0) 536 if (friendSession != null)
597 { 537 {
598 PresenceInfo friendSession = friendSessions[0]; 538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
599 if (friendSession != null) 539 if (region != null)
600 { 540 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
601 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 541 else
602 if (region != null) 542 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
603 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
604 else
605 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
606 }
607 } 543 }
608 } 544 }
609 545
@@ -613,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
613 FriendsService.Delete(exfriendID, agentID.ToString()); 549 FriendsService.Delete(exfriendID, agentID.ToString());
614 550
615 // Update local cache 551 // Update local cache
616 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); 552 UpdateFriendsCache(agentID);
617 553
618 client.SendTerminateFriend(exfriendID); 554 client.SendTerminateFriend(exfriendID);
619 555
@@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
625 if (LocalFriendshipTerminated(exfriendID)) 561 if (LocalFriendshipTerminated(exfriendID))
626 return; 562 return;
627 563
628 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); 564 PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
629 if (friendSessions != null && friendSessions.Length > 0) 565 if (friendSession != null)
630 { 566 {
631 PresenceInfo friendSession = friendSessions[0]; 567 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
632 if (friendSession != null) 568 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
633 {
634 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
635 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
636 }
637 } 569 }
638 } 570 }
639 571
640 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) 572 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
641 { 573 {
642 if (!m_Friends.ContainsKey(remoteClient.AgentId)) 574 FriendInfo[] friends = GetFriends(remoteClient.AgentId);
575 if (friends.Length == 0)
643 return; 576 return;
644 577
645 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); 578 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
646 // Let's find the friend in this user's friend list 579 // Let's find the friend in this user's friend list
647 UserFriendData fd = m_Friends[remoteClient.AgentId];
648 FriendInfo friend = null; 580 FriendInfo friend = null;
649 foreach (FriendInfo fi in fd.Friends) 581 foreach (FriendInfo fi in friends)
582 {
650 if (fi.Friend == target.ToString()) 583 if (fi.Friend == target.ToString())
651 friend = fi; 584 friend = fi;
585 }
652 586
653 if (friend != null) // Found it 587 if (friend != null) // Found it
654 { 588 {
@@ -670,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
670 if (LocalGrantRights(requester, target, myFlags, rights)) 604 if (LocalGrantRights(requester, target, myFlags, rights))
671 return; 605 return;
672 606
673 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 607 PresenceInfo friendSession = PresenceService.GetAgent(target);
674 if (friendSessions != null && friendSessions.Length > 0) 608 if (friendSession != null)
675 { 609 {
676 PresenceInfo friendSession = friendSessions[0]; 610 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
677 if (friendSession != null) 611 // TODO: You might want to send the delta to save the lookup
678 { 612 // on the other end!!
679 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 613 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
680 // TODO: You might want to send the delta to save the lookup
681 // on the other end!!
682 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
683 }
684 } 614 }
685 } 615 }
686 } 616 }
@@ -709,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
709 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, 639 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
710 (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); 640 (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
711 friendClient.SendInstantMessage(im); 641 friendClient.SendInstantMessage(im);
712 // update the local cache 642
713 m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); 643 // Update the local cache
644 UpdateFriendsCache(friendID);
645
714 // we're done 646 // we're done
715 return true; 647 return true;
716 } 648 }
@@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
724 if (friendClient != null) 656 if (friendClient != null)
725 { 657 {
726 // the prospective friend in this sim as root agent 658 // the prospective friend in this sim as root agent
727
728 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, 659 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
729 (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); 660 (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
730 friendClient.SendInstantMessage(im); 661 friendClient.SendInstantMessage(im);
@@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
743 // the friend in this sim as root agent 674 // the friend in this sim as root agent
744 friendClient.SendTerminateFriend(exfriendID); 675 friendClient.SendTerminateFriend(exfriendID);
745 // update local cache 676 // update local cache
746 m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); 677 UpdateFriendsCache(exfriendID);
747 // we're done 678 // we're done
748 return true; 679 return true;
749 } 680 }
@@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
772 703
773 } 704 }
774 705
775 // update local cache 706 // Update local cache
776 //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); 707 lock (m_Friends)
777 foreach (FriendInfo finfo in m_Friends[friendID].Friends) 708 {
778 if (finfo.Friend == userID.ToString()) 709 FriendInfo[] friends = GetFriends(friendID);
779 finfo.TheirFlags = rights; 710 foreach (FriendInfo finfo in friends)
711 {
712 if (finfo.Friend == userID.ToString())
713 finfo.TheirFlags = rights;
714 }
715 }
780 716
781 return true; 717 return true;
782 } 718 }
@@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
802 738
803 return false; 739 return false;
804 } 740 }
741
805 #endregion 742 #endregion
806 743
744 private FriendInfo[] GetFriends(UUID agentID)
745 {
746 UserFriendData friendsData;
747
748 lock (m_Friends)
749 {
750 if (m_Friends.TryGetValue(agentID, out friendsData))
751 return friendsData.Friends;
752 }
753
754 return EMPTY_FRIENDS;
755 }
756
757 private void UpdateFriendsCache(UUID agentID)
758 {
759 lock (m_Friends)
760 {
761 UserFriendData friendsData;
762 if (m_Friends.TryGetValue(agentID, out friendsData))
763 friendsData.Friends = FriendsService.GetFriends(agentID);
764 }
765 }
807 } 766 }
808} 767}
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 4b30b0d..5ec64d5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
58 public void SubscribeToClientEvents(IClientAPI client) 58 public void SubscribeToClientEvents(IClientAPI client)
59 { 59 {
60 client.OnGodKickUser += KickUser; 60 client.OnGodKickUser += KickUser;
61 client.OnRequestGodlikePowers += RequestGodlikePowers; 61 client.OnRequestGodlikePowers += RequestGodlikePowers;
62 } 62 }
63 63
64 public void UnsubscribeFromClientEvents(IClientAPI client) 64 public void UnsubscribeFromClientEvents(IClientAPI client)
65 { 65 {
66 client.OnGodKickUser -= KickUser; 66 client.OnGodKickUser -= KickUser;
67 client.OnRequestGodlikePowers -= RequestGodlikePowers; 67 client.OnRequestGodlikePowers -= RequestGodlikePowers;
68 } 68 }
69 69
70 public void RequestGodlikePowers( 70 public void RequestGodlikePowers(
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index a49faec..a6894ff 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -138,8 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
138 if (scene.Entities.ContainsKey(toAgentID) && 138 if (scene.Entities.ContainsKey(toAgentID) &&
139 scene.Entities[toAgentID] is ScenePresence) 139 scene.Entities[toAgentID] is ScenePresence)
140 { 140 {
141 // m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); 141// m_log.DebugFormat(
142 // Local message 142// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
143// toAgentID.ToString(), scene.RegionInfo.RegionName);
144
143 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 145 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
144 if (!user.IsChildAgent) 146 if (!user.IsChildAgent)
145 { 147 {
@@ -495,9 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
495 if (lookupAgent) 497 if (lookupAgent)
496 { 498 {
497 // Non-cached user agent lookup. 499 // Non-cached user agent lookup.
498 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); 500 upd = PresenceService.GetAgent(toAgentID);
499 if (presences != null && presences.Length > 0)
500 upd = presences[0];
501 501
502 if (upd != null) 502 if (upd != null)
503 { 503 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 52342ec..c1df827 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
179 m_log.DebugFormat( 179 m_log.DebugFormat(
180 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", 180 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
181 successfulAssetRestores, failedAssetRestores); 181 successfulAssetRestores, failedAssetRestores);
182 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); 182 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
183 183
184 return loadedNodes; 184 return loadedNodes;
185 } 185 }
186 finally 186 finally
187 { 187 {
188 m_loadStream.Close(); 188 m_loadStream.Close();
189 } 189 }
190 } 190 }
191 191
192 public void Close() 192 public void Close()
@@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
201 /// <param name="iarPath">The item archive path to replicate</param> 201 /// <param name="iarPath">The item archive path to replicate</param>
202 /// <param name="rootDestinationFolder">The root folder for the inventory load</param> 202 /// <param name="rootDestinationFolder">The root folder for the inventory load</param>
203 /// <param name="resolvedFolders"> 203 /// <param name="resolvedFolders">
204 /// The folders that we have resolved so far for a given archive path. 204 /// The folders that we have resolved so far for a given archive path.
205 /// This method will add more folders if necessary 205 /// This method will add more folders if necessary
206 /// </param> 206 /// </param>
207 /// <param name="loadedNodes"> 207 /// <param name="loadedNodes">
@@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
246 /// The root folder for the inventory load 246 /// The root folder for the inventory load
247 /// </param> 247 /// </param>
248 /// <param name="resolvedFolders"> 248 /// <param name="resolvedFolders">
249 /// The folders that we have resolved so far for a given archive path. 249 /// The folders that we have resolved so far for a given archive path.
250 /// </param> 250 /// </param>
251 /// <returns> 251 /// <returns>
252 /// The folder in the user's inventory that matches best the archive path given. If no such folder was found 252 /// The folder in the user's inventory that matches best the archive path given. If no such folder was found
253 /// then the passed in root destination folder is returned. 253 /// then the passed in root destination folder is returned.
254 /// </returns> 254 /// </returns>
255 protected InventoryFolderBase ResolveDestinationFolder( 255 protected InventoryFolderBase ResolveDestinationFolder(
256 InventoryFolderBase rootDestFolder, 256 InventoryFolderBase rootDestFolder,
257 ref string archivePath, 257 ref string archivePath,
258 Dictionary <string, InventoryFolderBase> resolvedFolders) 258 Dictionary <string, InventoryFolderBase> resolvedFolders)
259 { 259 {
260// string originalArchivePath = archivePath; 260// string originalArchivePath = archivePath;
261 261
262 while (archivePath.Length > 0) 262 while (archivePath.Length > 0)
@@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
370 370
371 if (0 == i) 371 if (0 == i)
372 loadedNodes.Add(destFolder); 372 loadedNodes.Add(destFolder);
373 } 373 }
374 } 374 }
375 375
376 /// <summary> 376 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 9908018..bae5a7a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
120 { 120 {
121 Exception reportedException = null; 121 Exception reportedException = null;
122 bool succeeded = true; 122 bool succeeded = true;
123 123
124 try 124 try
125 { 125 {
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
136 finally 136 finally
137 { 137 {
138 m_saveStream.Close(); 138 m_saveStream.Close();
139 } 139 }
140 140
141 m_module.TriggerInventoryArchiveSaved( 141 m_module.TriggerInventoryArchiveSaved(
142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
270 { 270 {
271 // We couldn't find the path indicated 271 // We couldn't find the path indicated
272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
273 Exception e = new InventoryArchiverException(errorMessage); 273 Exception e = new InventoryArchiverException(errorMessage);
274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); 274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
275 throw e; 275 throw e;
276 } 276 }
@@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", 283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
284 inventoryFolder.Name, 284 inventoryFolder.Name,
285 inventoryFolder.ID, 285 inventoryFolder.ID,
286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); 286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
287 287
288 //recurse through all dirs getting dirs and files 288 //recurse through all dirs getting dirs and files
289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); 289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
301 //SaveUsers(); 301 //SaveUsers();
302 302
303 new AssetsRequest( 303 new AssetsRequest(
304 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); 304 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
305 } 305 }
306 catch (Exception) 306 catch (Exception)
307 { 307 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
index e07e2ca..5fd1a7e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
33 /// Signals an inventory archiving problem 33 /// Signals an inventory archiving problem
34 /// </summary> 34 /// </summary>
35 public class InventoryArchiverException : Exception 35 public class InventoryArchiverException : Exception
36 { 36 {
37 public InventoryArchiverException(string message) : base(message) {} 37 public InventoryArchiverException(string message) : base(message) {}
38 public InventoryArchiverException(string message, Exception e) : base(message, e) {} 38 public InventoryArchiverException(string message, Exception e) : base(message, e) {}
39 } 39 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index f03f2a1..2eaca49 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
91 91
92 scene.AddCommand( 92 scene.AddCommand(
93 this, "load iar", 93 this, "load iar",
94 "load iar <first> <last> <inventory path> <password> [<IAR path>]", 94 "load iar <first> <last> <inventory path> <password> [<IAR path>]",
95 //"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]", 95 //"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
96 "Load user inventory archive (IAR).", 96 "Load user inventory archive (IAR).",
97 //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" 97 //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
98 //+ "<first> is user's first name." + Environment.NewLine 98 //+ "<first> is user's first name." + Environment.NewLine
99 "<first> is user's first name." + Environment.NewLine 99 "<first> is user's first name." + Environment.NewLine
100 + "<last> is user's last name." + Environment.NewLine 100 + "<last> is user's last name." + Environment.NewLine
101 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine 101 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
102 + "<password> is the user's password." + Environment.NewLine 102 + "<password> is the user's password." + Environment.NewLine
@@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
241 if (CheckPresence(userInfo.PrincipalID)) 241 if (CheckPresence(userInfo.PrincipalID))
242 { 242 {
243 InventoryArchiveReadRequest request; 243 InventoryArchiveReadRequest request;
244 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 244 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
245 245
246 try 246 try
247 { 247 {
@@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
286 if (CheckPresence(userInfo.PrincipalID)) 286 if (CheckPresence(userInfo.PrincipalID))
287 { 287 {
288 InventoryArchiveReadRequest request; 288 InventoryArchiveReadRequest request;
289 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 289 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
290 290
291 try 291 try
292 { 292 {
293 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); 293 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
294 } 294 }
295 catch (EntryPointNotFoundException e) 295 catch (EntryPointNotFoundException e)
@@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
325 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 325 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
326 { 326 {
327 try 327 try
328 { 328 {
329 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 329 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
330 330
331 Dictionary<string, object> options = new Dictionary<string, object>(); 331 Dictionary<string, object> options = new Dictionary<string, object>();
332 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 332 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
333 333
334 List<string> mainParams = optionSet.Parse(cmdparams); 334 List<string> mainParams = optionSet.Parse(cmdparams);
335 335
336 if (mainParams.Count < 6) 336 if (mainParams.Count < 6)
337 { 337 {
338 m_log.Error( 338 m_log.Error(
339 "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); 339 "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
340 return; 340 return;
341 } 341 }
342 342
343 string firstName = mainParams[2]; 343 string firstName = mainParams[2];
344 string lastName = mainParams[3]; 344 string lastName = mainParams[3];
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
353 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) 353 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
354 m_log.InfoFormat( 354 m_log.InfoFormat(
355 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 355 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
356 loadPath, firstName, lastName); 356 loadPath, firstName, lastName);
357 } 357 }
358 catch (InventoryArchiverException e) 358 catch (InventoryArchiverException e)
359 { 359 {
@@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", 390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
391 savePath, invPath, firstName, lastName); 391 savePath, invPath, firstName, lastName);
392 392
393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); 393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
394 } 394 }
395 catch (InventoryArchiverException e) 395 catch (InventoryArchiverException e)
396 { 396 {
@@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
398 } 398 }
399 399
400 lock (m_pendingConsoleSaves) 400 lock (m_pendingConsoleSaves)
401 m_pendingConsoleSaves.Add(id); 401 m_pendingConsoleSaves.Add(id);
402 } 402 }
403 403
404 private void SaveInvConsoleCommandCompleted( 404 private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d66a1d0..938886b2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
58 /// <summary> 58 /// <summary>
59 /// Stream of data representing a common IAR that can be reused in load tests. 59 /// Stream of data representing a common IAR that can be reused in load tests.
60 /// </summary> 60 /// </summary>
61 protected MemoryStream m_iarStream; 61 protected MemoryStream m_iarStream;
62 62
63 protected UserAccount m_ua1 63 protected UserAccount m_ua1
64 = new UserAccount { 64 = new UserAccount {
65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), 65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
66 FirstName = "Mr", 66 FirstName = "Mr",
67 LastName = "Tiddles" }; 67 LastName = "Tiddles" };
68 protected UserAccount m_ua2 68 protected UserAccount m_ua2
69 = new UserAccount { 69 = new UserAccount {
70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), 70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
71 FirstName = "Lord", 71 FirstName = "Lord",
72 LastName = "Lucan" }; 72 LastName = "Lucan" };
73 string m_item1Name = "b.lsl"; 73 string m_item1Name = "b.lsl";
74 74
75 private void SaveCompleted( 75 private void SaveCompleted(
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
86 } 86 }
87 87
88 protected void ConstructDefaultIarForTestLoad() 88 protected void ConstructDefaultIarForTestLoad()
89 { 89 {
90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); 90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
91 91
92 MemoryStream archiveWriteStream = new MemoryStream(); 92 MemoryStream archiveWriteStream = new MemoryStream();
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
104 string item1FileName 104 string item1FileName
105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
107 tar.Close(); 107 tar.Close();
108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); 108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
109 } 109 }
110 110
@@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
341// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 341// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
342 342
343 // TODO: Test presence of more files and contents of files. 343 // TODO: Test presence of more files and contents of files.
344 } 344 }
345 345
346 /// <summary> 346 /// <summary>
347 /// Test that things work when the load path specified starts with a slash 347 /// Test that things work when the load path specified starts with a slash
@@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
349 [Test] 349 [Test]
350 public void TestLoadIarPathStartsWithSlash() 350 public void TestLoadIarPathStartsWithSlash()
351 { 351 {
352 TestHelper.InMethod(); 352 TestHelper.InMethod();
353// log4net.Config.XmlConfigurator.Configure(); 353// log4net.Config.XmlConfigurator.Configure();
354 354
355 SerialiserModule serialiserModule = new SerialiserModule(); 355 SerialiserModule serialiserModule = new SerialiserModule();
356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
357 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 357 Scene scene = SceneSetupHelpers.SetupScene("inventory");
358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
359 359
360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); 360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); 361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
362 362
363 InventoryItemBase foundItem1 363 InventoryItemBase foundItem1
364 = InventoryArchiveUtils.FindItemByPath( 364 = InventoryArchiveUtils.FindItemByPath(
365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); 365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
366 366
367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); 367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
368 } 368 }
369 369
370 /// <summary> 370 /// <summary>
@@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
376 [Test] 376 [Test]
377 public void TestLoadIarV0_1ExistingUsers() 377 public void TestLoadIarV0_1ExistingUsers()
378 { 378 {
379 TestHelper.InMethod(); 379 TestHelper.InMethod();
380 //log4net.Config.XmlConfigurator.Configure(); 380 //log4net.Config.XmlConfigurator.Configure();
381 381
382 SerialiserModule serialiserModule = new SerialiserModule(); 382 SerialiserModule serialiserModule = new SerialiserModule();
@@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
386 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 386 Scene scene = SceneSetupHelpers.SetupScene("inventory");
387 387
388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
389 389
390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); 390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); 391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
392 392
393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); 393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
394 394
@@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
450 string userFirstName = "Jock"; 450 string userFirstName = "Jock";
451 string userLastName = "Stirrup"; 451 string userLastName = "Stirrup";
452 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); 452 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
453 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); 453 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
454 454
455 // Create asset 455 // Create asset
456 SceneObjectGroup object1; 456 SceneObjectGroup object1;
@@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
524 [Test] 524 [Test]
525 public void TestLoadIarV0_1AbsentUsers() 525 public void TestLoadIarV0_1AbsentUsers()
526 { 526 {
527 TestHelper.InMethod(); 527 TestHelper.InMethod();
528 //log4net.Config.XmlConfigurator.Configure(); 528 //log4net.Config.XmlConfigurator.Configure();
529 529
530 string userFirstName = "Charlie"; 530 string userFirstName = "Charlie";
@@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
562 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 562 Scene scene = SceneSetupHelpers.SetupScene("inventory");
563 563
564 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 564 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
565 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); 565 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
566 566
567 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 567 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
568 568
@@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
680 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); 680 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
681 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); 681 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
682 682
683 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); 683 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
684 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); 684 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
685 685
686 { 686 {
687 // Test replication of path1 687 // Test replication of path1
@@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
694 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); 694 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
695 Assert.That(folder1Candidates.Count, Is.EqualTo(1)); 695 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
696 696
697 InventoryFolderBase folder1 = folder1Candidates[0]; 697 InventoryFolderBase folder1 = folder1Candidates[0];
698 List<InventoryFolderBase> folder2aCandidates 698 List<InventoryFolderBase> folder2aCandidates
699 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); 699 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
700 Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); 700 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
@@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
715 715
716 List<InventoryFolderBase> folder2aCandidates 716 List<InventoryFolderBase> folder2aCandidates
717 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); 717 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
718 Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); 718 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
719 719
720 List<InventoryFolderBase> folder2bCandidates 720 List<InventoryFolderBase> folder2bCandidates
721 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); 721 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
722 Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); 722 Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
723 } 723 }
724 } 724 }
725 725
@@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
741 741
742 InventoryFolderBase folder1 742 InventoryFolderBase folder1
743 = UserInventoryTestUtils.CreateInventoryFolder( 743 = UserInventoryTestUtils.CreateInventoryFolder(
744 scene.InventoryService, ua1.PrincipalID, folder1ExistingName); 744 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
745 745
746 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); 746 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
747 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 747 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
772 List<InventoryFolderBase> folder2PostCandidates 772 List<InventoryFolderBase> folder2PostCandidates
773 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); 773 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
774 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); 774 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
775 } 775 }
776 776
777 /// <summary> 777 /// <summary>
778 /// Test replication of a partly existing archive path to the user's inventory. This should create 778 /// Test replication of a partly existing archive path to the user's inventory. This should create
@@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
792 792
793 InventoryFolderBase folder1 793 InventoryFolderBase folder1
794 = UserInventoryTestUtils.CreateInventoryFolder( 794 = UserInventoryTestUtils.CreateInventoryFolder(
795 scene.InventoryService, ua1.PrincipalID, folder1ExistingName); 795 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
796 796
797 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); 797 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
798 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 798 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
812 List<InventoryFolderBase> folder2PostCandidates 812 List<InventoryFolderBase> folder2PostCandidates
813 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b"); 813 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
814 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); 814 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
815 } 815 }
816 } 816 }
817} \ No newline at end of file 817} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 35b70de..05fe3ee 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
138 { 138 {
139 if (!queues.ContainsKey(agentId)) 139 if (!queues.ContainsKey(agentId))
140 { 140 {
141 /* 141 /*
142 m_log.DebugFormat( 142 m_log.DebugFormat(
143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", 143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
144 agentId, m_scene.RegionInfo.RegionName); 144 agentId, m_scene.RegionInfo.RegionName);
@@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
701 701
702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) 702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
703 { 703 {
704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); 704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
705 Enqueue(item, avatarID); 705 Enqueue(item, avatarID);
706 } 706 }
707 707
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index b62df18..0d7d16a 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
55 } 55 }
56 56
57// private static byte[] uintToByteArray(uint uIntValue) 57// private static byte[] uintToByteArray(uint uIntValue)
58// { 58// {
59// byte[] result = new byte[4]; 59// byte[] result = new byte[4];
60// Utils.UIntToBytesBig(uIntValue, result, 0); 60// Utils.UIntToBytesBig(uIntValue, result, 0);
61// return result; 61// return result;
@@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
386 return placesReply; 386 return placesReply;
387 } 387 }
388 388
389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) 389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
390 { 390 {
391 OSDMap message = new OSDMap(); 391 OSDMap message = new OSDMap();
392 message.Add("message", OSD.FromString("ParcelProperties")); 392 message.Add("message", OSD.FromString("ParcelProperties"));
393 OSD message_body = parcelPropertiesMessage.Serialize(); 393 OSD message_body = parcelPropertiesMessage.Serialize();
394 message.Add("body", message_body); 394 message.Add("body", message_body);
395 return message; 395 return message;
396 } 396 }
397 397
398 } 398 }
399} 399}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 37f6ea0..a2ba498 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -629,7 +629,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
629 rootPart.Name = item.Name; 629 rootPart.Name = item.Name;
630 rootPart.Description = item.Description; 630 rootPart.Description = item.Description;
631 631
632 List<SceneObjectPart> partList = null; 632 List<SceneObjectPart> partList = null;
633 lock (group.Children) 633 lock (group.Children)
634 partList = new List<SceneObjectPart>(group.Children.Values); 634 partList = new List<SceneObjectPart>(group.Children.Values);
635 635
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
index b75a700..a75ff62 100644
--- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
49 protected bool m_collectStats; 49 protected bool m_collectStats;
50 protected Scene m_scene = null; 50 protected Scene m_scene = null;
51 51
52 public string Name { get { return "Binary Statistics Logging Module"; } } 52 public string Name { get { return "Binary Statistics Logging Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 53 public Type ReplaceableInterface { get { return null; } }
54 54
55 public void Initialise(IConfigSource source) 55 public void Initialise(IConfigSource source)
56 { 56 {
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
79 catch 79 catch
80 { 80 {
81 // if it doesn't work, we don't collect anything 81 // if it doesn't work, we don't collect anything
82 } 82 }
83 } 83 }
84 84
85 public void AddRegion(Scene scene) 85 public void AddRegion(Scene scene)
@@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
94 public void RegionLoaded(Scene scene) 94 public void RegionLoaded(Scene scene)
95 { 95 {
96 if (m_collectStats) 96 if (m_collectStats)
97 m_scene.StatsReporter.OnSendStatsResult += LogSimStats; 97 m_scene.StatsReporter.OnSendStatsResult += LogSimStats;
98 } 98 }
99 99
100 public void Close() 100 public void Close()
101 { 101 {
102 } 102 }
103 103
104 public class StatLogger 104 public class StatLogger
105 { 105 {
@@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
164 } 164 }
165 } 165 }
166 return; 166 return;
167 } 167 }
168 } 168 }
169} 169}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 235914a..2f96bcb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
115 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); 115 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
116 116
117 new UserAgentServerConnector(m_Config, MainServer.Instance); 117 new UserAgentServerConnector(m_Config, MainServer.Instance);
118 new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService");
118 } 119 }
119 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); 120 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
120 } 121 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 5b4fecb..39410b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Services.Connectors; 39using OpenSim.Services.Connectors;
40using OpenSim.Services.Connectors.SimianGrid;
40using OpenMetaverse; 41using OpenMetaverse;
41 42
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 43namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
@@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
538 } 539 }
539 else 540 else
540 { 541 {
541 // We're instantiating this class explicitly, but this won't 542 // Still not as flexible as I would like this to be,
542 // work in general, because the remote grid may be running 543 // but good enough for now
543 // an inventory server that has a different protocol. 544 string connectorType = new HeloServicesConnector(url).Helo();
544 // Eventually we will want a piece of protocol asking 545 m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType);
545 // the remote server about its kind. Definitely cool thing to do! 546 if (connectorType == "opensim-simian")
546 connector = new RemoteXInventoryServicesConnector(url); 547 connector = new SimianInventoryServiceConnector(url);
548 else
549 connector = new RemoteXInventoryServicesConnector(url);
547 m_connectors.Add(url, connector); 550 m_connectors.Add(url, connector);
548 } 551 }
549 } 552 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 4e2f602..2322d7c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
185 return folders[type]; 185 return folders[type];
186 } 186 }
187 187
188 m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); 188 m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
189 189
190 return null; 190 return null;
191 } 191 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index cbd9e05..ab6be50 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
220 { 220 {
221// m_log.DebugFormat( 221// m_log.DebugFormat(
222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", 222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
223// item.Name, item.Owner, item.Folder); 223// item.Name, item.Owner, item.Folder);
224 224
225 return m_InventoryService.AddItem(item); 225 return m_InventoryService.AddItem(item);
226 } 226 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 4ab6947..34205e3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
227 public bool AddItem(InventoryItemBase item) 227 public bool AddItem(InventoryItemBase item)
228 { 228 {
229 if (item == null) 229 if (item == null)
230 return false; 230 return false;
231 231
232 return m_RemoteConnector.AddItem(item); 232 return m_RemoteConnector.AddItem(item);
233 } 233 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index fb2edb9..64788db 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
36{ 36{
37 public class UserAccountCache 37 public class UserAccountCache
38 { 38 {
39 private const double CACHE_EXPIRATION_SECONDS = 120.0;
40
39 private static readonly ILog m_log = 41 private static readonly ILog m_log =
40 LogManager.GetLogger( 42 LogManager.GetLogger(
41 MethodBase.GetCurrentMethod().DeclaringType); 43 MethodBase.GetCurrentMethod().DeclaringType);
@@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
51 public void Cache(UUID userID, UserAccount account) 53 public void Cache(UUID userID, UserAccount account)
52 { 54 {
53 // Cache even null accounts 55 // Cache even null accounts
54 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 56 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
55 if (account != null) 57 if (account != null)
56 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 58 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
57 59
58 // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); 60 // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
59 } 61 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
index ddc3dd7..c72acc3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
@@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34 34
35namespace OpenSim.Region.CoreModules.World.Archiver 35namespace OpenSim.Region.CoreModules.World.Archiver
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Helper methods for archive manipulation 38 /// Helper methods for archive manipulation
39 /// </summary> 39 /// </summary>
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
50 public static string CreateObjectFilename(SceneObjectGroup sog) 50 public static string CreateObjectFilename(SceneObjectGroup sog)
51 { 51 {
52 return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); 52 return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
53 } 53 }
54 54
55 /// <summary> 55 /// <summary>
56 /// Create the path used to store an object in an OpenSim Archive. 56 /// Create the path used to store an object in an OpenSim Archive.
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
62 public static string CreateObjectPath(SceneObjectGroup sog) 62 public static string CreateObjectPath(SceneObjectGroup sog)
63 { 63 {
64 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); 64 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
65 } 65 }
66 66
67 /// <summary> 67 /// <summary>
68 /// Resolve path to a working FileStream 68 /// Resolve path to a working FileStream
@@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
123 123
124 // return new BufferedStream(file, (int) response.ContentLength); 124 // return new BufferedStream(file, (int) response.ContentLength);
125 return new BufferedStream(file, 1000000); 125 return new BufferedStream(file, 1000000);
126 } 126 }
127 } 127 }
128} \ No newline at end of file 128} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b25636f..283b33b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
102 { 102 {
103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>(); 103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
104 104
105 List<EntityBase> entities = m_scene.GetEntities(); 105 EntityBase[] entities = m_scene.GetEntities();
106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
107 107
108 /* 108 /*
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 58698ee..3342164 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; 49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; 50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
51using RegionSettings = OpenSim.Framework.RegionSettings;
51 52
52namespace OpenSim.Region.CoreModules.World.Archiver.Tests 53namespace OpenSim.Region.CoreModules.World.Archiver.Tests
53{ 54{
@@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
135 136
136 SceneObjectPart part2 = CreateSceneObjectPart2(); 137 SceneObjectPart part2 = CreateSceneObjectPart2();
137 138
138 AssetNotecard nc = new AssetNotecard("Hello World!"); 139 AssetNotecard nc = new AssetNotecard();
140 nc.BodyText = "Hello World!";
141 nc.Encode();
139 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 142 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
140 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); 143 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
141 AssetBase ncAsset 144 AssetBase ncAsset
@@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
215 public void TestLoadOarV0_2() 218 public void TestLoadOarV0_2()
216 { 219 {
217 TestHelper.InMethod(); 220 TestHelper.InMethod();
218 //log4net.Config.XmlConfigurator.Configure(); 221// log4net.Config.XmlConfigurator.Configure();
219 222
220 MemoryStream archiveWriteStream = new MemoryStream(); 223 MemoryStream archiveWriteStream = new MemoryStream();
221 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 224 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index f62ec1b..5bd72ee 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land
72 #pragma warning restore 0429 72 #pragma warning restore 0429
73 73
74 /// <value> 74 /// <value>
75 /// Local land ids at specified region co-ordinates (region size / 4) 75 /// Local land ids at specified region co-ordinates (region size / 4)
76 /// </value> 76 /// </value>
77 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; 77 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
78 78
79 /// <value> 79 /// <value>
80 /// Land objects keyed by local id 80 /// Land objects keyed by local id
81 /// </value> 81 /// </value>
82 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 82 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
83 83
@@ -94,8 +94,8 @@ namespace OpenSim.Region.CoreModules.World.Land
94 94
95 #region INonSharedRegionModule Members 95 #region INonSharedRegionModule Members
96 96
97 public Type ReplaceableInterface 97 public Type ReplaceableInterface
98 { 98 {
99 get { return null; } 99 get { return null; }
100 } 100 }
101 101
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Land
200 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); 200 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
201 forcedPosition = null; 201 forcedPosition = null;
202 } 202 }
203 //if we are far away, teleport 203 //if we are far away, teleport
204 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) 204 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3)
205 { 205 {
206 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); 206 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
@@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land
329 } 329 }
330 } 330 }
331 331
332
333
334 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) 332 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
335 { 333 {
336 if (m_scene.Permissions.IsGod(avatar.UUID)) return; 334 if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land
344 { 342 {
345 avatar.ControllingClient.SendAlertMessage( 343 avatar.ControllingClient.SendAlertMessage(
346 "You are not allowed on this parcel because the land owner has restricted access."); 344 "You are not allowed on this parcel because the land owner has restricted access.");
347
348 } 345 }
349 346
350 public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) 347 public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
@@ -456,7 +453,7 @@ namespace OpenSim.Region.CoreModules.World.Land
456 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 453 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
457 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) 454 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
458 { 455 {
459 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, 456 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
460 m_scene.RegionInfo.RegionID); 457 m_scene.RegionInfo.RegionID);
461 //They are going under the safety line! 458 //They are going under the safety line!
462 if (!parcel.IsBannedFromLand(clientAvatar.UUID)) 459 if (!parcel.IsBannedFromLand(clientAvatar.UUID))
@@ -660,7 +657,7 @@ namespace OpenSim.Region.CoreModules.World.Land
660 657
661 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) 658 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
662 return null; 659 return null;
663 660
664 try 661 try
665 { 662 {
666 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); 663 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
@@ -675,7 +672,7 @@ namespace OpenSim.Region.CoreModules.World.Land
675 { 672 {
676 return null; 673 return null;
677 } 674 }
678 675
679 lock (m_landList) 676 lock (m_landList)
680 { 677 {
681 // Corner case. If an autoreturn happens during sim startup 678 // Corner case. If an autoreturn happens during sim startup
@@ -695,7 +692,7 @@ namespace OpenSim.Region.CoreModules.World.Land
695 // they happen every time at border crossings 692 // they happen every time at border crossings
696 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 693 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
697 } 694 }
698 695
699 lock (m_landIDList) 696 lock (m_landIDList)
700 { 697 {
701 try 698 try
@@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land
749 746
750 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) 747 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
751 { 748 {
752
753 lock (m_landList) 749 lock (m_landList)
754 { 750 {
755 foreach (LandObject p in m_landList.Values) 751 foreach (LandObject p in m_landList.Values)
@@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land
802 public void EventManagerOnParcelPrimCountUpdate() 798 public void EventManagerOnParcelPrimCountUpdate()
803 { 799 {
804 ResetAllLandPrimCounts(); 800 ResetAllLandPrimCounts();
805 foreach (EntityBase obj in m_scene.Entities) 801 EntityBase[] entities = m_scene.Entities.GetEntities();
802 foreach (EntityBase obj in entities)
806 { 803 {
807 if (obj != null) 804 if (obj != null)
808 { 805 {
@@ -943,7 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land
943 return; 940 return;
944 } 941 }
945 } 942 }
946 943
947 lock (m_landList) 944 lock (m_landList)
948 { 945 {
949 foreach (ILandObject slaveLandObject in selectedLandObjects) 946 foreach (ILandObject slaveLandObject in selectedLandObjects)
@@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1089 temp.Add(currentParcel); 1086 temp.Add(currentParcel);
1090 } 1087 }
1091 } 1088 }
1092
1093 } 1089 }
1094 } 1090 }
1095 1091
@@ -1132,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1132 join(west, south, east, north, remote_client.AgentId); 1128 join(west, south, east, north, remote_client.AgentId);
1133 } 1129 }
1134 1130
1135 public void ClientOnParcelSelectObjects(int local_id, int request_type, 1131 public void ClientOnParcelSelectObjects(int local_id, int request_type,
1136 List<UUID> returnIDs, IClientAPI remote_client) 1132 List<UUID> returnIDs, IClientAPI remote_client)
1137 { 1133 {
1138 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client); 1134 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
@@ -1382,31 +1378,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1382 { 1378 {
1383 return RemoteParcelRequest(request, path, param, agentID, caps); 1379 return RemoteParcelRequest(request, path, param, agentID, caps);
1384 })); 1380 }));
1385 UUID parcelCapID = UUID.Random(); 1381 UUID parcelCapID = UUID.Random();
1386 caps.RegisterHandler("ParcelPropertiesUpdate", 1382 caps.RegisterHandler("ParcelPropertiesUpdate",
1387 new RestStreamHandler("POST", "/CAPS/" + parcelCapID, 1383 new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
1388 delegate(string request, string path, string param, 1384 delegate(string request, string path, string param,
1389 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 1385 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1390 { 1386 {
1391 return ProcessPropertiesUpdate(request, path, param, agentID, caps); 1387 return ProcessPropertiesUpdate(request, path, param, agentID, caps);
1392 })); 1388 }));
1393 } 1389 }
1394 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) 1390 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
1395 { 1391 {
1396 IClientAPI client; 1392 IClientAPI client;
1397 if ( ! m_scene.TryGetClient(agentID, out client) ) { 1393 if (! m_scene.TryGetClient(agentID, out client)) {
1398 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); 1394 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
1399 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1395 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1400 } 1396 }
1401 1397
1402 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); 1398 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
1403 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); 1399 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
1404 1400
1405 properties.Deserialize(args); 1401 properties.Deserialize(args);
1406 1402
1407 LandUpdateArgs land_update = new LandUpdateArgs(); 1403 LandUpdateArgs land_update = new LandUpdateArgs();
1408 int parcelID = properties.LocalID; 1404 int parcelID = properties.LocalID;
1409 land_update.AuthBuyerID = properties.AuthBuyerID; 1405 land_update.AuthBuyerID = properties.AuthBuyerID;
1410 land_update.Category = properties.Category; 1406 land_update.Category = properties.Category;
1411 land_update.Desc = properties.Desc; 1407 land_update.Desc = properties.Desc;
1412 land_update.GroupID = properties.GroupID; 1408 land_update.GroupID = properties.GroupID;
@@ -1423,15 +1419,15 @@ namespace OpenSim.Region.CoreModules.World.Land
1423 land_update.SnapshotID = properties.SnapshotID; 1419 land_update.SnapshotID = properties.SnapshotID;
1424 land_update.UserLocation = properties.UserLocation; 1420 land_update.UserLocation = properties.UserLocation;
1425 land_update.UserLookAt = properties.UserLookAt; 1421 land_update.UserLookAt = properties.UserLookAt;
1426 land_update.MediaDescription = properties.MediaDesc; 1422 land_update.MediaDescription = properties.MediaDesc;
1427 land_update.MediaType = properties.MediaType; 1423 land_update.MediaType = properties.MediaType;
1428 land_update.MediaWidth = properties.MediaWidth; 1424 land_update.MediaWidth = properties.MediaWidth;
1429 land_update.MediaHeight = properties.MediaHeight; 1425 land_update.MediaHeight = properties.MediaHeight;
1430 land_update.MediaLoop = properties.MediaLoop; 1426 land_update.MediaLoop = properties.MediaLoop;
1431 land_update.ObscureMusic = properties.ObscureMusic; 1427 land_update.ObscureMusic = properties.ObscureMusic;
1432 land_update.ObscureMedia = properties.ObscureMedia; 1428 land_update.ObscureMedia = properties.ObscureMedia;
1433 1429
1434 ILandObject land; 1430 ILandObject land;
1435 lock (m_landList) 1431 lock (m_landList)
1436 { 1432 {
1437 m_landList.TryGetValue(parcelID, out land); 1433 m_landList.TryGetValue(parcelID, out land);
@@ -1439,15 +1435,15 @@ namespace OpenSim.Region.CoreModules.World.Land
1439 1435
1440 if (land != null) 1436 if (land != null)
1441 { 1437 {
1442 land.UpdateLandProperties(land_update, client); 1438 land.UpdateLandProperties(land_update, client);
1443 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); 1439 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
1444 } 1440 }
1445 else 1441 else
1446 { 1442 {
1447 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); 1443 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1448 } 1444 }
1449 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1445 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1450 } 1446 }
1451 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the 1447 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1452 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. 1448 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1453 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x 1449 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
@@ -1524,19 +1520,19 @@ namespace OpenSim.Region.CoreModules.World.Land
1524 if (parcelID == UUID.Zero) 1520 if (parcelID == UUID.Zero)
1525 return; 1521 return;
1526 1522
1527 ExtendedLandData data = 1523 ExtendedLandData data =
1528 (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), 1524 (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
1529 delegate(string id) 1525 delegate(string id)
1530 { 1526 {
1531 UUID parcel = UUID.Zero; 1527 UUID parcel = UUID.Zero;
1532 UUID.TryParse(id, out parcel); 1528 UUID.TryParse(id, out parcel);
1533 // assume we've got the parcelID we just computed in RemoteParcelRequest 1529 // assume we've got the parcelID we just computed in RemoteParcelRequest
1534 ExtendedLandData extLandData = new ExtendedLandData(); 1530 ExtendedLandData extLandData = new ExtendedLandData();
1535 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, 1531 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
1536 out extLandData.X, out extLandData.Y); 1532 out extLandData.X, out extLandData.Y);
1537 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", 1533 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
1538 extLandData.RegionHandle, extLandData.X, extLandData.Y); 1534 extLandData.RegionHandle, extLandData.X, extLandData.Y);
1539 1535
1540 // for this region or for somewhere else? 1536 // for this region or for somewhere else?
1541 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) 1537 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
1542 { 1538 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 1b2cabb..bd1dd66 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
229 newData.SnapshotID = args.SnapshotID; 229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation; 230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt; 231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType; 232 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription; 233 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth; 234 newData.MediaWidth = args.MediaWidth;
235 newData.MediaHeight = args.MediaHeight; 235 newData.MediaHeight = args.MediaHeight;
236 newData.MediaLoop = args.MediaLoop; 236 newData.MediaLoop = args.MediaLoop;
237 newData.ObscureMusic = args.ObscureMusic; 237 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia; 238 newData.ObscureMedia = args.ObscureMedia;
239 239
240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
241 241
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 82ad109..7c5d044 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
54{ 54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
56 public class MoapModule : INonSharedRegionModule, IMoapModule 56 public class MoapModule : INonSharedRegionModule, IMoapModule
57 { 57 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 59
60 public string Name { get { return "MoapModule"; } } 60 public string Name { get { return "MoapModule"; } }
61 public Type ReplaceableInterface { get { return null; } } 61 public Type ReplaceableInterface { get { return null; } }
62 62
63 /// <summary> 63 /// <summary>
64 /// Is this module enabled? 64 /// Is this module enabled?
@@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
78 /// <summary> 78 /// <summary>
79 /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. 79 /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
80 /// </summary> 80 /// </summary>
81 protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>(); 81 protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>();
82 82
83 /// <summary> 83 /// <summary>
84 /// Track the ObjectMediaUpdate capabilities given to users keyed by path 84 /// Track the ObjectMediaUpdate capabilities given to users keyed by path
85 /// </summary> 85 /// </summary>
86 protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>(); 86 protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>();
87 87
88 /// <summary> 88 /// <summary>
89 /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate 89 /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
90 /// </summary> 90 /// </summary>
91 protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>(); 91 protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
92 92
93 public void Initialise(IConfigSource configSource) 93 public void Initialise(IConfigSource configSource)
94 { 94 {
@@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
129 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; 129 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
130 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; 130 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
131 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; 131 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
132 } 132 }
133 133
134 public void OnRegisterCaps(UUID agentID, Caps caps) 134 public void OnRegisterCaps(UUID agentID, Caps caps)
135 { 135 {
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
159 caps.RegisterHandler( 159 caps.RegisterHandler(
160 "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); 160 "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
161 } 161 }
162 } 162 }
163 163
164 public void OnDeregisterCaps(UUID agentID, Caps caps) 164 public void OnDeregisterCaps(UUID agentID, Caps caps)
165 { 165 {
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
179 } 179 }
180 180
181 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) 181 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
182 { 182 {
183 if (original.Shape.Media != null) 183 if (original.Shape.Media != null)
184 { 184 {
185 PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); 185 PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList();
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
195 } 195 }
196 196
197 copy.Shape.Media = dupeMedia; 197 copy.Shape.Media = dupeMedia;
198 } 198 }
199 } 199 }
200 200
201 public MediaEntry GetMediaEntry(SceneObjectPart part, int face) 201 public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
@@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
211 me = null; 211 me = null;
212 } 212 }
213 else 213 else
214 { 214 {
215 lock (media) 215 lock (media)
216 me = media[face]; 216 me = media[face];
217 217
218 // TODO: Really need a proper copy constructor down in libopenmetaverse 218 // TODO: Really need a proper copy constructor down in libopenmetaverse
219 if (me != null) 219 if (me != null)
@@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
227 227
228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) 228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
229 { 229 {
230 CheckFaceParam(part, face); 230 CheckFaceParam(part, face);
231 231
232 if (null == part.Shape.Media) 232 if (null == part.Shape.Media)
233 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); 233 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
234 234
235 lock (part.Shape.Media) 235 lock (part.Shape.Media)
236 part.Shape.Media[face] = me; 236 part.Shape.Media[face] = me;
237 237
238 UpdateMediaUrl(part, UUID.Zero); 238 UpdateMediaUrl(part, UUID.Zero);
239 part.ScheduleFullUpdate(); 239 part.ScheduleFullUpdate();
240 part.TriggerScriptChangedEvent(Changed.MEDIA); 240 part.TriggerScriptChangedEvent(Changed.MEDIA);
241 } 241 }
242 242
243 public void ClearMediaEntry(SceneObjectPart part, int face) 243 public void ClearMediaEntry(SceneObjectPart part, int face)
@@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
256 /// <returns></returns> 256 /// <returns></returns>
257 protected string HandleObjectMediaMessage( 257 protected string HandleObjectMediaMessage(
258 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 258 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
259 { 259 {
260// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request); 260// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
261 261
262 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); 262 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
266 if (omm.Request is ObjectMediaRequest) 266 if (omm.Request is ObjectMediaRequest)
267 return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest); 267 return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest);
268 else if (omm.Request is ObjectMediaUpdate) 268 else if (omm.Request is ObjectMediaUpdate)
269 return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); 269 return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
270 270
271 throw new Exception( 271 throw new Exception(
272 string.Format( 272 string.Format(
273 "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", 273 "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}",
274 omm.Request.GetType())); 274 omm.Request.GetType()));
275 } 275 }
276 276
277 /// <summary> 277 /// <summary>
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
279 /// </summary> 279 /// </summary>
280 /// <param name="omr"></param> 280 /// <param name="omr"></param>
281 /// <returns></returns> 281 /// <returns></returns>
282 protected string HandleObjectMediaRequest(ObjectMediaRequest omr) 282 protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
283 { 283 {
284 UUID primId = omr.PrimID; 284 UUID primId = omr.PrimID;
285 285
@@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
318 /// <param name="path">Path on which this request was made</param> 318 /// <param name="path">Path on which this request was made</param>
319 /// <param name="omu">/param> 319 /// <param name="omu">/param>
320 /// <returns></returns> 320 /// <returns></returns>
321 protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) 321 protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
322 { 322 {
323 UUID primId = omu.PrimID; 323 UUID primId = omu.PrimID;
324 324
@@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
330 "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}", 330 "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
331 primId, m_scene.RegionInfo.RegionName); 331 primId, m_scene.RegionInfo.RegionName);
332 return string.Empty; 332 return string.Empty;
333 } 333 }
334 334
335// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); 335// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
336 336
337// for (int i = 0; i < omu.FaceMedia.Length; i++) 337// for (int i = 0; i < omu.FaceMedia.Length; i++)
338// { 338// {
@@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
374 part.Shape.Textures = te; 374 part.Shape.Textures = te;
375// m_log.DebugFormat( 375// m_log.DebugFormat(
376// "[MOAP]: Media flags for face {0} is {1}", 376// "[MOAP]: Media flags for face {0} is {1}",
377// i, part.Shape.Textures.FaceTextures[i].MediaFlags); 377// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
378 } 378 }
379 } 379 }
380 } 380 }
381 else 381 else
382 { 382 {
383 // We need to go through the media textures one at a time to make sure that we have permission 383 // We need to go through the media textures one at a time to make sure that we have permission
384 // to change them 384 // to change them
385 385
386 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get 386 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get
387 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry 387 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
@@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
391 lock (media) 391 lock (media)
392 { 392 {
393 for (int i = 0; i < media.Count; i++) 393 for (int i = 0; i < media.Count; i++)
394 { 394 {
395 if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) 395 if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
396 { 396 {
397 media[i] = omu.FaceMedia[i]; 397 media[i] = omu.FaceMedia[i];
398 398
399 // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal 399 // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal
400 // texture update, so we don't need to worry about clearing MediaFlags here. 400 // texture update, so we don't need to worry about clearing MediaFlags here.
401 if (null == media[i]) 401 if (null == media[i])
402 continue; 402 continue;
403 403
404 Primitive.TextureEntryFace face = te.CreateFace((uint)i); 404 Primitive.TextureEntryFace face = te.CreateFace((uint)i);
405 face.MediaFlags = true; 405 face.MediaFlags = true;
406 406
407 // m_log.DebugFormat( 407 // m_log.DebugFormat(
408 // "[MOAP]: Media flags for face {0} is {1}", 408 // "[MOAP]: Media flags for face {0} is {1}",
@@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
414 414
415 part.Shape.Textures = te; 415 part.Shape.Textures = te;
416 416
417// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) 417// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
418// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); 418// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
419 } 419 }
420 420
421 UpdateMediaUrl(part, agentId); 421 UpdateMediaUrl(part, agentId);
422 422
423 // Arguably, we could avoid sending a full update to the avatar that just changed the texture. 423 // Arguably, we could avoid sending a full update to the avatar that just changed the texture.
424 part.ScheduleFullUpdate(); 424 part.ScheduleFullUpdate();
@@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap
439 /// <returns></returns> 439 /// <returns></returns>
440 protected string HandleObjectMediaNavigateMessage( 440 protected string HandleObjectMediaNavigateMessage(
441 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 441 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
442 { 442 {
443// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request); 443// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
444 444
445 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); 445 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
446 ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage(); 446 ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
447 omn.Deserialize(osd); 447 omn.Deserialize(osd);
448 448
449 UUID primId = omn.PrimID; 449 UUID primId = omn.PrimID;
450 450
451 SceneObjectPart part = m_scene.GetSceneObjectPart(primId); 451 SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
452 452
453 if (null == part) 453 if (null == part)
454 { 454 {
@@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
456 "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}", 456 "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}",
457 primId, m_scene.RegionInfo.RegionName); 457 primId, m_scene.RegionInfo.RegionName);
458 return string.Empty; 458 return string.Empty;
459 } 459 }
460 460
461 UUID agentId = default(UUID); 461 UUID agentId = default(UUID);
462 462
463 lock (m_omuCapUsers) 463 lock (m_omuCapUsers)
464 agentId = m_omuCapUsers[path]; 464 agentId = m_omuCapUsers[path];
465 465
466 if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face)) 466 if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
467 return string.Empty; 467 return string.Empty;
@@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
484 return string.Empty; 484 return string.Empty;
485 485
486 if (me.EnableWhiteList) 486 if (me.EnableWhiteList)
487 { 487 {
488 if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList)) 488 if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList))
489 { 489 {
490// m_log.DebugFormat( 490// m_log.DebugFormat(
@@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
493 493
494 return string.Empty; 494 return string.Empty;
495 } 495 }
496 } 496 }
497 497
498 me.CurrentURL = omn.URL; 498 me.CurrentURL = omn.URL;
499 499
500 UpdateMediaUrl(part, agentId); 500 UpdateMediaUrl(part, agentId);
501 501
502 part.ScheduleFullUpdate(); 502 part.ScheduleFullUpdate();
503 503
504 part.TriggerScriptChangedEvent(Changed.MEDIA); 504 part.TriggerScriptChangedEvent(Changed.MEDIA);
505 505
506 return OSDParser.SerializeLLSDXmlString(new OSD()); 506 return OSDParser.SerializeLLSDXmlString(new OSD());
507 } 507 }
508 508
509 /// <summary> 509 /// <summary>
510 /// Check that the face number is valid for the given prim. 510 /// Check that the face number is valid for the given prim.
@@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
519 int maxFaces = part.GetNumberOfSides() - 1; 519 int maxFaces = part.GetNumberOfSides() - 1;
520 if (face > maxFaces) 520 if (face > maxFaces)
521 throw new ArgumentException( 521 throw new ArgumentException(
522 string.Format("Face argument was {0} but max is {1}", face, maxFaces)); 522 string.Format("Face argument was {0} but max is {1}", face, maxFaces));
523 } 523 }
524 524
525 /// <summary> 525 /// <summary>
@@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
542 string rawVersion = part.MediaUrl.Substring(5, 10); 542 string rawVersion = part.MediaUrl.Substring(5, 10);
543 int version = int.Parse(rawVersion); 543 int version = int.Parse(rawVersion);
544 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId); 544 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId);
545 } 545 }
546 546
547// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); 547// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
548 } 548 }
549 549
550 /// <summary> 550 /// <summary>
@@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
554 /// <param name="whitelist"></param> 554 /// <param name="whitelist"></param>
555 /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns> 555 /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns>
556 protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) 556 protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
557 { 557 {
558 Uri url = new Uri(rawUrl); 558 Uri url = new Uri(rawUrl);
559 559
560 foreach (string origWlUrl in whitelist) 560 foreach (string origWlUrl in whitelist)
@@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
575 if (url.Host.Contains(wlUrl)) 575 if (url.Host.Contains(wlUrl))
576 { 576 {
577// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl); 577// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
578 return true; 578 return true;
579 } 579 }
580 } 580 }
581 else 581 else
@@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
588 return true; 588 return true;
589 } 589 }
590 } 590 }
591 } 591 }
592 592
593 return false; 593 return false;
594 } 594 }
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 12750c5..db50339 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
49 protected Scene m_scene = null; 49 protected Scene m_scene = null;
50 protected IDialogModule m_dialogModule; 50 protected IDialogModule m_dialogModule;
51 51
52 public string Name { get { return "Object BuySell Module"; } } 52 public string Name { get { return "Object BuySell Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 53 public Type ReplaceableInterface { get { return null; } }
54 54
55 public void Initialise(IConfigSource source) {} 55 public void Initialise(IConfigSource source) {}
56 56
@@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
78 78
79 public void SubscribeToClientEvents(IClientAPI client) 79 public void SubscribeToClientEvents(IClientAPI client)
80 { 80 {
81 client.OnObjectSaleInfo += ObjectSaleInfo; 81 client.OnObjectSaleInfo += ObjectSaleInfo;
82 } 82 }
83 83
84 protected void ObjectSaleInfo( 84 protected void ObjectSaleInfo(
85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) 85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
99 part.ParentGroup.HasGroupChanged = true; 99 part.ParentGroup.HasGroupChanged = true;
100 100
101 part.GetProperties(client); 101 part.GetProperties(client);
102 } 102 }
103 103
104 public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) 104 public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType)
105 { 105 {
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
225 } 225 }
226 else 226 else
227 { 227 {
228 if (m_dialogModule != null) 228 if (m_dialogModule != null)
229 m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); 229 m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
230 return false; 230 return false;
231 } 231 }
@@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
261 } 261 }
262 262
263 return true; 263 return true;
264 } 264 }
265 } 265 }
266} \ No newline at end of file 266} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b1747ef..ecfd211 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
397 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); 397 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
398 398
399 if (m_groupsModule == null) 399 if (m_groupsModule == null)
400 m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); 400 m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
401 401
402 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); 402 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
403 403
404 // This log line will be commented out when no longer required for debugging 404 // This log line will be commented out when no longer required for debugging
405// if (m_moapModule == null) 405// if (m_moapModule == null)
406// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); 406// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
407 } 407 }
408 408
409 public void Close() 409 public void Close()
@@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1906 } 1906 }
1907 1907
1908 private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) 1908 private bool CanControlPrimMedia(UUID agentID, UUID primID, int face)
1909 { 1909 {
1910// m_log.DebugFormat( 1910// m_log.DebugFormat(
1911// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", 1911// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
1912// agentID, primID, face); 1912// agentID, primID, face);
@@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1918 if (null == part) 1918 if (null == part)
1919 return false; 1919 return false;
1920 1920
1921 MediaEntry me = m_moapModule.GetMediaEntry(part, face); 1921 MediaEntry me = m_moapModule.GetMediaEntry(part, face);
1922 1922
1923 // If there is no existing media entry then it can be controlled (in this context, created). 1923 // If there is no existing media entry then it can be controlled (in this context, created).
1924 if (null == me) 1924 if (null == me)
@@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1929// agentID, primID, face, me.ControlPermissions); 1929// agentID, primID, face, me.ControlPermissions);
1930 1930
1931 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); 1931 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
1932 } 1932 }
1933 1933
1934 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) 1934 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
1935 { 1935 {
@@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1952 1952
1953// m_log.DebugFormat( 1953// m_log.DebugFormat(
1954// "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}", 1954// "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}",
1955// agentID, primID, face, me.InteractPermissions); 1955// agentID, primID, face, me.InteractPermissions);
1956 1956
1957 return GenericPrimMediaPermission(part, agentID, me.InteractPermissions); 1957 return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
1958 } 1958 }
1959 1959
1960 private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) 1960 private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
1961 { 1961 {
1962// if (IsAdministrator(agentID)) 1962// if (IsAdministrator(agentID))
1963// return true; 1963// return true;
1964 1964
1965 if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone) 1965 if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone)
1966 return true; 1966 return true;
@@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1969 { 1969 {
1970 if (agentID == part.OwnerID) 1970 if (agentID == part.OwnerID)
1971 return true; 1971 return true;
1972 } 1972 }
1973 1973
1974 if ((perms & MediaPermission.Group) == MediaPermission.Group) 1974 if ((perms & MediaPermission.Group) == MediaPermission.Group)
1975 { 1975 {
1976 if (IsGroupMember(part.GroupID, agentID, 0)) 1976 if (IsGroupMember(part.GroupID, agentID, 0))
1977 return true; 1977 return true;
1978 } 1978 }
1979 1979
1980 return false; 1980 return false;
1981 } 1981 }
1982 } 1982 }
1983} \ No newline at end of file 1983} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
index bef7fe4..5067ebd 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
80 { 80 {
81 string xmlstream = "<scene>"; 81 string xmlstream = "<scene>";
82 82
83 List<EntityBase> EntityList = scene.GetEntities(); 83 EntityBase[] EntityList = scene.GetEntities();
84 List<string> EntityXml = new List<string>(); 84 List<string> EntityXml = new List<string>();
85 85
86 foreach (EntityBase ent in EntityList) 86 foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index 58e4261..98fe493 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
165 return SceneXmlLoader.SaveGroupToXml2(grp); 165 return SceneXmlLoader.SaveGroupToXml2(grp);
166 } 166 }
167 167
168 public void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 168 public void SavePrimListToXml2(EntityBase[] entityList, string fileName)
169 { 169 {
170 SceneXmlLoader.SavePrimListToXml2(entityList, fileName); 170 SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
171 } 171 }
172 172
173 public void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) 173 public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
174 { 174 {
175 SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); 175 SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max);
176 } 176 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index d4166d0..4611352 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
816 { 816 {
817 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); 817 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
818 client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); 818 client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised());
819 } 819 }
820 820
821 private void StoreUndoState() 821 private void StoreUndoState()
822 { 822 {
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 9736b73..6bac555 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
425 { 425 {
426 if (m_ready) 426 if (m_ready)
427 { 427 {
428 if(m_scene.GetRootAgentCount() > 0) 428 if (m_scene.GetRootAgentCount() > 0)
429 { 429 {
430 // Ask wind plugin to generate a LL wind array to be cached locally 430 // Ask wind plugin to generate a LL wind array to be cached locally
431 // Try not to update this too often, as it may involve array copies 431 // Try not to update this too often, as it may involve array copies
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 57eff8a..1bd1371 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
212 double[,] hm = whichScene.Heightmap.GetDoubles(); 212 double[,] hm = whichScene.Heightmap.GetDoubles();
213 tc = Environment.TickCount; 213 tc = Environment.TickCount;
214 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); 214 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
215 List<EntityBase> objs = whichScene.GetEntities(); 215 EntityBase[] objs = whichScene.GetEntities();
216 Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); 216 Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
217 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); 217 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
218 List<float> z_sortheights = new List<float>(); 218 List<float> z_sortheights = new List<float>();
@@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
228 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 228 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
229 Color mapdotspot = Color.Gray; // Default color when prim color is white 229 Color mapdotspot = Color.Gray; // Default color when prim color is white
230 230
231 // Loop over prim in group 231 // Loop over prim in group
232 List<SceneObjectPart> partList = null; 232 List<SceneObjectPart> partList = null;
233 lock (mapdot.Children) 233 lock (mapdot.Children)
234 partList = new List<SceneObjectPart>(mapdot.Children.Values); 234 partList = new List<SceneObjectPart>(mapdot.Children.Values);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f036d85..fbc8a50 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
307 lock (m_rootAgents) 307 lock (m_rootAgents)
308 { 308 {
309 m_rootAgents.Remove(AgentId); 309 m_rootAgents.Remove(AgentId);
310 if(m_rootAgents.Count == 0) 310 if (m_rootAgents.Count == 0)
311 StopThread(); 311 StopThread();
312 } 312 }
313 } 313 }