diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r-- | OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs b/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs index 1ac2d33..32aa96e 100644 --- a/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs +++ b/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs | |||
@@ -21,7 +21,7 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat | |||
21 | 21 | ||
22 | Thread m_listenerThread; | 22 | Thread m_listenerThread; |
23 | Thread m_mainThread; | 23 | Thread m_mainThread; |
24 | Scene m_scene; | 24 | List<Scene> m_scenes; |
25 | Socket m_server; | 25 | Socket m_server; |
26 | Socket m_selectCancel; | 26 | Socket m_selectCancel; |
27 | bool m_enabled = false; | 27 | bool m_enabled = false; |
@@ -34,7 +34,11 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat | |||
34 | 34 | ||
35 | public void Initialise(Scene scene, Nini.Config.IConfigSource source) | 35 | public void Initialise(Scene scene, Nini.Config.IConfigSource source) |
36 | { | 36 | { |
37 | m_scene = scene; | 37 | if (!m_scenes.Contains(scene)) |
38 | m_scenes.Add(scene); | ||
39 | |||
40 | scene.EventManager.OnNewClient += NewClient; | ||
41 | scene.EventManager.OnRemovePresence += RemovePresence; | ||
38 | 42 | ||
39 | try | 43 | try |
40 | { | 44 | { |
@@ -52,14 +56,11 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat | |||
52 | m_clients = new Dictionary<Socket, VoiceClient>(); | 56 | m_clients = new Dictionary<Socket, VoiceClient>(); |
53 | m_uuidToClient = new Dictionary<LLUUID, VoiceClient>(); | 57 | m_uuidToClient = new Dictionary<LLUUID, VoiceClient>(); |
54 | 58 | ||
55 | m_scene.EventManager.OnNewClient += NewClient; | ||
56 | m_scene.EventManager.OnRemovePresence += RemovePresence; | ||
57 | |||
58 | try | 59 | try |
59 | { | 60 | { |
60 | CreateListeningSocket(); | 61 | CreateListeningSocket(); |
61 | } | 62 | } |
62 | catch (Exception e) | 63 | catch (Exception) |
63 | { | 64 | { |
64 | m_log.Error("[VOICECHAT]: Unable to start listening"); | 65 | m_log.Error("[VOICECHAT]: Unable to start listening"); |
65 | return; | 66 | return; |
@@ -305,9 +306,22 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat | |||
305 | } | 306 | } |
306 | } | 307 | } |
307 | 308 | ||
309 | public ScenePresence getScenePresence(LLUUID clientID) | ||
310 | { | ||
311 | foreach (Scene scene in m_scenes) | ||
312 | { | ||
313 | ScenePresence x; | ||
314 | if ((x = scene.GetScenePresence(clientID)) != null) | ||
315 | { | ||
316 | return x; | ||
317 | } | ||
318 | } | ||
319 | return null; | ||
320 | } | ||
321 | |||
308 | public void BroadcastVoice(VoicePacket packet) | 322 | public void BroadcastVoice(VoicePacket packet) |
309 | { | 323 | { |
310 | libsecondlife.LLVector3 origPos = m_scene.GetScenePresence(packet.m_clientId).AbsolutePosition; | 324 | libsecondlife.LLVector3 origPos = getScenePresence(packet.m_clientId).AbsolutePosition; |
311 | 325 | ||
312 | byte[] bytes = packet.GetBytes(); | 326 | byte[] bytes = packet.GetBytes(); |
313 | foreach (VoiceClient client in m_clients.Values) | 327 | foreach (VoiceClient client in m_clients.Values) |
@@ -315,7 +329,7 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat | |||
315 | if (client.IsEnabled() && client.m_clientId != packet.m_clientId && | 329 | if (client.IsEnabled() && client.m_clientId != packet.m_clientId && |
316 | client.m_authenticated && client.IsCodecSupported(packet.m_codec)) | 330 | client.m_authenticated && client.IsCodecSupported(packet.m_codec)) |
317 | { | 331 | { |
318 | ScenePresence presence = m_scene.GetScenePresence(client.m_clientId); | 332 | ScenePresence presence = getScenePresence(client.m_clientId); |
319 | 333 | ||
320 | if (presence != null && Util.GetDistanceTo(presence.AbsolutePosition, origPos) < 20) | 334 | if (presence != null && Util.GetDistanceTo(presence.AbsolutePosition, origPos) < 20) |
321 | { | 335 | { |