aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLManager.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs9
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs67
-rw-r--r--OpenSim/Framework/Communications/IAvatarService.cs5
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs43
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs5
8 files changed, 120 insertions, 37 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs
index 9f50c9f..b857aad 100644
--- a/OpenSim/Data/MySQL/MySQLManager.cs
+++ b/OpenSim/Data/MySQL/MySQLManager.cs
@@ -1208,7 +1208,10 @@ namespace OpenSim.Data.MySQL
1208 1208
1209 cmd.ExecuteNonQuery(); 1209 cmd.ExecuteNonQuery();
1210 1210
1211 sql = "insert into avatarattachments (UUID, attachpoint, item, asset) values (?uuid, ?attchpoint, ?item, ?asset)"; 1211 if (data == null)
1212 return;
1213
1214 sql = "insert into avatarattachments (UUID, attachpoint, item, asset) values (?uuid, ?attachpoint, ?item, ?asset)";
1212 1215
1213 cmd = (MySqlCommand) dbcon.CreateCommand(); 1216 cmd = (MySqlCommand) dbcon.CreateCommand();
1214 cmd.CommandText = sql; 1217 cmd.CommandText = sql;
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 1ae5645..82ca5b1 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -834,14 +834,15 @@ namespace OpenSim.Data.MySQL
834 834
835 IDataReader r = cmd.ExecuteReader(); 835 IDataReader r = cmd.ExecuteReader();
836 836
837 return database.readAttachments(r); 837 Hashtable ret = database.readAttachments(r);
838
839 r.Close();
840
841 return ret;
838 } 842 }
839 843
840 public void UpdateUserAttachments(LLUUID agentID, Hashtable data) 844 public void UpdateUserAttachments(LLUUID agentID, Hashtable data)
841 { 845 {
842 if(data == null)
843 return;
844
845 database.writeAttachments(agentID, data); 846 database.writeAttachments(agentID, data);
846 } 847 }
847 } 848 }
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 1c086d5..67e26b1 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -362,8 +362,8 @@ namespace OpenSim.Framework
362 h["skirt_item"] = SkirtItem.ToString(); 362 h["skirt_item"] = SkirtItem.ToString();
363 h["skirt_asset"] = SkirtAsset.ToString(); 363 h["skirt_asset"] = SkirtAsset.ToString();
364 364
365 Hashtable attachments = GetAttachments(); 365 string attachments = GetAttachmentsString();
366 if(attachments != null) 366 if(attachments != String.Empty)
367 h["attachments"] = attachments; 367 h["attachments"] = attachments;
368 368
369 return h; 369 return h;
@@ -413,8 +413,7 @@ namespace OpenSim.Framework
413 413
414 if(h.ContainsKey("attachments")) 414 if(h.ContainsKey("attachments"))
415 { 415 {
416 Hashtable attachments = (Hashtable) h["attachments"]; 416 SetAttachmentsString(h["attachments"].ToString());
417 SetAttachments(attachments);
418 } 417 }
419 } 418 }
420 419
@@ -510,9 +509,12 @@ namespace OpenSim.Framework
510 return m_attachments[attachpoint][1]; 509 return m_attachments[attachpoint][1];
511 } 510 }
512 511
513 public void AddAttachment(int attachpoint, LLUUID item, LLUUID asset) 512 public void SetAttachment(int attachpoint, LLUUID item, LLUUID asset)
514 { 513 {
515 if (item == LLUUID.Zero || asset == LLUUID.Zero) 514 if(attachpoint == 0)
515 return;
516
517 if (item == LLUUID.Zero)
516 { 518 {
517 if (m_attachments.ContainsKey(attachpoint)) 519 if (m_attachments.ContainsKey(attachpoint))
518 m_attachments.Remove(attachpoint); 520 m_attachments.Remove(attachpoint);
@@ -525,5 +527,58 @@ namespace OpenSim.Framework
525 m_attachments[attachpoint][0] = item; 527 m_attachments[attachpoint][0] = item;
526 m_attachments[attachpoint][1] = asset; 528 m_attachments[attachpoint][1] = asset;
527 } 529 }
530
531 public void DetachAttachment(LLUUID itemID)
532 {
533 int attachpoint = 0;
534
535 foreach (KeyValuePair<int, LLUUID[]> kvp in m_attachments)
536 {
537 if(kvp.Value[0] == itemID)
538 {
539 attachpoint = kvp.Key;
540 break;
541 }
542 }
543
544 if(attachpoint > 0)
545 m_attachments.Remove(attachpoint);
546 }
547 string GetAttachmentsString()
548 {
549 List<string> strings = new List<string>();
550
551 foreach (KeyValuePair<int, LLUUID[]> e in m_attachments)
552 {
553 strings.Add(e.Key.ToString());
554 strings.Add(e.Value[0].ToString());
555 strings.Add(e.Value[1].ToString());
556 }
557
558 return String.Join(",", strings.ToArray());
559 }
560
561 void SetAttachmentsString(string data)
562 {
563 string[] strings = data.Split(new char[] {','});
564 int i = 0;
565
566 m_attachments.Clear();
567
568 while (strings.Length - i > 2)
569 {
570 int attachpoint = Int32.Parse(strings[i]);
571 LLUUID item = new LLUUID(strings[i+1]);
572 LLUUID asset = new LLUUID(strings[i+2]);
573 i += 3;
574
575 if (!m_attachments.ContainsKey(attachpoint))
576 {
577 m_attachments[attachpoint] = new LLUUID[2];
578 m_attachments[attachpoint][0] = item;
579 m_attachments[attachpoint][1] = asset;
580 }
581 }
582 }
528 } 583 }
529} 584}
diff --git a/OpenSim/Framework/Communications/IAvatarService.cs b/OpenSim/Framework/Communications/IAvatarService.cs
index 0e4a349..6c033e1 100644
--- a/OpenSim/Framework/Communications/IAvatarService.cs
+++ b/OpenSim/Framework/Communications/IAvatarService.cs
@@ -39,10 +39,5 @@ namespace OpenSim.Framework.Communications
39 39
40 void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); 40 void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
41 41
42 void AddAttachment(LLUUID user, LLUUID attach);
43
44 void RemoveAttachment(LLUUID user, LLUUID attach);
45
46 List<LLUUID> GetAttachments(LLUUID user);
47 } 42 }
48} 43}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 1d86646..2223aeb 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -776,21 +776,5 @@ namespace OpenSim.Region.Communications.OGS1
776 // Return Empty list (no friends) 776 // Return Empty list (no friends)
777 } 777 }
778 } 778 }
779
780 public void AddAttachment(LLUUID user, LLUUID item)
781 {
782 return;
783 }
784
785 public void RemoveAttachment(LLUUID user, LLUUID item)
786 {
787 return;
788 }
789
790 public List<LLUUID> GetAttachments(LLUUID user)
791 {
792 return new List<LLUUID>();
793 }
794
795 } 779 }
796} 780}
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 6695dbf..b98f2d6 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -380,7 +380,7 @@ namespace OpenSim.Region.Environment.Scenes
380 SceneObjectGroup group = (SceneObjectGroup)obj; 380 SceneObjectGroup group = (SceneObjectGroup)obj;
381 381
382 //group.DetachToGround(); 382 //group.DetachToGround();
383 DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient); 383 m_parentScene.DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient);
384 } 384 }
385 } 385 }
386 } 386 }
@@ -432,7 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
432 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); 432 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero);
433 } 433 }
434 434
435 protected internal void RezSingleAttachment( 435 public SceneObjectGroup RezSingleAttachment(
436 IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask) 436 IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask)
437 { 437 {
438 SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, 438 SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true,
@@ -446,11 +446,12 @@ namespace OpenSim.Region.Environment.Scenes
446 AttachObject(remoteClient,objatt.LocalId,AttachmentPt,new LLQuaternion(0,0,0,1),objatt.AbsolutePosition); 446 AttachObject(remoteClient,objatt.LocalId,AttachmentPt,new LLQuaternion(0,0,0,1),objatt.AbsolutePosition);
447 objatt.ScheduleGroupForFullUpdate(); 447 objatt.ScheduleGroupForFullUpdate();
448 } 448 }
449 return objatt;
449 } 450 }
450 451
451 // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards. 452 // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards.
452 // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID?? 453 // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID??
453 protected internal void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) 454 public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
454 { 455 {
455 if (itemID == LLUUID.Zero) // If this happened, someone made a mistake.... 456 if (itemID == LLUUID.Zero) // If this happened, someone made a mistake....
456 return; 457 return;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 0148d76..784d04c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -2316,5 +2316,48 @@ namespace OpenSim.Region.Environment.Scenes
2316// 2316//
2317// imod.TestFunction(); 2317// imod.TestFunction();
2318// } 2318// }
2319
2320 public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID,
2321 uint AttachmentPt, uint ItemFlags, uint NextOwnerMask)
2322 {
2323 SceneObjectGroup att = m_innerScene.RezSingleAttachment(remoteClient, itemID, AttachmentPt, ItemFlags, NextOwnerMask);
2324
2325 if (att == null)
2326 {
2327 DetachSingleAttachmentToInv(itemID, remoteClient);
2328 return;
2329 }
2330
2331 if (att.RootPart != null)
2332 AttachmentPt = att.RootPart.AttachmentPoint;
2333
2334 ScenePresence presence;
2335 if(TryGetAvatar(remoteClient.AgentId, out presence))
2336 {
2337 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.GetFromAssetID());
2338 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
2339 if(ava != null)
2340 {
2341 ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
2342 }
2343
2344 }
2345 }
2346
2347 public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
2348 {
2349 ScenePresence presence;
2350 if(TryGetAvatar(remoteClient.AgentId, out presence))
2351 {
2352 presence.Appearance.DetachAttachment(itemID);
2353 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
2354 if(ava != null)
2355 {
2356 ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
2357 }
2358
2359 }
2360 m_innerScene.DetachSingleAttachmentToInv(itemID, remoteClient);
2361 }
2319 } 2362 }
2320} 2363}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 474f062..4564cf1 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2109,8 +2109,8 @@ namespace OpenSim.Region.Environment.Scenes
2109 client.OnGrabUpdate += m_innerScene.MoveObject; 2109 client.OnGrabUpdate += m_innerScene.MoveObject;
2110 client.OnDeRezObject += DeRezObject; 2110 client.OnDeRezObject += DeRezObject;
2111 client.OnRezObject += RezObject; 2111 client.OnRezObject += RezObject;
2112 client.OnRezSingleAttachmentFromInv += m_innerScene.RezSingleAttachment; 2112 client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
2113 client.OnDetachAttachmentIntoInv += m_innerScene.DetachSingleAttachmentToInv; 2113 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
2114 client.OnObjectAttach += m_innerScene.AttachObject; 2114 client.OnObjectAttach += m_innerScene.AttachObject;
2115 client.OnObjectDetach += m_innerScene.DetachObject; 2115 client.OnObjectDetach += m_innerScene.DetachObject;
2116 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; 2116 client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
@@ -3859,5 +3859,6 @@ namespace OpenSim.Region.Environment.Scenes
3859 //Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); 3859 //Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
3860 client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); 3860 client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised());
3861 } 3861 }
3862
3862 } 3863 }
3863} 3864}