diff options
author | lbsa71 | 2007-09-18 12:13:44 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-18 12:13:44 +0000 |
commit | 0bac4b430c264741b7f9e63b5d8fb781ba306c68 (patch) | |
tree | 8106614d6608aeb82b8d455ed95a01725376d9a7 /OpenSim/Framework/General/ClientManager.cs | |
parent | * Replaced usage of ClientView with IClientAPI (diff) | |
download | opensim-SC_OLD-0bac4b430c264741b7f9e63b5d8fb781ba306c68.zip opensim-SC_OLD-0bac4b430c264741b7f9e63b5d8fb781ba306c68.tar.gz opensim-SC_OLD-0bac4b430c264741b7f9e63b5d8fb781ba306c68.tar.bz2 opensim-SC_OLD-0bac4b430c264741b7f9e63b5d8fb781ba306c68.tar.xz |
* Handlerized ViewerEffect
* Now there-is-only-client-manager
* First step towards moving Logout and ConnectionClosed out of Client and into something else (which will let us get rid of ClientView reference to ClientManager
* General posititvity, peace, love and understanding
Diffstat (limited to 'OpenSim/Framework/General/ClientManager.cs')
-rw-r--r-- | OpenSim/Framework/General/ClientManager.cs | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs index 0e45d03..274a2d3 100644 --- a/OpenSim/Framework/General/ClientManager.cs +++ b/OpenSim/Framework/General/ClientManager.cs | |||
@@ -1,15 +1,16 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife.Packets; | ||
4 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
5 | 6 | ||
6 | namespace OpenSim.Framework | 7 | namespace OpenSim.Framework |
7 | { | 8 | { |
8 | public delegate void ForEachClientDelegate( IClientAPI client ); | 9 | public delegate void ForEachClientDelegate(IClientAPI client); |
9 | public class ClientManager | 10 | public class ClientManager |
10 | { | 11 | { |
11 | private Dictionary<uint, IClientAPI> m_clients; | 12 | private Dictionary<uint, IClientAPI> m_clients; |
12 | 13 | ||
13 | public void ForEachClient(ForEachClientDelegate whatToDo) | 14 | public void ForEachClient(ForEachClientDelegate whatToDo) |
14 | { | 15 | { |
15 | foreach (IClientAPI client in m_clients.Values) | 16 | foreach (IClientAPI client in m_clients.Values) |
@@ -17,20 +18,59 @@ namespace OpenSim.Framework | |||
17 | whatToDo(client); | 18 | whatToDo(client); |
18 | } | 19 | } |
19 | } | 20 | } |
20 | 21 | ||
21 | public ClientManager() | 22 | public ClientManager() |
22 | { | 23 | { |
23 | m_clients = new Dictionary<uint, IClientAPI>(); | 24 | m_clients = new Dictionary<uint, IClientAPI>(); |
24 | } | 25 | } |
25 | 26 | ||
26 | public void Remove(uint id) | 27 | public void Remove(uint id) |
27 | { | 28 | { |
28 | m_clients.Remove(id); | 29 | m_clients.Remove(id); |
29 | } | 30 | } |
31 | |||
32 | public void Add(uint id, IClientAPI client) | ||
33 | { | ||
34 | m_clients.Add(id, client); | ||
35 | } | ||
36 | |||
37 | public void InPacket(uint circuitCode, libsecondlife.Packets.Packet packet) | ||
38 | { | ||
39 | IClientAPI client; | ||
40 | |||
41 | if (m_clients.TryGetValue(circuitCode, out client)) | ||
42 | { | ||
43 | client.InPacket(packet); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | public void ConnectionClosed(uint circuitCode) | ||
48 | { | ||
49 | IClientAPI client; | ||
50 | |||
51 | if (m_clients.TryGetValue(circuitCode, out client)) | ||
52 | { | ||
53 | m_clients.Remove(circuitCode); | ||
54 | client.Close(); | ||
55 | |||
56 | // TODO: Now remove all local childagents too | ||
57 | } | ||
58 | } | ||
30 | 59 | ||
31 | public void Add(uint id, IClientAPI client ) | 60 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) |
32 | { | 61 | { |
33 | m_clients.Add( id, client ); | 62 | ViewerEffectPacket packet = new ViewerEffectPacket(); |
63 | packet.Effect = effectBlock; | ||
64 | |||
65 | foreach (IClientAPI client in m_clients.Values) | ||
66 | { | ||
67 | if (client.AgentId != sender.AgentId) | ||
68 | { | ||
69 | packet.AgentData.AgentID = client.AgentId; | ||
70 | packet.AgentData.SessionID = client.SessionId; | ||
71 | client.OutPacket(packet); | ||
72 | } | ||
73 | } | ||
34 | } | 74 | } |
35 | } | 75 | } |
36 | } | 76 | } |