aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-23 22:36:20 +0100
committerJustin Clark-Casey (justincc)2011-09-23 22:36:20 +0100
commit8c4dd6b3302a142c6ac7578cc5012049c51610ed (patch)
tree75540bc841ed9588479c64d2cffd116130afd928 /OpenSim/Region/CoreModules/Avatar
parentUse a copy of the inventory items list to register users in the thread starte... (diff)
parentremove unused SOP.Create() method (diff)
downloadopensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.zip
opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.tar.gz
opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.tar.bz2
opensim-SC_OLD-8c4dd6b3302a142c6ac7578cc5012049c51610ed.tar.xz
Merge branch 'master' into 0.7.2-post-fixes
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs462
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs32
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs16
5 files changed, 331 insertions, 215 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 996e2ab..b965d75 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -143,20 +143,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
143 143
144 public void SaveChangedAttachments(IScenePresence sp) 144 public void SaveChangedAttachments(IScenePresence sp)
145 { 145 {
146// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
147
146 foreach (SceneObjectGroup grp in sp.GetAttachments()) 148 foreach (SceneObjectGroup grp in sp.GetAttachments())
147 { 149 {
148 if (grp.HasGroupChanged) // Resizer scripts? 150// if (grp.HasGroupChanged) // Resizer scripts?
149 { 151// {
150 grp.IsAttachment = false; 152 grp.IsAttachment = false;
151 grp.AbsolutePosition = grp.RootPart.AttachedPos; 153 grp.AbsolutePosition = grp.RootPart.AttachedPos;
152 UpdateKnownItem(sp.ControllingClient, grp, grp.GetFromItemID(), grp.OwnerID); 154 UpdateKnownItem(sp.ControllingClient, grp);
153 grp.IsAttachment = true; 155 grp.IsAttachment = true;
154 } 156// }
155 } 157 }
156 } 158 }
157 159
158 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) 160 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
159 { 161 {
162// m_log.DebugFormat(
163// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
164// m_scene.RegionInfo.RegionName, sp.Name, silent);
165
160 foreach (SceneObjectGroup sop in sp.GetAttachments()) 166 foreach (SceneObjectGroup sop in sp.GetAttachments())
161 { 167 {
162 sop.Scene.DeleteSceneObject(sop, silent); 168 sop.Scene.DeleteSceneObject(sop, silent);
@@ -212,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
212 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); 218 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
213 219
214 // Save avatar attachment information 220 // Save avatar attachment information
215 m_log.Info( 221 m_log.Debug(
216 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 222 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
217 + ", AttachmentPoint: " + AttachmentPt); 223 + ", AttachmentPoint: " + AttachmentPt);
218 224
@@ -240,80 +246,83 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
240 246
241 private bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) 247 private bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent)
242 { 248 {
243// m_log.DebugFormat( 249 lock (sp.AttachmentsSyncLock)
244// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
245// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
246
247 if (sp.GetAttachments(attachmentPt).Contains(group))
248 {
249// m_log.WarnFormat(
250// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
251// group.Name, group.LocalId, sp.Name, AttachmentPt);
252
253 return false;
254 }
255
256 Vector3 attachPos = group.AbsolutePosition;
257
258 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
259 // be removed when that functionality is implemented in opensim
260 attachmentPt &= 0x7f;
261
262 // If the attachment point isn't the same as the one previously used
263 // set it's offset position = 0 so that it appears on the attachment point
264 // and not in a weird location somewhere unknown.
265 if (attachmentPt != 0 && attachmentPt != group.AttachmentPoint)
266 {
267 attachPos = Vector3.Zero;
268 }
269
270 // AttachmentPt 0 means the client chose to 'wear' the attachment.
271 if (attachmentPt == 0)
272 {
273 // Check object for stored attachment point
274 attachmentPt = group.AttachmentPoint;
275 }
276
277 // if we still didn't find a suitable attachment point.......
278 if (attachmentPt == 0)
279 {
280 // Stick it on left hand with Zero Offset from the attachment point.
281 attachmentPt = (uint)AttachmentPoint.LeftHand;
282 attachPos = Vector3.Zero;
283 }
284
285 group.AttachmentPoint = attachmentPt;
286 group.AbsolutePosition = attachPos;
287
288 // We also don't want to do any of the inventory operations for an NPC.
289 if (sp.PresenceType != PresenceType.Npc)
290 { 250 {
291 // Remove any previous attachments 251// m_log.DebugFormat(
292 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); 252// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
293 253// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
294 // At the moment we can only deal with a single attachment 254
295 if (attachments.Count != 0) 255 if (sp.GetAttachments(attachmentPt).Contains(group))
296 { 256 {
297 UUID oldAttachmentItemID = attachments[0].GetFromItemID(); 257 // m_log.WarnFormat(
258 // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
259 // group.Name, group.LocalId, sp.Name, AttachmentPt);
298 260
299 if (oldAttachmentItemID != UUID.Zero) 261 return false;
300 DetachSingleAttachmentToInv(oldAttachmentItemID, sp);
301 else
302 m_log.WarnFormat(
303 "[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!",
304 attachments[0].Name, attachments[0].LocalId, attachmentPt, group.Name, group.LocalId, sp.Name);
305 } 262 }
306
307 // Add the new attachment to inventory if we don't already have it.
308 UUID newAttachmentItemID = group.GetFromItemID();
309 if (newAttachmentItemID == UUID.Zero)
310 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp.ControllingClient, group).ID;
311 263
312 ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group); 264 Vector3 attachPos = group.AbsolutePosition;
265
266 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
267 // be removed when that functionality is implemented in opensim
268 attachmentPt &= 0x7f;
269
270 // If the attachment point isn't the same as the one previously used
271 // set it's offset position = 0 so that it appears on the attachment point
272 // and not in a weird location somewhere unknown.
273 if (attachmentPt != 0 && attachmentPt != group.AttachmentPoint)
274 {
275 attachPos = Vector3.Zero;
276 }
277
278 // AttachmentPt 0 means the client chose to 'wear' the attachment.
279 if (attachmentPt == 0)
280 {
281 // Check object for stored attachment point
282 attachmentPt = group.AttachmentPoint;
283 }
284
285 // if we still didn't find a suitable attachment point.......
286 if (attachmentPt == 0)
287 {
288 // Stick it on left hand with Zero Offset from the attachment point.
289 attachmentPt = (uint)AttachmentPoint.LeftHand;
290 attachPos = Vector3.Zero;
291 }
292
293 group.AttachmentPoint = attachmentPt;
294 group.AbsolutePosition = attachPos;
295
296 // We also don't want to do any of the inventory operations for an NPC.
297 if (sp.PresenceType != PresenceType.Npc)
298 {
299 // Remove any previous attachments
300 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
301
302 // At the moment we can only deal with a single attachment
303 if (attachments.Count != 0)
304 {
305 UUID oldAttachmentItemID = attachments[0].GetFromItemID();
306
307 if (oldAttachmentItemID != UUID.Zero)
308 DetachSingleAttachmentToInv(oldAttachmentItemID, sp);
309 else
310 m_log.WarnFormat(
311 "[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!",
312 attachments[0].Name, attachments[0].LocalId, attachmentPt, group.Name, group.LocalId, sp.Name);
313 }
314
315 // Add the new attachment to inventory if we don't already have it.
316 UUID newAttachmentItemID = group.GetFromItemID();
317 if (newAttachmentItemID == UUID.Zero)
318 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp.ControllingClient, group).ID;
319
320 ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group);
321 }
322
323 AttachToAgent(sp, group, attachmentPt, attachPos, silent);
313 } 324 }
314 325
315 AttachToAgent(sp, group, attachmentPt, attachPos, silent);
316
317 return true; 326 return true;
318 } 327 }
319 328
@@ -322,17 +331,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
322 RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 331 RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
323 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) 332 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
324 { 333 {
325 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) 334 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
335
336 if (sp == null)
326 { 337 {
327 RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt); 338 m_log.ErrorFormat(
339 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezMultipleAttachmentsFromInventory()",
340 remoteClient.Name, remoteClient.AgentId);
341 return;
342 }
343
344 lock (sp.AttachmentsSyncLock)
345 {
346// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
347
348 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
349 {
350 RezSingleAttachmentFromInventory(sp, obj.ItemID, obj.AttachmentPt);
351 }
328 } 352 }
329 } 353 }
330 354
331 public ISceneEntity RezSingleAttachmentFromInventory( 355 public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
332 IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
333 { 356 {
334// m_log.DebugFormat( 357// m_log.DebugFormat(
335// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", 358// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}",
336// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); 359// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name);
337 360
338 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 361 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
@@ -344,11 +367,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
344 remoteClient.Name, remoteClient.AgentId); 367 remoteClient.Name, remoteClient.AgentId);
345 return null; 368 return null;
346 } 369 }
347 370
371 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt);
372 }
373
374 public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt)
375 {
376// m_log.DebugFormat(
377// "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}",
378// (AttachmentPoint)AttachmentPt, itemID, sp.Name);
379
348 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 380 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
349 // be removed when that functionality is implemented in opensim 381 // be removed when that functionality is implemented in opensim
350 AttachmentPt &= 0x7f; 382 AttachmentPt &= 0x7f;
351 383
384 // Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such).
385 // This often happens during login - not sure the exact reason.
386 // For now, we will ignore the request. Unfortunately, this means that we need to dig through all the
387 // ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login
388 // before anything has actually been attached.
389 bool alreadyOn = false;
390 List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
391 foreach (SceneObjectGroup so in existingAttachments)
392 {
393 if (so.GetFromItemID() == itemID)
394 {
395 alreadyOn = true;
396 break;
397 }
398 }
399
400// if (sp.Appearance.GetAttachmentForItem(itemID) != null)
401 if (alreadyOn)
402 {
403// m_log.WarnFormat(
404// "[ATTACHMENTS MODULE]: Ignoring request by {0} to wear item {1} at {2} since it is already worn",
405// sp.Name, itemID, AttachmentPt);
406
407 return null;
408 }
409
352 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt); 410 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt);
353 411
354 if (att == null) 412 if (att == null)
@@ -363,65 +421,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
363 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); 421 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
364 if (invAccess != null) 422 if (invAccess != null)
365 { 423 {
366 SceneObjectGroup objatt; 424 lock (sp.AttachmentsSyncLock)
367
368 if (itemID != UUID.Zero)
369 objatt = invAccess.RezObject(sp.ControllingClient,
370 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
371 false, false, sp.UUID, true);
372 else
373 objatt = invAccess.RezObject(sp.ControllingClient,
374 null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
375 false, false, sp.UUID, true);
376
377// m_log.DebugFormat(
378// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
379// objatt.Name, remoteClient.Name, AttachmentPt);
380
381 if (objatt != null)
382 { 425 {
383 // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. 426 SceneObjectGroup objatt;
384 objatt.HasGroupChanged = false; 427
385 bool tainted = false; 428 if (itemID != UUID.Zero)
386 if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) 429 objatt = invAccess.RezObject(sp.ControllingClient,
387 tainted = true; 430 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
388 431 false, false, sp.UUID, true);
389 // This will throw if the attachment fails 432 else
390 try 433 objatt = invAccess.RezObject(sp.ControllingClient,
434 null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
435 false, false, sp.UUID, true);
436
437 // m_log.DebugFormat(
438 // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
439 // objatt.Name, remoteClient.Name, AttachmentPt);
440
441 if (objatt != null)
391 { 442 {
392 AttachObject(sp, objatt, attachmentPt, false); 443 // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller.
444 objatt.HasGroupChanged = false;
445 bool tainted = false;
446 if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)
447 tainted = true;
448
449 // This will throw if the attachment fails
450 try
451 {
452 AttachObject(sp, objatt, attachmentPt, false);
453 }
454 catch (Exception e)
455 {
456 m_log.ErrorFormat(
457 "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
458 objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);
459
460 // Make sure the object doesn't stick around and bail
461 sp.RemoveAttachment(objatt);
462 m_scene.DeleteSceneObject(objatt, false);
463 return null;
464 }
465
466 if (tainted)
467 objatt.HasGroupChanged = true;
468
469 // Fire after attach, so we don't get messy perms dialogs
470 // 4 == AttachedRez
471 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
472 objatt.ResumeScripts();
473
474 // Do this last so that event listeners have access to all the effects of the attachment
475 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
476
477 return objatt;
393 } 478 }
394 catch (Exception e) 479 else
395 { 480 {
396 m_log.ErrorFormat( 481 m_log.WarnFormat(
397 "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", 482 "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
398 objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); 483 itemID, sp.Name, attachmentPt);
399
400 // Make sure the object doesn't stick around and bail
401 sp.RemoveAttachment(objatt);
402 m_scene.DeleteSceneObject(objatt, false);
403 return null;
404 } 484 }
405
406 if (tainted)
407 objatt.HasGroupChanged = true;
408
409 // Fire after attach, so we don't get messy perms dialogs
410 // 4 == AttachedRez
411 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
412 objatt.ResumeScripts();
413
414 // Do this last so that event listeners have access to all the effects of the attachment
415 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
416 }
417 else
418 {
419 m_log.WarnFormat(
420 "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
421 itemID, sp.Name, attachmentPt);
422 } 485 }
423
424 return objatt;
425 } 486 }
426 487
427 return null; 488 return null;
@@ -438,8 +499,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
438 IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) 499 IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
439 { 500 {
440// m_log.DebugFormat( 501// m_log.DebugFormat(
441// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", 502// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
442// att.Name, remoteClient.Name, AttachmentPt, itemID); 503// att.Name, sp.Name, AttachmentPt, itemID);
443 504
444 if (UUID.Zero == itemID) 505 if (UUID.Zero == itemID)
445 { 506 {
@@ -462,6 +523,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
462 523
463 public void DetachObject(uint objectLocalID, IClientAPI remoteClient) 524 public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
464 { 525 {
526// m_log.DebugFormat(
527// "[ATTACHMENTS MODULE]: DetachObject() for object {0} on {1}", objectLocalID, remoteClient.Name);
528
465 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); 529 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
466 if (group != null) 530 if (group != null)
467 { 531 {
@@ -474,14 +538,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
474 ScenePresence presence; 538 ScenePresence presence;
475 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 539 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
476 { 540 {
477 // Save avatar attachment information 541 lock (presence.AttachmentsSyncLock)
478 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); 542 {
479 543 // Save avatar attachment information
480 bool changed = presence.Appearance.DetachAttachment(itemID); 544 m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID);
481 if (changed && m_scene.AvatarFactory != null)
482 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
483 545
484 DetachSingleAttachmentToInv(itemID, presence); 546 bool changed = presence.Appearance.DetachAttachment(itemID);
547 if (changed && m_scene.AvatarFactory != null)
548 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
549
550 DetachSingleAttachmentToInv(itemID, presence);
551 }
485 } 552 }
486 } 553 }
487 554
@@ -489,7 +556,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
489 { 556 {
490// m_log.DebugFormat( 557// m_log.DebugFormat(
491// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", 558// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
492// remoteClient.Name, sceneObjectID); 559// remoteClient.Name, soLocalId);
493 560
494 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId); 561 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
495 562
@@ -508,24 +575,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
508 ScenePresence presence; 575 ScenePresence presence;
509 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 576 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
510 { 577 {
511 if (!m_scene.Permissions.CanRezObject( 578 lock (presence.AttachmentsSyncLock)
512 so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) 579 {
513 return; 580 if (!m_scene.Permissions.CanRezObject(
581 so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
582 return;
514 583
515 bool changed = presence.Appearance.DetachAttachment(inventoryID); 584 bool changed = presence.Appearance.DetachAttachment(inventoryID);
516 if (changed && m_scene.AvatarFactory != null) 585 if (changed && m_scene.AvatarFactory != null)
517 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 586 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
518 587
519 presence.RemoveAttachment(so); 588 presence.RemoveAttachment(so);
520 DetachSceneObjectToGround(so, presence); 589 DetachSceneObjectToGround(so, presence);
521 590
522 List<UUID> uuids = new List<UUID>(); 591 List<UUID> uuids = new List<UUID>();
523 uuids.Add(inventoryID); 592 uuids.Add(inventoryID);
524 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids); 593 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
525 remoteClient.SendRemoveInventoryItem(inventoryID); 594 remoteClient.SendRemoveInventoryItem(inventoryID);
526 } 595 }
527 596
528 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); 597 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
598 }
529 } 599 }
530 600
531 /// <summary> 601 /// <summary>
@@ -559,6 +629,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
559 // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? 629 // To LocalId or UUID, *THAT* is the question. How now Brown UUID??
560 private void DetachSingleAttachmentToInv(UUID itemID, IScenePresence sp) 630 private void DetachSingleAttachmentToInv(UUID itemID, IScenePresence sp)
561 { 631 {
632// m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name);
633
562 if (itemID == UUID.Zero) // If this happened, someone made a mistake.... 634 if (itemID == UUID.Zero) // If this happened, someone made a mistake....
563 return; 635 return;
564 636
@@ -567,37 +639,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
567 EntityBase[] detachEntities = m_scene.GetEntities(); 639 EntityBase[] detachEntities = m_scene.GetEntities();
568 SceneObjectGroup group; 640 SceneObjectGroup group;
569 641
570 foreach (EntityBase entity in detachEntities) 642 lock (sp.AttachmentsSyncLock)
571 { 643 {
572 if (entity is SceneObjectGroup) 644 foreach (EntityBase entity in detachEntities)
573 { 645 {
574 group = (SceneObjectGroup)entity; 646 if (entity is SceneObjectGroup)
575 if (group.GetFromItemID() == itemID)
576 { 647 {
577 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 648 group = (SceneObjectGroup)entity;
578 sp.RemoveAttachment(group); 649 if (group.GetFromItemID() == itemID)
579 650 {
580 // Prepare sog for storage 651 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
581 group.AttachedAvatar = UUID.Zero; 652 sp.RemoveAttachment(group);
582 653
583 group.ForEachPart( 654 // Prepare sog for storage
584 delegate(SceneObjectPart part) 655 group.AttachedAvatar = UUID.Zero;
585 { 656 group.RootPart.SetParentLocalId(0);
586 // If there are any scripts, 657 group.IsAttachment = false;
587 // then always trigger a new object and state persistence in UpdateKnownItem() 658 group.AbsolutePosition = group.RootPart.AttachedPos;
588 if (part.Inventory.ContainsScripts()) 659
589 group.HasGroupChanged = true; 660 UpdateKnownItem(sp.ControllingClient, group);
590 } 661 m_scene.DeleteSceneObject(group, false);
591 ); 662
592 663 return;
593 group.RootPart.SetParentLocalId(0); 664 }
594 group.IsAttachment = false;
595 group.AbsolutePosition = group.RootPart.AttachedPos;
596
597 UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID);
598 m_scene.DeleteSceneObject(group, false);
599
600 return;
601 } 665 }
602 } 666 }
603 } 667 }
@@ -628,28 +692,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
628 /// </remarks> 692 /// </remarks>
629 /// <param name="remoteClient"></param> 693 /// <param name="remoteClient"></param>
630 /// <param name="grp"></param> 694 /// <param name="grp"></param>
631 /// <param name="itemID"></param> 695 private void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp)
632 /// <param name="agentID"></param>
633 public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
634 { 696 {
635 if (grp != null) 697 if (grp.HasGroupChanged || grp.ContainsScripts())
636 { 698 {
637 if (!grp.HasGroupChanged)
638 {
639 m_log.DebugFormat(
640 "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
641 grp.UUID, grp.AttachmentPoint);
642
643 return;
644 }
645
646 m_log.DebugFormat( 699 m_log.DebugFormat(
647 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", 700 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
648 grp.UUID, grp.AttachmentPoint); 701 grp.UUID, grp.AttachmentPoint);
649 702
650 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); 703 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
651 704
652 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 705 InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), remoteClient.AgentId);
653 item = m_scene.InventoryService.GetItem(item); 706 item = m_scene.InventoryService.GetItem(item);
654 707
655 if (item != null) 708 if (item != null)
@@ -675,6 +728,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
675 remoteClient.SendInventoryItemCreateUpdate(item, 0); 728 remoteClient.SendInventoryItemCreateUpdate(item, 0);
676 } 729 }
677 } 730 }
731 else
732 {
733 m_log.DebugFormat(
734 "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
735 grp.UUID, grp.AttachmentPoint);
736 }
678 } 737 }
679 738
680 /// <summary> 739 /// <summary>
@@ -692,7 +751,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
692 private void AttachToAgent( 751 private void AttachToAgent(
693 IScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) 752 IScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
694 { 753 {
695// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", 754// m_log.DebugFormat(
755// "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
696// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); 756// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
697 757
698 so.DetachFromBackup(); 758 so.DetachFromBackup();
@@ -745,7 +805,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
745 /// <returns>The user inventory item created that holds the attachment.</returns> 805 /// <returns>The user inventory item created that holds the attachment.</returns>
746 private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IClientAPI remoteClient, SceneObjectGroup grp) 806 private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IClientAPI remoteClient, SceneObjectGroup grp)
747 { 807 {
748// m_log.DebugFormat("[SCENE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2} {3} {4}", grp.Name, grp.LocalId, remoteClient.Name, remoteClient.AgentId, AgentId); 808// m_log.DebugFormat(
809// "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
810// grp.Name, grp.LocalId, remoteClient.Name);
749 811
750 Vector3 inventoryStoredPosition = new Vector3 812 Vector3 inventoryStoredPosition = new Vector3
751 (((grp.AbsolutePosition.X > (int)Constants.RegionSize) 813 (((grp.AbsolutePosition.X > (int)Constants.RegionSize)
@@ -829,4 +891,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
829 return item; 891 return item;
830 } 892 }
831 } 893 }
832} 894} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 35183b3..ff3358f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -220,6 +220,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
220 Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0)); 220 Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0));
221 } 221 }
222 222
223 /// <summary>
224 /// Test that attachments don't hang about in the scene when the agent is closed
225 /// </summary>
226 [Test]
227 public void TestRemoveAttachmentsOnAvatarExit()
228 {
229 TestHelpers.InMethod();
230// log4net.Config.XmlConfigurator.Configure();
231
232 UUID userId = TestHelpers.ParseTail(0x1);
233 UUID attItemId = TestHelpers.ParseTail(0x2);
234 UUID attAssetId = TestHelpers.ParseTail(0x3);
235 string attName = "att";
236
237 UserAccountHelpers.CreateUserWithInventory(scene, userId);
238 InventoryItemBase attItem
239 = UserInventoryHelpers.CreateInventoryItem(
240 scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
241
242 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
243 acd.Appearance = new AvatarAppearance();
244 acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
245 ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
246
247 SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
248
249 scene.IncomingCloseAgent(presence.UUID);
250
251 // Check that we can't retrieve this attachment from the scene.
252 Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
253 }
254
223 [Test] 255 [Test]
224 public void TestRezAttachmentsOnAvatarEntrance() 256 public void TestRezAttachmentsOnAvatarEntrance()
225 { 257 {
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index b6a1564..0cadd83 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -211,8 +211,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
211 // Process the visual params, this may change height as well 211 // Process the visual params, this may change height as well
212 if (visualParams != null) 212 if (visualParams != null)
213 { 213 {
214// string[] visualParamsStrings = new string[visualParams.Length];
215// for (int i = 0; i < visualParams.Length; i++)
216// visualParamsStrings[i] = visualParams[i].ToString();
217// m_log.DebugFormat(
218// "[AVFACTORY]: Setting visual params for {0} to {1}",
219// client.Name, string.Join(", ", visualParamsStrings));
220
221 float oldHeight = sp.Appearance.AvatarHeight;
214 changed = sp.Appearance.SetVisualParams(visualParams); 222 changed = sp.Appearance.SetVisualParams(visualParams);
215 if (sp.Appearance.AvatarHeight > 0) 223
224 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0)
216 sp.SetHeight(sp.Appearance.AvatarHeight); 225 sp.SetHeight(sp.Appearance.AvatarHeight);
217 } 226 }
218 227
@@ -416,6 +425,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
416 425
417 // m_log.WarnFormat("[AVFACTORY] avatar {0} save appearance",agentid); 426 // m_log.WarnFormat("[AVFACTORY] avatar {0} save appearance",agentid);
418 427
428 // This could take awhile since it needs to pull inventory
429 // We need to do it at the point of save so that there is a sufficient delay for any upload of new body part/shape
430 // assets and item asset id changes to complete.
431 // I don't think we need to worry about doing this within m_setAppearanceLock since the queueing avoids
432 // multiple save requests.
433 SetAppearanceAssets(sp.UUID, sp.Appearance);
434
419 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); 435 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
420 } 436 }
421 437
@@ -467,7 +483,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
467 return; 483 return;
468 } 484 }
469 485
470 // m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId); 486// m_log.DebugFormat("[AVFACTORY]: Received request for wearables of {0}", client.Name);
471 487
472 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 488 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
473 } 489 }
@@ -502,9 +518,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
502 518
503 avatAppearance.GetAssetsFrom(sp.Appearance); 519 avatAppearance.GetAssetsFrom(sp.Appearance);
504 520
505 // This could take awhile since it needs to pull inventory
506 SetAppearanceAssets(sp.UUID, ref avatAppearance);
507
508 lock (m_setAppearanceLock) 521 lock (m_setAppearanceLock)
509 { 522 {
510 // Update only those fields that we have changed. This is important because the viewer 523 // Update only those fields that we have changed. This is important because the viewer
@@ -538,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
538 return true; 551 return true;
539 } 552 }
540 553
541 private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) 554 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
542 { 555 {
543 IInventoryService invService = m_scene.InventoryService; 556 IInventoryService invService = m_scene.InventoryService;
544 557
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 7753c25..d294692 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -24,6 +24,7 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
27using System; 28using System;
28using System.Collections; 29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
@@ -145,14 +146,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
145 scene.Entities[toAgentID] is ScenePresence) 146 scene.Entities[toAgentID] is ScenePresence)
146 { 147 {
147// m_log.DebugFormat( 148// m_log.DebugFormat(
148// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", 149// "[HG INSTANT MESSAGE]: Looking for root agent {0} in {1}",
149// toAgentID.ToString(), scene.RegionInfo.RegionName); 150// toAgentID.ToString(), scene.RegionInfo.RegionName);
150 151
151 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 152 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
152 if (!user.IsChildAgent) 153 if (!user.IsChildAgent)
153 { 154 {
154 // Local message 155 // Local message
155// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); 156// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
156 user.ControllingClient.SendInstantMessage(im); 157 user.ControllingClient.SendInstantMessage(im);
157 158
158 // Message sent 159 // Message sent
@@ -166,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
166 foreach (Scene scene in m_Scenes) 167 foreach (Scene scene in m_Scenes)
167 { 168 {
168// m_log.DebugFormat( 169// m_log.DebugFormat(
169// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); 170// "[HG INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
170 171
171 if (scene.Entities.ContainsKey(toAgentID) && 172 if (scene.Entities.ContainsKey(toAgentID) &&
172 scene.Entities[toAgentID] is ScenePresence) 173 scene.Entities[toAgentID] is ScenePresence)
@@ -174,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
174 // Local message 175 // Local message
175 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 176 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
176 177
177// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); 178// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
178 user.ControllingClient.SendInstantMessage(im); 179 user.ControllingClient.SendInstantMessage(im);
179 180
180 // Message sent 181 // Message sent
@@ -183,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
183 } 184 }
184 } 185 }
185 186
186// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 187// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
187 // Is the user a local user? 188 // Is the user a local user?
188 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID); 189 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
189 string url = string.Empty; 190 string url = string.Empty;
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs
index d687e6a..bc5c1ff 100644
--- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs
@@ -154,14 +154,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
154 if (im.dialog == (byte)InstantMessageDialog.RequestTeleport) 154 if (im.dialog == (byte)InstantMessageDialog.RequestTeleport)
155 { 155 {
156 UUID sessionID = new UUID(im.imSessionID); 156 UUID sessionID = new UUID(im.imSessionID);
157 m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", im.imSessionID, im.RegionID, im.message); 157
158 m_PendingLures.Add(sessionID, im, 7200); // 2 hours 158 if (!m_PendingLures.Contains(sessionID))
159 {
160 m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", im.imSessionID, im.RegionID, im.message);
161 m_PendingLures.Add(sessionID, im, 7200); // 2 hours
162 }
159 163
160 // Forward. We do this, because the IM module explicitly rejects 164 // Forward. We do this, because the IM module explicitly rejects
161 // IMs of this type 165 // IMs of this type
162 if (m_TransferModule != null) 166 if (m_TransferModule != null)
163 m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); 167 m_TransferModule.SendInstantMessage(im, delegate(bool success) { });
164
165 } 168 }
166 } 169 }
167 170
@@ -177,12 +180,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
177 180
178 m_log.DebugFormat("[HG LURE MODULE]: TP invite with message {0}", message); 181 m_log.DebugFormat("[HG LURE MODULE]: TP invite with message {0}", message);
179 182
183 UUID sessionID = UUID.Random();
184
180 GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, 185 GridInstantMessage m = new GridInstantMessage(scene, client.AgentId,
181 client.FirstName+" "+client.LastName, targetid, 186 client.FirstName+" "+client.LastName, targetid,
182 (byte)InstantMessageDialog.RequestTeleport, false, 187 (byte)InstantMessageDialog.RequestTeleport, false,
183 message, UUID.Random(), false, presence.AbsolutePosition, 188 message, sessionID, false, presence.AbsolutePosition,
184 new Byte[0]); 189 new Byte[0]);
185 m.RegionID = client.Scene.RegionInfo.RegionID.Guid; 190 m.RegionID = client.Scene.RegionInfo.RegionID.Guid;
191
192 m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message);
193 m_PendingLures.Add(sessionID, m, 7200); // 2 hours
186 194
187 if (m_TransferModule != null) 195 if (m_TransferModule != null)
188 { 196 {