diff options
author | lbsa71 | 2007-09-18 13:29:16 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-18 13:29:16 +0000 |
commit | 70d9cec3b5064d874f8b9622804c964beeac5f0d (patch) | |
tree | 29d4ae5a6082ea509f5c92a50582bd9b365c7a0f /OpenSim/Framework/General | |
parent | * Handlerized ViewerEffect (diff) | |
download | opensim-SC_OLD-70d9cec3b5064d874f8b9622804c964beeac5f0d.zip opensim-SC_OLD-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.gz opensim-SC_OLD-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.bz2 opensim-SC_OLD-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.xz |
* Yet some more connectivity restructuring
* We now have CloseAllAgents( circuit ) and CloseAllCircuits( agentId ) for great justice ( but alas, still only closing on one single scene - be brave! )
* Login and ConnectionClosed now eventified and moveified awayified
* Killed off unused NullClientAPI
* Now the client is almost only responsible for its own closing. ( I will get that scene out of there )
* Lookin' good!
Diffstat (limited to 'OpenSim/Framework/General')
-rw-r--r-- | OpenSim/Framework/General/ClientManager.cs | 38 | ||||
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 9 | ||||
-rw-r--r-- | OpenSim/Framework/General/NullClientAPI.cs | 183 |
3 files changed, 42 insertions, 188 deletions
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs index 274a2d3..b032849 100644 --- a/OpenSim/Framework/General/ClientManager.cs +++ b/OpenSim/Framework/General/ClientManager.cs | |||
@@ -3,6 +3,7 @@ using System.Collections.Generic; | |||
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife.Packets; | 4 | using libsecondlife.Packets; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using libsecondlife; | ||
6 | 7 | ||
7 | namespace OpenSim.Framework | 8 | namespace OpenSim.Framework |
8 | { | 9 | { |
@@ -24,7 +25,7 @@ namespace OpenSim.Framework | |||
24 | m_clients = new Dictionary<uint, IClientAPI>(); | 25 | m_clients = new Dictionary<uint, IClientAPI>(); |
25 | } | 26 | } |
26 | 27 | ||
27 | public void Remove(uint id) | 28 | private void Remove(uint id) |
28 | { | 29 | { |
29 | m_clients.Remove(id); | 30 | m_clients.Remove(id); |
30 | } | 31 | } |
@@ -44,19 +45,46 @@ namespace OpenSim.Framework | |||
44 | } | 45 | } |
45 | } | 46 | } |
46 | 47 | ||
47 | public void ConnectionClosed(uint circuitCode) | 48 | public void CloseAllAgents(uint circuitCode) |
48 | { | 49 | { |
49 | IClientAPI client; | 50 | IClientAPI client; |
50 | 51 | ||
51 | if (m_clients.TryGetValue(circuitCode, out client)) | 52 | if (m_clients.TryGetValue(circuitCode, out client)) |
52 | { | 53 | { |
53 | m_clients.Remove(circuitCode); | 54 | CloseAllCircuits(client.AgentId); |
54 | client.Close(); | 55 | } |
56 | } | ||
57 | |||
58 | public void CloseAllCircuits( LLUUID agentId ) | ||
59 | { | ||
60 | uint[] circuits = GetAllCircuits(agentId); | ||
61 | foreach (uint circuit in circuits ) | ||
62 | { | ||
63 | IClientAPI client; | ||
64 | if (m_clients.TryGetValue(circuit, out client)) | ||
65 | { | ||
66 | Remove(circuit); | ||
67 | client.Close(); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | private uint[] GetAllCircuits(LLUUID agentId) | ||
73 | { | ||
74 | List<uint> circuits = new List<uint>(); | ||
55 | 75 | ||
56 | // TODO: Now remove all local childagents too | 76 | foreach (KeyValuePair<uint, IClientAPI> pair in m_clients) |
77 | { | ||
78 | if( pair.Value.AgentId == agentId ) | ||
79 | { | ||
80 | circuits.Add( pair.Key ); | ||
81 | } | ||
57 | } | 82 | } |
83 | |||
84 | return circuits.ToArray(); | ||
58 | } | 85 | } |
59 | 86 | ||
87 | |||
60 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) | 88 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) |
61 | { | 89 | { |
62 | ViewerEffectPacket packet = new ViewerEffectPacket(); | 90 | ViewerEffectPacket packet = new ViewerEffectPacket(); |
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 9c0771f..5fd5adf 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Net; | 30 | using System.Net; |
30 | using libsecondlife; | 31 | using libsecondlife; |
@@ -192,6 +193,12 @@ namespace OpenSim.Framework.Interfaces | |||
192 | get; | 193 | get; |
193 | } | 194 | } |
194 | 195 | ||
196 | uint CircuitCode | ||
197 | { | ||
198 | get; | ||
199 | set; | ||
200 | } | ||
201 | |||
195 | void OutPacket(Packet newPack); | 202 | void OutPacket(Packet newPack); |
196 | void SendWearables(AvatarWearable[] wearables); | 203 | void SendWearables(AvatarWearable[] wearables); |
197 | void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry); | 204 | void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry); |
@@ -245,5 +252,7 @@ namespace OpenSim.Framework.Interfaces | |||
245 | void InPacket(Packet NewPack); | 252 | void InPacket(Packet NewPack); |
246 | void Close(); | 253 | void Close(); |
247 | event ViewerEffectEventHandler OnViewerEffect; | 254 | event ViewerEffectEventHandler OnViewerEffect; |
255 | event Action<IClientAPI> OnLogout; | ||
256 | event Action<IClientAPI> OnConnectionClosed; | ||
248 | } | 257 | } |
249 | } | 258 | } |
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs deleted file mode 100644 index 2fe46d6..0000000 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Net; | ||
3 | using OpenSim.Framework.Interfaces; | ||
4 | using OpenSim.Framework.Types; | ||
5 | using OpenSim.Framework.Data; | ||
6 | using libsecondlife; | ||
7 | using libsecondlife.Packets; | ||
8 | |||
9 | |||
10 | namespace OpenSim.Framework | ||
11 | { | ||
12 | public class NullClientAPI : IClientAPI | ||
13 | { | ||
14 | #pragma warning disable 67 | ||
15 | public event ImprovedInstantMessage OnInstantMessage; | ||
16 | public event ChatFromViewer OnChatFromViewer; | ||
17 | public event RezObject OnRezObject; | ||
18 | public event ModifyTerrain OnModifyTerrain; | ||
19 | public event SetAppearance OnSetAppearance; | ||
20 | public event StartAnim OnStartAnim; | ||
21 | public event LinkObjects OnLinkObjects; | ||
22 | public event RequestMapBlocks OnRequestMapBlocks; | ||
23 | public event TeleportLocationRequest OnTeleportLocationRequest; | ||
24 | public event DisconnectUser OnDisconnectUser; | ||
25 | public event RequestAvatarProperties OnRequestAvatarProperties; | ||
26 | |||
27 | public event GenericCall4 OnDeRezObject; | ||
28 | public event GenericCall OnRegionHandShakeReply; | ||
29 | public event GenericCall OnRequestWearables; | ||
30 | public event GenericCall2 OnCompleteMovementToRegion; | ||
31 | public event UpdateAgent OnAgentUpdate; | ||
32 | public event GenericCall OnRequestAvatarsData; | ||
33 | public event AddNewPrim OnAddPrim; | ||
34 | public event ObjectDuplicate OnObjectDuplicate; | ||
35 | public event UpdateVector OnGrabObject; | ||
36 | public event ObjectSelect OnDeGrabObject; | ||
37 | public event MoveObject OnGrabUpdate; | ||
38 | |||
39 | public event UpdateShape OnUpdatePrimShape; | ||
40 | public event ObjectExtraParams OnUpdateExtraParams; | ||
41 | public event ObjectSelect OnObjectSelect; | ||
42 | public event GenericCall7 OnObjectDescription; | ||
43 | public event GenericCall7 OnObjectName; | ||
44 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
45 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
46 | public event UpdateVector OnUpdatePrimGroupPosition; | ||
47 | public event UpdateVector OnUpdatePrimSinglePosition; | ||
48 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | ||
49 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | ||
50 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; | ||
51 | public event UpdateVector OnUpdatePrimScale; | ||
52 | public event StatusChange OnChildAgentStatus; | ||
53 | public event GenericCall2 OnStopMovement; | ||
54 | public event GenericCall6 OnRemoveAvatar; | ||
55 | public event ViewerEffectEventHandler OnViewerEffect; | ||
56 | |||
57 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | ||
58 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | ||
59 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | ||
60 | public event FetchInventory OnFetchInventory; | ||
61 | public event RequestTaskInventory OnRequestTaskInventory; | ||
62 | public event UpdateInventoryItemTransaction OnUpdateInventoryItem; | ||
63 | public event UDPAssetUploadRequest OnAssetUploadRequest; | ||
64 | public event XferReceive OnXferReceive; | ||
65 | public event RequestXfer OnRequestXfer; | ||
66 | public event ConfirmXfer OnConfirmXfer; | ||
67 | public event RezScript OnRezScript; | ||
68 | public event UpdateTaskInventory OnUpdateTaskInventory; | ||
69 | public event RemoveTaskInventory OnRemoveTaskItem; | ||
70 | |||
71 | public event UUIDNameRequest OnNameFromUUIDRequest; | ||
72 | |||
73 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
74 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
75 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
76 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
77 | public event ParcelSelectObjects OnParcelSelectObjects; | ||
78 | public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; | ||
79 | public event ObjectDeselect OnObjectDeselect; | ||
80 | |||
81 | |||
82 | public event EstateOwnerMessageRequest OnEstateOwnerMessage; | ||
83 | #pragma warning restore 67 | ||
84 | |||
85 | private LLUUID m_uuid = LLUUID.Random(); | ||
86 | public virtual LLVector3 StartPos | ||
87 | { | ||
88 | get { return new LLVector3(); } | ||
89 | set { } | ||
90 | } | ||
91 | |||
92 | public virtual LLUUID AgentId | ||
93 | { | ||
94 | get { return m_uuid; } | ||
95 | } | ||
96 | |||
97 | public LLUUID SessionId | ||
98 | { | ||
99 | get { return LLUUID.Zero; } | ||
100 | } | ||
101 | |||
102 | public virtual string FirstName | ||
103 | { | ||
104 | get { return ""; } | ||
105 | } | ||
106 | |||
107 | public virtual string LastName | ||
108 | { | ||
109 | get { return ""; } | ||
110 | } | ||
111 | |||
112 | public NullClientAPI() | ||
113 | { | ||
114 | } | ||
115 | |||
116 | public virtual void OutPacket(Packet newPack){} | ||
117 | public virtual void SendWearables(AvatarWearable[] wearables){} | ||
118 | public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } | ||
119 | public virtual void SendStartPingCheck(byte seq){} | ||
120 | public virtual void SendKillObject(ulong regionHandle, uint localID){} | ||
121 | public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){} | ||
122 | public virtual void SendRegionHandshake(RegionInfo regionInfo){} | ||
123 | public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } | ||
124 | public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} | ||
125 | public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp){} | ||
126 | public virtual void SendLayerData(float[] map){} | ||
127 | public virtual void SendLayerData(int px, int py, float[] map){} | ||
128 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look){} | ||
129 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint){} | ||
130 | public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } | ||
131 | public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL){} | ||
132 | public virtual void SendMapBlock(List<MapBlockData> mapBlocks){} | ||
133 | public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags){} | ||
134 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL){} | ||
135 | public virtual void SendTeleportCancel(){} | ||
136 | public virtual void SendTeleportLocationStart(){} | ||
137 | public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){} | ||
138 | |||
139 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){} | ||
140 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation){} | ||
141 | public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } | ||
142 | |||
143 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){} | ||
144 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation){} | ||
145 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){} | ||
146 | |||
147 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} | ||
148 | public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){} | ||
149 | public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } | ||
150 | public virtual void SendRemoveInventoryItem(LLUUID itemID) { } | ||
151 | public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } | ||
152 | public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } | ||
153 | |||
154 | public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } | ||
155 | public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } | ||
156 | |||
157 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} | ||
158 | public void SendAlertMessage(string message) { } | ||
159 | public void SendAgentAlertMessage(string message, bool modal) { } | ||
160 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } | ||
161 | |||
162 | |||
163 | public bool AddMoney(int debit) | ||
164 | { | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | public void SendViewerTime(int phase) { } | ||
169 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } | ||
170 | public void SetDebug(int newDebug) { } | ||
171 | |||
172 | public void InPacket(Packet NewPack) | ||
173 | { | ||
174 | } | ||
175 | |||
176 | public void Close() | ||
177 | { | ||
178 | } | ||
179 | |||
180 | |||
181 | } | ||
182 | } | ||
183 | |||