aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General
diff options
context:
space:
mode:
authorlbsa712007-09-18 12:13:44 +0000
committerlbsa712007-09-18 12:13:44 +0000
commit0bac4b430c264741b7f9e63b5d8fb781ba306c68 (patch)
tree8106614d6608aeb82b8d455ed95a01725376d9a7 /OpenSim/Framework/General
parent* Replaced usage of ClientView with IClientAPI (diff)
downloadopensim-SC-0bac4b430c264741b7f9e63b5d8fb781ba306c68.zip
opensim-SC-0bac4b430c264741b7f9e63b5d8fb781ba306c68.tar.gz
opensim-SC-0bac4b430c264741b7f9e63b5d8fb781ba306c68.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Framework/General/ClientManager.cs56
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/General/NullClientAPI.cs5
3 files changed, 55 insertions, 10 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 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using libsecondlife.Packets;
4using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
5 6
6namespace OpenSim.Framework 7namespace 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}
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 580a263..9c0771f 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -34,6 +34,7 @@ using OpenSim.Framework.Data;
34 34
35namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
36{ 36{
37 public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock);
37 public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 38 public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
38 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list 39 public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list
39 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); 40 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
@@ -242,6 +243,7 @@ namespace OpenSim.Framework.Interfaces
242 void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); 243 void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
243 void SetDebug(int newDebug); 244 void SetDebug(int newDebug);
244 void InPacket(Packet NewPack); 245 void InPacket(Packet NewPack);
245 void ConnectionClosed(); 246 void Close();
247 event ViewerEffectEventHandler OnViewerEffect;
246 } 248 }
247} 249}
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index 2b6de9e..2fe46d6 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Framework
52 public event StatusChange OnChildAgentStatus; 52 public event StatusChange OnChildAgentStatus;
53 public event GenericCall2 OnStopMovement; 53 public event GenericCall2 OnStopMovement;
54 public event GenericCall6 OnRemoveAvatar; 54 public event GenericCall6 OnRemoveAvatar;
55 public event ViewerEffectEventHandler OnViewerEffect;
55 56
56 public event CreateNewInventoryItem OnCreateNewInventoryItem; 57 public event CreateNewInventoryItem OnCreateNewInventoryItem;
57 public event CreateInventoryFolder OnCreateNewInventoryFolder; 58 public event CreateInventoryFolder OnCreateNewInventoryFolder;
@@ -172,9 +173,11 @@ namespace OpenSim.Framework
172 { 173 {
173 } 174 }
174 175
175 public void ConnectionClosed() 176 public void Close()
176 { 177 {
177 } 178 }
179
180
178 } 181 }
179} 182}
180 183