aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-30 21:41:44 +0100
committerJustin Clark-Casey (justincc)2010-07-30 21:41:44 +0100
commit424b4b2b8663f0f6780d2d3a2656e5b298418711 (patch)
treef608b701dc73df59161a0585a65c297b9c069bc4 /OpenSim
parentremove unused BasicQuadTreeNode (diff)
downloadopensim-SC-424b4b2b8663f0f6780d2d3a2656e5b298418711.zip
opensim-SC-424b4b2b8663f0f6780d2d3a2656e5b298418711.tar.gz
opensim-SC-424b4b2b8663f0f6780d2d3a2656e5b298418711.tar.bz2
opensim-SC-424b4b2b8663f0f6780d2d3a2656e5b298418711.tar.xz
move attachment subscription events into AttachmentsModule from scene.
restored to some heavy casting in order to preserve RegionCombinerModule semantics, pending better events.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs36
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs7
3 files changed, 28 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 1187e91..d895bb1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -56,11 +56,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
56 { 56 {
57 m_scene = scene; 57 m_scene = scene;
58 m_scene.RegisterModuleInterface<IAttachmentsModule>(this); 58 m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
59 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
60 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
59 } 61 }
60 62
61 public void RemoveRegion(Scene scene) 63 public void RemoveRegion(Scene scene)
62 { 64 {
63 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); 65 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
66 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
64 } 67 }
65 68
66 public void RegionLoaded(Scene scene) {} 69 public void RegionLoaded(Scene scene) {}
@@ -69,7 +72,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
69 { 72 {
70 RemoveRegion(m_scene); 73 RemoveRegion(m_scene);
71 } 74 }
72 75
76 public void SubscribeToClientEvents(IClientAPI client)
77 {
78 client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory;
79 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
80 client.OnObjectAttach += AttachObject;
81 client.OnObjectDetach += DetachObject;
82 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
83 }
84
85 public void UnsubscribeFromClientEvents(IClientAPI client)
86 {
87 client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory;
88 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
89 client.OnObjectAttach -= AttachObject;
90 client.OnObjectDetach -= DetachObject;
91 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
92 }
93
73 /// <summary> 94 /// <summary>
74 /// Called by client 95 /// Called by client
75 /// </summary> 96 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9141d44..088d210 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2783,17 +2783,12 @@ namespace OpenSim.Region.Framework.Scenes
2783 SubscribeToClientPrimEvents(client); 2783 SubscribeToClientPrimEvents(client);
2784 SubscribeToClientPrimRezEvents(client); 2784 SubscribeToClientPrimRezEvents(client);
2785 SubscribeToClientInventoryEvents(client); 2785 SubscribeToClientInventoryEvents(client);
2786 SubscribeToClientAttachmentEvents(client);
2787 SubscribeToClientTeleportEvents(client); 2786 SubscribeToClientTeleportEvents(client);
2788 SubscribeToClientScriptEvents(client); 2787 SubscribeToClientScriptEvents(client);
2789 SubscribeToClientParcelEvents(client); 2788 SubscribeToClientParcelEvents(client);
2790 SubscribeToClientGridEvents(client); 2789 SubscribeToClientGridEvents(client);
2791 SubscribeToClientGodEvents(client); 2790 SubscribeToClientGodEvents(client);
2792
2793 SubscribeToClientNetworkEvents(client); 2791 SubscribeToClientNetworkEvents(client);
2794
2795
2796 // EventManager.TriggerOnNewClient(client);
2797 } 2792 }
2798 2793
2799 public virtual void SubscribeToClientTerrainEvents(IClientAPI client) 2794 public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
@@ -2874,18 +2869,6 @@ namespace OpenSim.Region.Framework.Scenes
2874 client.OnMoveTaskItem += ClientMoveTaskInventoryItem; 2869 client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
2875 } 2870 }
2876 2871
2877 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2878 {
2879 if (AttachmentsModule != null)
2880 {
2881 client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
2882 client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
2883 client.OnObjectAttach += AttachmentsModule.AttachObject;
2884 client.OnObjectDetach += AttachmentsModule.DetachObject;
2885 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
2886 }
2887 }
2888
2889 public virtual void SubscribeToClientTeleportEvents(IClientAPI client) 2872 public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
2890 { 2873 {
2891 client.OnTeleportLocationRequest += RequestTeleportLocation; 2874 client.OnTeleportLocationRequest += RequestTeleportLocation;
@@ -2934,16 +2917,15 @@ namespace OpenSim.Region.Framework.Scenes
2934 } 2917 }
2935 2918
2936 /// <summary> 2919 /// <summary>
2937 /// Register for events from the client 2920 /// Unsubscribe the client from events.
2938 /// </summary> 2921 /// </summary>
2939 /// <param name="client">The IClientAPI of the connected client</param> 2922 /// <param name="client">The IClientAPI of the client</param>
2940 public virtual void UnSubscribeToClientEvents(IClientAPI client) 2923 public virtual void UnSubscribeToClientEvents(IClientAPI client)
2941 { 2924 {
2942 UnSubscribeToClientTerrainEvents(client); 2925 UnSubscribeToClientTerrainEvents(client);
2943 UnSubscribeToClientPrimEvents(client); 2926 UnSubscribeToClientPrimEvents(client);
2944 UnSubscribeToClientPrimRezEvents(client); 2927 UnSubscribeToClientPrimRezEvents(client);
2945 UnSubscribeToClientInventoryEvents(client); 2928 UnSubscribeToClientInventoryEvents(client);
2946 UnSubscribeToClientAttachmentEvents(client);
2947 UnSubscribeToClientTeleportEvents(client); 2929 UnSubscribeToClientTeleportEvents(client);
2948 UnSubscribeToClientScriptEvents(client); 2930 UnSubscribeToClientScriptEvents(client);
2949 UnSubscribeToClientParcelEvents(client); 2931 UnSubscribeToClientParcelEvents(client);
@@ -2951,8 +2933,6 @@ namespace OpenSim.Region.Framework.Scenes
2951 UnSubscribeToClientGodEvents(client); 2933 UnSubscribeToClientGodEvents(client);
2952 2934
2953 UnSubscribeToClientNetworkEvents(client); 2935 UnSubscribeToClientNetworkEvents(client);
2954
2955 // EventManager.TriggerOnNewClient(client);
2956 } 2936 }
2957 2937
2958 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) 2938 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
@@ -3029,18 +3009,6 @@ namespace OpenSim.Region.Framework.Scenes
3029 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem; 3009 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem;
3030 } 3010 }
3031 3011
3032 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
3033 {
3034 if (AttachmentsModule != null)
3035 {
3036 client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
3037 client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
3038 client.OnObjectAttach -= AttachmentsModule.AttachObject;
3039 client.OnObjectDetach -= AttachmentsModule.DetachObject;
3040 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
3041 }
3042 }
3043
3044 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) 3012 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
3045 { 3013 {
3046 client.OnTeleportLocationRequest -= RequestTeleportLocation; 3014 client.OnTeleportLocationRequest -= RequestTeleportLocation;
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
index 9d41c9c..62410e2 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
@@ -28,11 +28,12 @@
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.CoreModules.Avatar.Attachments;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
32 33
33namespace OpenSim.Region.RegionCombinerModule 34namespace OpenSim.Region.RegionCombinerModule
34{ 35{
35 public class RegionCombinerIndividualEventForwarder 36 public class RegionCombinerIndividualEventForwarder
36 { 37 {
37 private Scene m_rootScene; 38 private Scene m_rootScene;
38 private Scene m_virtScene; 39 private Scene m_virtScene;
@@ -48,7 +49,7 @@ namespace OpenSim.Region.RegionCombinerModule
48 m_virtScene.UnSubscribeToClientPrimEvents(client); 49 m_virtScene.UnSubscribeToClientPrimEvents(client);
49 m_virtScene.UnSubscribeToClientPrimRezEvents(client); 50 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
50 m_virtScene.UnSubscribeToClientInventoryEvents(client); 51 m_virtScene.UnSubscribeToClientInventoryEvents(client);
51 m_virtScene.UnSubscribeToClientAttachmentEvents(client); 52 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
52 //m_virtScene.UnSubscribeToClientTeleportEvents(client); 53 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
53 m_virtScene.UnSubscribeToClientScriptEvents(client); 54 m_virtScene.UnSubscribeToClientScriptEvents(client);
54 m_virtScene.UnSubscribeToClientGodEvents(client); 55 m_virtScene.UnSubscribeToClientGodEvents(client);
@@ -58,7 +59,7 @@ namespace OpenSim.Region.RegionCombinerModule
58 client.OnAddPrim += LocalAddNewPrim; 59 client.OnAddPrim += LocalAddNewPrim;
59 client.OnRezObject += LocalRezObject; 60 client.OnRezObject += LocalRezObject;
60 m_rootScene.SubscribeToClientInventoryEvents(client); 61 m_rootScene.SubscribeToClientInventoryEvents(client);
61 m_rootScene.SubscribeToClientAttachmentEvents(client); 62 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
62 //m_rootScene.SubscribeToClientTeleportEvents(client); 63 //m_rootScene.SubscribeToClientTeleportEvents(client);
63 m_rootScene.SubscribeToClientScriptEvents(client); 64 m_rootScene.SubscribeToClientScriptEvents(client);
64 m_rootScene.SubscribeToClientGodEvents(client); 65 m_rootScene.SubscribeToClientGodEvents(client);