aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorCharles Krinke2008-05-27 14:36:23 +0000
committerCharles Krinke2008-05-27 14:36:23 +0000
commite2e692c5832143b9338b7d73f095bf6c753a3a94 (patch)
tree9aa6accd7beab079585d037c5086c578bc4605f1 /OpenSim
parent* Implement asynchronous assets request for archiving (diff)
downloadopensim-SC-e2e692c5832143b9338b7d73f095bf6c753a3a94.zip
opensim-SC-e2e692c5832143b9338b7d73f095bf6c753a3a94.tar.gz
opensim-SC-e2e692c5832143b9338b7d73f095bf6c753a3a94.tar.bz2
opensim-SC-e2e692c5832143b9338b7d73f095bf6c753a3a94.tar.xz
Thank you kindly, Melanie for a patch that adds:
GetSerializationData() and CreateFromData() methods
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Interfaces/IWorldComm.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs71
2 files changed, 75 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
index c471e7f..c2a55eb 100644
--- a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
@@ -25,6 +25,7 @@
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 27
28using System;
28using libsecondlife; 29using libsecondlife;
29using OpenSim.Framework; 30using OpenSim.Framework;
30using OpenSim.Region.Environment.Modules.Scripting.WorldComm; 31using OpenSim.Region.Environment.Modules.Scripting.WorldComm;
@@ -40,5 +41,8 @@ namespace OpenSim.Region.Environment.Interfaces
40 void ListenControl(LLUUID itemID, int handle, int active); 41 void ListenControl(LLUUID itemID, int handle, int active);
41 void ListenRemove(LLUUID itemID, int handle); 42 void ListenRemove(LLUUID itemID, int handle);
42 void DeleteListener(LLUUID itemID); 43 void DeleteListener(LLUUID itemID);
44 Object[] GetSerializationData(LLUUID itemID);
45 void CreateFromData(uint localID, LLUUID itemID, LLUUID hostID,
46 Object[] data);
43 } 47 }
44} 48}
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
index 4ed0fb5..3294049 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
@@ -330,6 +330,17 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
330 e.Sender.AgentId, 330 e.Sender.AgentId,
331 e.Message); 331 e.Message);
332 } 332 }
333
334 public Object[] GetSerializationData(LLUUID itemID)
335 {
336 return m_listenerManager.GetSerializationData(itemID);
337 }
338
339 public void CreateFromData(uint localID, LLUUID itemID, LLUUID hostID,
340 Object[] data)
341 {
342 m_listenerManager.AddFromData(localID, itemID, hostID, data);
343 }
333 } 344 }
334 345
335 public class ListenerManager 346 public class ListenerManager
@@ -549,6 +560,42 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
549 } 560 }
550 return collection; 561 return collection;
551 } 562 }
563
564 public Object[] GetSerializationData(LLUUID itemID)
565 {
566 List<Object> data = new List<Object>();
567
568 foreach (List<ListenerInfo> list in m_listeners.Values)
569 {
570 foreach (ListenerInfo l in list)
571 {
572 if(l.GetItemID() == itemID)
573 data.AddRange(l.GetSerializationData());
574 }
575 }
576 return (Object[])data.ToArray();
577 }
578
579 public void AddFromData(uint localID, LLUUID itemID, LLUUID hostID,
580 Object[] data)
581 {
582 int idx = 0;
583 Object[] item = new Object[6];
584
585 while(idx < data.Length)
586 {
587 Array.Copy(data, idx, item, 0, 6);
588
589 ListenerInfo info =
590 ListenerInfo.FromData(localID, itemID, hostID, item);
591
592 if(!m_listeners.ContainsKey((int)item[2]))
593 m_listeners.Add((int)item[2], new List<ListenerInfo>());
594 m_listeners[(int)item[2]].Add(info);
595
596 idx+=6;
597 }
598 }
552 } 599 }
553 600
554 public class ListenerInfo 601 public class ListenerInfo
@@ -587,6 +634,30 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
587 m_message = message; 634 m_message = message;
588 } 635 }
589 636
637 public Object[] GetSerializationData()
638 {
639 Object[] data = new Object[6];
640
641 data[0] = m_active;
642 data[1] = m_handle;
643 data[2] = m_channel;
644 data[3] = m_name;
645 data[4] = m_id;
646 data[5] = m_message;
647
648 return data;
649 }
650
651 public static ListenerInfo FromData(uint localID, LLUUID ItemID, LLUUID hostID, Object[] data)
652 {
653 ListenerInfo linfo = new ListenerInfo((int)data[1], localID,
654 ItemID, hostID, (int)data[2], (string)data[3],
655 (LLUUID)data[4], (string)data[5]);
656 linfo.m_active=(bool)data[0];
657
658 return linfo;
659 }
660
590 public LLUUID GetItemID() 661 public LLUUID GetItemID()
591 { 662 {
592 return m_itemID; 663 return m_itemID;