aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/ClientView.ProcessPackets.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/ClientView.ProcessPackets.cs (renamed from OpenSim.RegionServer/SimClient.ProcessPackets.cs)144
1 files changed, 84 insertions, 60 deletions
diff --git a/OpenSim.RegionServer/SimClient.ProcessPackets.cs b/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index c9592c2..0079d96 100644
--- a/OpenSim.RegionServer/SimClient.ProcessPackets.cs
+++ b/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -18,9 +18,14 @@ using OpenSim.Assets;
18 18
19namespace OpenSim 19namespace OpenSim
20{ 20{
21 public partial class SimClient 21 public partial class ClientView
22 { 22 {
23 protected virtual void ProcessInPacket(Packet Pack) 23 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
24
25
26 public event ChatFromViewer OnChatFromViewer;
27
28 protected override void ProcessInPacket(Packet Pack)
24 { 29 {
25 ack_pack(Pack); 30 ack_pack(Pack);
26 if (debug) 31 if (debug)
@@ -42,6 +47,24 @@ namespace OpenSim
42 47
43 switch (Pack.Type) 48 switch (Pack.Type)
44 { 49 {
50 #region New Event system
51 case PacketType.ChatFromViewer:
52 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
53 if (Util.FieldToString(inchatpack.ChatData.Message) == "")
54 {
55 //empty message so don't bother with it
56 break;
57 }
58 string fromName = ClientAvatar.firstname + " " + ClientAvatar.lastname;
59 byte[] message = inchatpack.ChatData.Message;
60 byte type = inchatpack.ChatData.Type;
61 LLVector3 fromPos = ClientAvatar.Pos;
62 LLUUID fromAgentID = AgentID;
63 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
64 break;
65 #endregion
66
67 #region World/Avatar/Primitive related packets
45 case PacketType.CompleteAgentMovement: 68 case PacketType.CompleteAgentMovement:
46 if (this.m_child) this.UpgradeClient(); 69 if (this.m_child) this.UpgradeClient();
47 ClientAvatar.CompleteMovement(m_world); 70 ClientAvatar.CompleteMovement(m_world);
@@ -53,13 +76,13 @@ namespace OpenSim
53 break; 76 break;
54 case PacketType.AgentWearablesRequest: 77 case PacketType.AgentWearablesRequest:
55 ClientAvatar.SendInitialAppearance(); 78 ClientAvatar.SendInitialAppearance();
56 foreach (SimClient client in m_clientThreads.Values) 79 foreach (ClientView client in m_clientThreads.Values)
57 { 80 {
58 if (client.AgentID != this.AgentID) 81 if (client.AgentID != this.AgentID)
59 { 82 {
60 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); 83 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
61 this.OutPacket(objupdate); 84 this.OutPacket(objupdate);
62 client.ClientAvatar.SendAppearanceToOtherAgent(this); 85 client.ClientAvatar.SendAppearanceToOtherAgent(this.ClientAvatar);
63 } 86 }
64 } 87 }
65 m_world.GetInitialPrims(this); 88 m_world.GetInitialPrims(this);
@@ -120,18 +143,6 @@ namespace OpenSim
120 } 143 }
121 } 144 }
122 break; 145 break;
123 case PacketType.RequestImage:
124 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
125 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
126 {
127 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
128 }
129 break;
130 case PacketType.TransferRequest:
131 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
132 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
133 m_assetCache.AddAssetRequest(this, transfer);
134 break;
135 case PacketType.AgentUpdate: 146 case PacketType.AgentUpdate:
136 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); 147 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
137 break; 148 break;
@@ -158,6 +169,62 @@ namespace OpenSim
158 } 169 }
159 } 170 }
160 break; 171 break;
172 case PacketType.AgentAnimation:
173 if (!m_child)
174 {
175 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
176 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
177 {
178 if (AgentAni.AnimationList[i].StartAnim)
179 {
180 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
181 ClientAvatar.anim_seq = 1;
182 ClientAvatar.SendAnimPack();
183 }
184 }
185 }
186 break;
187 case PacketType.ObjectSelect:
188 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
189 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
190 {
191 foreach (Entity ent in m_world.Entities.Values)
192 {
193 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
194 {
195 ((OpenSim.world.Primitive)ent).GetProperites(this);
196 break;
197 }
198 }
199 }
200 break;
201 case PacketType.ViewerEffect:
202 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
203 foreach (ClientView client in m_clientThreads.Values)
204 {
205 if (client.AgentID != this.AgentID)
206 {
207 viewer.AgentData.AgentID = client.AgentID;
208 viewer.AgentData.SessionID = client.SessionID;
209 client.OutPacket(viewer);
210 }
211 }
212 break;
213 #endregion
214
215 #region Inventory/Asset/Other related packets
216 case PacketType.RequestImage:
217 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
218 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
219 {
220 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
221 }
222 break;
223 case PacketType.TransferRequest:
224 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
225 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
226 m_assetCache.AddAssetRequest(this, transfer);
227 break;
161 case PacketType.AssetUploadRequest: 228 case PacketType.AssetUploadRequest:
162 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 229 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
163 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); 230 this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
@@ -228,18 +295,6 @@ namespace OpenSim
228 } 295 }
229 } 296 }
230 break; 297 break;
231 case PacketType.ViewerEffect:
232 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
233 foreach (SimClient client in m_clientThreads.Values)
234 {
235 if (client.AgentID != this.AgentID)
236 {
237 viewer.AgentData.AgentID = client.AgentID;
238 viewer.AgentData.SessionID = client.SessionID;
239 client.OutPacket(viewer);
240 }
241 }
242 break;
243 case PacketType.RequestTaskInventory: 298 case PacketType.RequestTaskInventory:
244 // Console.WriteLine(Pack.ToString()); 299 // Console.WriteLine(Pack.ToString());
245 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 300 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
@@ -292,35 +347,6 @@ namespace OpenSim
292 } 347 }
293 } 348 }
294 break; 349 break;
295 case PacketType.AgentAnimation:
296 if (!m_child)
297 {
298 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
299 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
300 {
301 if (AgentAni.AnimationList[i].StartAnim)
302 {
303 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
304 ClientAvatar.anim_seq = 1;
305 ClientAvatar.SendAnimPack();
306 }
307 }
308 }
309 break;
310 case PacketType.ObjectSelect:
311 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
312 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
313 {
314 foreach (Entity ent in m_world.Entities.Values)
315 {
316 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
317 {
318 ((OpenSim.world.Primitive)ent).GetProperites(this);
319 break;
320 }
321 }
322 }
323 break;
324 case PacketType.MapLayerRequest: 350 case PacketType.MapLayerRequest:
325 this.RequestMapLayer(); 351 this.RequestMapLayer();
326 break; 352 break;
@@ -329,7 +355,6 @@ namespace OpenSim
329 355
330 this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 356 this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
331 break; 357 break;
332
333 case PacketType.TeleportLandmarkRequest: 358 case PacketType.TeleportLandmarkRequest:
334 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 359 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
335 360
@@ -378,7 +403,6 @@ namespace OpenSim
378 OutPacket(tpCancel); 403 OutPacket(tpCancel);
379 } 404 }
380 break; 405 break;
381
382 case PacketType.TeleportLocationRequest: 406 case PacketType.TeleportLocationRequest:
383 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 407 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
384 Console.WriteLine(tpLocReq.ToString()); 408 Console.WriteLine(tpLocReq.ToString());
@@ -410,8 +434,8 @@ namespace OpenSim
410 OutPacket(tpLocal); 434 OutPacket(tpLocal);
411 435
412 } 436 }
413
414 break; 437 break;
438 #endregion
415 } 439 }
416 } 440 }
417 } 441 }