diff options
author | Melanie Thielker | 2008-08-19 02:12:40 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-19 02:12:40 +0000 |
commit | 6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611 (patch) | |
tree | 349f4db157d3776b5f8491ba230f5400b27551a4 /OpenSim/Framework | |
parent | * If two regions have configuration information that conflicts (save xy locat... (diff) | |
download | opensim-SC_OLD-6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611.zip opensim-SC_OLD-6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611.tar.gz opensim-SC_OLD-6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611.tar.bz2 opensim-SC_OLD-6d2e1ad6ba73fb0eba51b3885ff0a4d7d1b5d611.tar.xz |
Attachment persistence!!! Patch #9169 (Mantis #1171)
Attachments now save to MySQL. No reattach on login yet.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 67 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/IAvatarService.cs | 5 |
2 files changed, 61 insertions, 11 deletions
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 | } |