diff options
author | Justin Clark-Casey (justincc) | 2010-07-14 00:16:37 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-14 00:16:37 +0100 |
commit | e44e1ccbd32745e25ecf750a6bd0e212e4dfd535 (patch) | |
tree | cdf43968110885a6b4c617179110bf5c8f844001 | |
parent | implement serverside checks for media texture navigation in order to stop nau... (diff) | |
download | opensim-SC_OLD-e44e1ccbd32745e25ecf750a6bd0e212e4dfd535.zip opensim-SC_OLD-e44e1ccbd32745e25ecf750a6bd0e212e4dfd535.tar.gz opensim-SC_OLD-e44e1ccbd32745e25ecf750a6bd0e212e4dfd535.tar.bz2 opensim-SC_OLD-e44e1ccbd32745e25ecf750a6bd0e212e4dfd535.tar.xz |
implement code to deregister users on DeregisterCaps
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 09786ec..ce4e921 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -64,15 +64,25 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
64 | protected Scene m_scene; | 64 | protected Scene m_scene; |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Track the ObjectMedia capabilities given to users | 67 | /// Track the ObjectMedia capabilities given to users keyed by path |
68 | /// </summary> | 68 | /// </summary> |
69 | protected Dictionary<string, UUID> m_omCapUsers = new Dictionary<string, UUID>(); | 69 | protected Dictionary<string, UUID> m_omCapUsers = new Dictionary<string, UUID>(); |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Track the ObjectMediaUpdate capabilities given to users | 72 | /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. |
73 | /// </summary> | ||
74 | protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>(); | ||
75 | |||
76 | /// <summary> | ||
77 | /// Track the ObjectMediaUpdate capabilities given to users keyed by path | ||
73 | /// </summary> | 78 | /// </summary> |
74 | protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>(); | 79 | protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>(); |
75 | 80 | ||
81 | /// <summary> | ||
82 | /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate | ||
83 | /// </summary> | ||
84 | protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>(); | ||
85 | |||
76 | public void Initialise(IConfigSource config) | 86 | public void Initialise(IConfigSource config) |
77 | { | 87 | { |
78 | // TODO: Add config switches to enable/disable this module | 88 | // TODO: Add config switches to enable/disable this module |
@@ -88,11 +98,13 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
88 | public void RegionLoaded(Scene scene) | 98 | public void RegionLoaded(Scene scene) |
89 | { | 99 | { |
90 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 100 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
101 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; | ||
91 | } | 102 | } |
92 | 103 | ||
93 | public void Close() | 104 | public void Close() |
94 | { | 105 | { |
95 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 106 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; |
107 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; | ||
96 | } | 108 | } |
97 | 109 | ||
98 | public void RegisterCaps(UUID agentID, Caps caps) | 110 | public void RegisterCaps(UUID agentID, Caps caps) |
@@ -105,6 +117,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
105 | lock (m_omCapUsers) | 117 | lock (m_omCapUsers) |
106 | { | 118 | { |
107 | m_omCapUsers[omCapUrl] = agentID; | 119 | m_omCapUsers[omCapUrl] = agentID; |
120 | m_omCapUrls[agentID] = omCapUrl; | ||
108 | 121 | ||
109 | // Even though we're registering for POST we're going to get GETS and UPDATES too | 122 | // Even though we're registering for POST we're going to get GETS and UPDATES too |
110 | caps.RegisterHandler( | 123 | caps.RegisterHandler( |
@@ -116,12 +129,30 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
116 | lock (m_omuCapUsers) | 129 | lock (m_omuCapUsers) |
117 | { | 130 | { |
118 | m_omuCapUsers[omuCapUrl] = agentID; | 131 | m_omuCapUsers[omuCapUrl] = agentID; |
132 | m_omuCapUrls[agentID] = omuCapUrl; | ||
119 | 133 | ||
120 | // Even though we're registering for POST we're going to get GETS and UPDATES too | 134 | // Even though we're registering for POST we're going to get GETS and UPDATES too |
121 | caps.RegisterHandler( | 135 | caps.RegisterHandler( |
122 | "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); | 136 | "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); |
123 | } | 137 | } |
124 | } | 138 | } |
139 | |||
140 | public void DeregisterCaps(UUID agentID, Caps caps) | ||
141 | { | ||
142 | lock (m_omCapUsers) | ||
143 | { | ||
144 | string path = m_omCapUrls[agentID]; | ||
145 | m_omCapUrls.Remove(agentID); | ||
146 | m_omCapUsers.Remove(path); | ||
147 | } | ||
148 | |||
149 | lock (m_omuCapUsers) | ||
150 | { | ||
151 | string path = m_omuCapUrls[agentID]; | ||
152 | m_omuCapUrls.Remove(agentID); | ||
153 | m_omuCapUsers.Remove(path); | ||
154 | } | ||
155 | } | ||
125 | 156 | ||
126 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) | 157 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) |
127 | { | 158 | { |