aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs270
1 files changed, 160 insertions, 110 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 13e8b43..dd2562c 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -31,8 +31,6 @@ using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Environment.Scenes;
36 34
37namespace OpenSim.Region.ClientStack 35namespace OpenSim.Region.ClientStack
38{ 36{
@@ -63,7 +61,7 @@ namespace OpenSim.Region.ClientStack
63 { 61 {
64 ack_pack(Pack); 62 ack_pack(Pack);
65 63
66 if (this.ProcessPacketMethod(Pack)) 64 if (ProcessPacketMethod(Pack))
67 { 65 {
68 //there is a handler registered that handled this packet type 66 //there is a handler registered that handled this packet type
69 return; 67 return;
@@ -74,16 +72,17 @@ namespace OpenSim.Region.ClientStack
74 72
75 switch (Pack.Type) 73 switch (Pack.Type)
76 { 74 {
77 #region Scene/Avatar 75 #region Scene/Avatar
76
78 case PacketType.AvatarPropertiesRequest: 77 case PacketType.AvatarPropertiesRequest:
79 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 78 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket) Pack;
80 if (OnRequestAvatarProperties != null) 79 if (OnRequestAvatarProperties != null)
81 { 80 {
82 OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); 81 OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
83 } 82 }
84 break; 83 break;
85 case PacketType.ChatFromViewer: 84 case PacketType.ChatFromViewer:
86 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; 85 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack;
87 if (Util.FieldToString(inchatpack.ChatData.Message) == "") 86 if (Util.FieldToString(inchatpack.ChatData.Message) == "")
88 { 87 {
89 //empty message so don't bother with it 88 //empty message so don't bother with it
@@ -103,30 +102,32 @@ namespace OpenSim.Region.ClientStack
103 args.Channel = channel; 102 args.Channel = channel;
104 args.From = fromName; 103 args.From = fromName;
105 args.Message = Util.FieldToString(message); 104 args.Message = Util.FieldToString(message);
106 args.Type = (ChatTypeEnum)type; 105 args.Type = (ChatTypeEnum) type;
107 args.Position = fromPos; 106 args.Position = fromPos;
108 107
109 args.Scene = Scene; 108 args.Scene = Scene;
110 args.Sender = this; 109 args.Sender = this;
111 110
112 this.OnChatFromViewer(this, args); 111 OnChatFromViewer(this, args);
113 } 112 }
114 break; 113 break;
115 case PacketType.ImprovedInstantMessage: 114 case PacketType.ImprovedInstantMessage:
116 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 115 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
117 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 116 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
118 string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); 117 string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message);
119 if (OnInstantMessage != null) 118 if (OnInstantMessage != null)
120 { 119 {
121 this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, 120 OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
122 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, msgpack.MessageBlock.Dialog); 121 msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID,
122 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
123 msgpack.MessageBlock.Dialog);
123 } 124 }
124 break; 125 break;
125 case PacketType.RezObject: 126 case PacketType.RezObject:
126 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 127 RezObjectPacket rezPacket = (RezObjectPacket) Pack;
127 if (OnRezObject != null) 128 if (OnRezObject != null)
128 { 129 {
129 this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); 130 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd);
130 } 131 }
131 break; 132 break;
132 case PacketType.DeRezObject: 133 case PacketType.DeRezObject:
@@ -136,13 +137,15 @@ namespace OpenSim.Region.ClientStack
136 } 137 }
137 break; 138 break;
138 case PacketType.ModifyLand: 139 case PacketType.ModifyLand:
139 ModifyLandPacket modify = (ModifyLandPacket)Pack; 140 ModifyLandPacket modify = (ModifyLandPacket) Pack;
140 if (modify.ParcelData.Length > 0) 141 if (modify.ParcelData.Length > 0)
141 { 142 {
142 if (OnModifyTerrain != null) 143 if (OnModifyTerrain != null)
143 { 144 {
144 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, 145 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
145 modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West, this); 146 modify.ModifyBlock.BrushSize,
147 modify.ModifyBlock.Action, modify.ParcelData[0].North,
148 modify.ParcelData[0].West, this);
146 } 149 }
147 } 150 }
148 break; 151 break;
@@ -164,7 +167,7 @@ namespace OpenSim.Region.ClientStack
164 break; 167 break;
165 case PacketType.AgentSetAppearance: 168 case PacketType.AgentSetAppearance:
166 //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString()); 169 //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString());
167 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; 170 AgentSetAppearancePacket appear = (AgentSetAppearancePacket) Pack;
168 if (OnSetAppearance != null) 171 if (OnSetAppearance != null)
169 { 172 {
170 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); 173 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
@@ -179,17 +182,16 @@ namespace OpenSim.Region.ClientStack
179 case PacketType.AgentUpdate: 182 case PacketType.AgentUpdate:
180 if (OnAgentUpdate != null) 183 if (OnAgentUpdate != null)
181 { 184 {
182 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; 185 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack;
183 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); 186 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation);
184 } 187 }
185 break; 188 break;
186 case PacketType.AgentAnimation: 189 case PacketType.AgentAnimation:
187 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 190 AgentAnimationPacket AgentAni = (AgentAnimationPacket) Pack;
188 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 191 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
189 { 192 {
190 if (AgentAni.AnimationList[i].StartAnim) 193 if (AgentAni.AnimationList[i].StartAnim)
191 { 194 {
192
193 if (OnStartAnim != null) 195 if (OnStartAnim != null)
194 { 196 {
195 OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); 197 OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1);
@@ -198,27 +200,29 @@ namespace OpenSim.Region.ClientStack
198 } 200 }
199 break; 201 break;
200 case PacketType.AgentRequestSit: 202 case PacketType.AgentRequestSit:
201 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; 203 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket) Pack;
202 SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); 204 SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
203 if (OnAgentRequestSit != null) 205 if (OnAgentRequestSit != null)
204 { 206 {
205 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID); 207 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
208 agentRequestSit.TargetObject.TargetID);
206 } 209 }
207 break; 210 break;
208 case PacketType.AgentSit: 211 case PacketType.AgentSit:
209 if (OnAgentSit != null) 212 if (OnAgentSit != null)
210 { 213 {
211 AgentSitPacket agentSit = (AgentSitPacket)Pack; 214 AgentSitPacket agentSit = (AgentSitPacket) Pack;
212 OnAgentSit(this, agentSit.AgentData.AgentID); 215 OnAgentSit(this, agentSit.AgentData.AgentID);
213 } 216 }
214 break; 217 break;
215 218
216 #endregion 219 #endregion
220
221 #region Objects/m_sceneObjects
217 222
218 #region Objects/m_sceneObjects
219 case PacketType.ObjectLink: 223 case PacketType.ObjectLink:
220 // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); 224 // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
221 ObjectLinkPacket link = (ObjectLinkPacket)Pack; 225 ObjectLinkPacket link = (ObjectLinkPacket) Pack;
222 uint parentprimid = 0; 226 uint parentprimid = 0;
223 List<uint> childrenprims = new List<uint>(); 227 List<uint> childrenprims = new List<uint>();
224 if (link.ObjectData.Length > 1) 228 if (link.ObjectData.Length > 1)
@@ -238,13 +242,13 @@ namespace OpenSim.Region.ClientStack
238 case PacketType.ObjectAdd: 242 case PacketType.ObjectAdd:
239 if (OnAddPrim != null) 243 if (OnAddPrim != null)
240 { 244 {
241 ObjectAddPacket addPacket = (ObjectAddPacket)Pack; 245 ObjectAddPacket addPacket = (ObjectAddPacket) Pack;
242 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); 246 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
243 OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); 247 OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, shape);
244 } 248 }
245 break; 249 break;
246 case PacketType.ObjectShape: 250 case PacketType.ObjectShape:
247 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; 251 ObjectShapePacket shapePacket = (ObjectShapePacket) Pack;
248 for (int i = 0; i < shapePacket.ObjectData.Length; i++) 252 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
249 { 253 {
250 if (OnUpdatePrimShape != null) 254 if (OnUpdatePrimShape != null)
@@ -254,26 +258,28 @@ namespace OpenSim.Region.ClientStack
254 } 258 }
255 break; 259 break;
256 case PacketType.ObjectExtraParams: 260 case PacketType.ObjectExtraParams:
257 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; 261 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack;
258 if (OnUpdateExtraParams != null) 262 if (OnUpdateExtraParams != null)
259 { 263 {
260 OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); 264 OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType,
265 extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData);
261 } 266 }
262 break; 267 break;
263 case PacketType.ObjectDuplicate: 268 case PacketType.ObjectDuplicate:
264 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; 269 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket) Pack;
265 for (int i = 0; i < dupe.ObjectData.Length; i++) 270 for (int i = 0; i < dupe.ObjectData.Length; i++)
266 { 271 {
267 if (OnObjectDuplicate != null) 272 if (OnObjectDuplicate != null)
268 { 273 {
269 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); 274 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
275 dupe.SharedData.DuplicateFlags);
270 } 276 }
271 } 277 }
272 278
273 break; 279 break;
274 280
275 case PacketType.ObjectSelect: 281 case PacketType.ObjectSelect:
276 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 282 ObjectSelectPacket incomingselect = (ObjectSelectPacket) Pack;
277 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 283 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
278 { 284 {
279 if (OnObjectSelect != null) 285 if (OnObjectSelect != null)
@@ -283,7 +289,7 @@ namespace OpenSim.Region.ClientStack
283 } 289 }
284 break; 290 break;
285 case PacketType.ObjectDeselect: 291 case PacketType.ObjectDeselect:
286 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; 292 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket) Pack;
287 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 293 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
288 { 294 {
289 if (OnObjectDeselect != null) 295 if (OnObjectDeselect != null)
@@ -293,55 +299,58 @@ namespace OpenSim.Region.ClientStack
293 } 299 }
294 break; 300 break;
295 case PacketType.ObjectFlagUpdate: 301 case PacketType.ObjectFlagUpdate:
296 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 302 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket) Pack;
297 if (OnUpdatePrimFlags != null) 303 if (OnUpdatePrimFlags != null)
298 { 304 {
299 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); 305 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
300 } 306 }
301 break; 307 break;
302 case PacketType.ObjectImage: 308 case PacketType.ObjectImage:
303 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 309 ObjectImagePacket imagePack = (ObjectImagePacket) Pack;
304 for (int i = 0; i < imagePack.ObjectData.Length; i++) 310 for (int i = 0; i < imagePack.ObjectData.Length; i++)
305 { 311 {
306 if (OnUpdatePrimTexture != null) 312 if (OnUpdatePrimTexture != null)
307 { 313 {
308 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); 314 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
315 imagePack.ObjectData[i].TextureEntry, this);
309 } 316 }
310 } 317 }
311 break; 318 break;
312 case PacketType.ObjectGrab: 319 case PacketType.ObjectGrab:
313 ObjectGrabPacket grab = (ObjectGrabPacket)Pack; 320 ObjectGrabPacket grab = (ObjectGrabPacket) Pack;
314 if (OnGrabObject != null) 321 if (OnGrabObject != null)
315 { 322 {
316 OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); 323 OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this);
317 } 324 }
318 break; 325 break;
319 case PacketType.ObjectGrabUpdate: 326 case PacketType.ObjectGrabUpdate:
320 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; 327 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket) Pack;
321 if (OnGrabUpdate != null) 328 if (OnGrabUpdate != null)
322 { 329 {
323 OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, grabUpdate.ObjectData.GrabPosition, this); 330 OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
331 grabUpdate.ObjectData.GrabPosition, this);
324 } 332 }
325 break; 333 break;
326 case PacketType.ObjectDeGrab: 334 case PacketType.ObjectDeGrab:
327 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; 335 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket) Pack;
328 if (OnDeGrabObject != null) 336 if (OnDeGrabObject != null)
329 { 337 {
330 OnDeGrabObject(deGrab.ObjectData.LocalID, this); 338 OnDeGrabObject(deGrab.ObjectData.LocalID, this);
331 } 339 }
332 break; 340 break;
333 case PacketType.ObjectDescription: 341 case PacketType.ObjectDescription:
334 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; 342 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket) Pack;
335 for (int i = 0; i < objDes.ObjectData.Length; i++) 343 for (int i = 0; i < objDes.ObjectData.Length; i++)
336 { 344 {
337 if (OnObjectDescription != null) 345 if (OnObjectDescription != null)
338 { 346 {
339 OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); 347 OnObjectDescription(objDes.ObjectData[i].LocalID,
348 enc.GetString(objDes.ObjectData[i].Description));
340 } 349 }
341 } 350 }
342 break; 351 break;
343 case PacketType.ObjectName: 352 case PacketType.ObjectName:
344 ObjectNamePacket objName = (ObjectNamePacket)Pack; 353 ObjectNamePacket objName = (ObjectNamePacket) Pack;
345 for (int i = 0; i < objName.ObjectData.Length; i++) 354 for (int i = 0; i < objName.ObjectData.Length; i++)
346 { 355 {
347 if (OnObjectName != null) 356 if (OnObjectName != null)
@@ -353,15 +362,16 @@ namespace OpenSim.Region.ClientStack
353 case PacketType.ObjectPermissions: 362 case PacketType.ObjectPermissions:
354 //Console.WriteLine("permissions set " + Pack.ToString()); 363 //Console.WriteLine("permissions set " + Pack.ToString());
355 break; 364 break;
356 #endregion
357 365
358 #region Inventory/Asset/Other related packets 366 #endregion
367
368 #region Inventory/Asset/Other related packets
369
359 case PacketType.RequestImage: 370 case PacketType.RequestImage:
360 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 371 RequestImagePacket imageRequest = (RequestImagePacket) Pack;
361 //Console.WriteLine("image request: " + Pack.ToString()); 372 //Console.WriteLine("image request: " + Pack.ToString());
362 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 373 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
363 { 374 {
364
365 // still working on the Texture download module so for now using old method 375 // still working on the Texture download module so for now using old method
366 // TextureRequestArgs args = new TextureRequestArgs(); 376 // TextureRequestArgs args = new TextureRequestArgs();
367 // args.RequestedAssetID = imageRequest.RequestImage[i].Image; 377 // args.RequestedAssetID = imageRequest.RequestImage[i].Image;
@@ -373,86 +383,104 @@ namespace OpenSim.Region.ClientStack
373 // OnRequestTexture(this, args); 383 // OnRequestTexture(this, args);
374 // } 384 // }
375 385
376 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet, imageRequest.RequestImage[i].DiscardLevel); 386 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image,
387 imageRequest.RequestImage[i].Packet,
388 imageRequest.RequestImage[i].DiscardLevel);
377 } 389 }
378 break; 390 break;
379 case PacketType.TransferRequest: 391 case PacketType.TransferRequest:
380 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 392 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
381 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 393 TransferRequestPacket transfer = (TransferRequestPacket) Pack;
382 m_assetCache.AddAssetRequest(this, transfer); 394 m_assetCache.AddAssetRequest(this, transfer);
383 break; 395 break;
384 case PacketType.AssetUploadRequest: 396 case PacketType.AssetUploadRequest:
385 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 397 AssetUploadRequestPacket request = (AssetUploadRequestPacket) Pack;
386 // Console.WriteLine("upload request " + Pack.ToString()); 398 // Console.WriteLine("upload request " + Pack.ToString());
387 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); 399 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
388 if (OnAssetUploadRequest != null) 400 if (OnAssetUploadRequest != null)
389 { 401 {
390 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); 402 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(SecureSessionID),
403 request.AssetBlock.TransactionID, request.AssetBlock.Type,
404 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
391 } 405 }
392 break; 406 break;
393 case PacketType.RequestXfer: 407 case PacketType.RequestXfer:
394 RequestXferPacket xferReq = (RequestXferPacket)Pack; 408 RequestXferPacket xferReq = (RequestXferPacket) Pack;
395 if (OnRequestXfer != null) 409 if (OnRequestXfer != null)
396 { 410 {
397 OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); 411 OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
398 } 412 }
399 break; 413 break;
400 case PacketType.SendXferPacket: 414 case PacketType.SendXferPacket:
401 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; 415 SendXferPacketPacket xferRec = (SendXferPacketPacket) Pack;
402 if (OnXferReceive != null) 416 if (OnXferReceive != null)
403 { 417 {
404 OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); 418 OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
405 } 419 }
406 break; 420 break;
407 case PacketType.ConfirmXferPacket: 421 case PacketType.ConfirmXferPacket:
408 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; 422 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket) Pack;
409 if (OnConfirmXfer != null) 423 if (OnConfirmXfer != null)
410 { 424 {
411 OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); 425 OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
412 } 426 }
413 break; 427 break;
414 case PacketType.CreateInventoryFolder: 428 case PacketType.CreateInventoryFolder:
415 if (this.OnCreateNewInventoryFolder != null) 429 if (OnCreateNewInventoryFolder != null)
416 { 430 {
417 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 431 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket) Pack;
418 this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); 432 OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID,
433 (ushort) invFolder.FolderData.Type,
434 Util.FieldToString(invFolder.FolderData.Name),
435 invFolder.FolderData.ParentID);
419 } 436 }
420 break; 437 break;
421 case PacketType.CreateInventoryItem: 438 case PacketType.CreateInventoryItem:
422 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; 439 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack;
423 if (this.OnCreateNewInventoryItem != null) 440 if (OnCreateNewInventoryItem != null)
424 { 441 {
425 this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID, 442 OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
426 Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType, 443 createItem.InventoryBlock.FolderID,
427 createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask); 444 createItem.InventoryBlock.CallbackID,
445 Util.FieldToString(createItem.InventoryBlock.Description),
446 Util.FieldToString(createItem.InventoryBlock.Name),
447 createItem.InventoryBlock.InvType,
448 createItem.InventoryBlock.Type,
449 createItem.InventoryBlock.WearableType,
450 createItem.InventoryBlock.NextOwnerMask);
428 } 451 }
429 break; 452 break;
430 case PacketType.FetchInventory: 453 case PacketType.FetchInventory:
431 if (this.OnFetchInventory != null) 454 if (OnFetchInventory != null)
432 { 455 {
433 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; 456 FetchInventoryPacket FetchInventory = (FetchInventoryPacket) Pack;
434 for (int i = 0; i < FetchInventory.InventoryData.Length; i++) 457 for (int i = 0; i < FetchInventory.InventoryData.Length; i++)
435 { 458 {
436 this.OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, FetchInventory.InventoryData[i].OwnerID); 459 OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID,
460 FetchInventory.InventoryData[i].OwnerID);
437 } 461 }
438 } 462 }
439 break; 463 break;
440 case PacketType.FetchInventoryDescendents: 464 case PacketType.FetchInventoryDescendents:
441 if (this.OnFetchInventoryDescendents != null) 465 if (OnFetchInventoryDescendents != null)
442 { 466 {
443 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 467 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket) Pack;
444 this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); 468 OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
469 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
470 Fetch.InventoryData.SortOrder);
445 } 471 }
446 break; 472 break;
447 case PacketType.UpdateInventoryItem: 473 case PacketType.UpdateInventoryItem:
448 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 474 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket) Pack;
449 if (OnUpdateInventoryItem != null) 475 if (OnUpdateInventoryItem != null)
450 { 476 {
451 for (int i = 0; i < update.InventoryData.Length; i++) 477 for (int i = 0; i < update.InventoryData.Length; i++)
452 { 478 {
453 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 479 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
454 { 480 {
455 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID); 481 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
482 update.InventoryData[i].TransactionID.Combine(SecureSessionID),
483 update.InventoryData[i].ItemID);
456 } 484 }
457 } 485 }
458 } 486 }
@@ -488,25 +516,26 @@ namespace OpenSim.Region.ClientStack
488 }*/ 516 }*/
489 break; 517 break;
490 case PacketType.RequestTaskInventory: 518 case PacketType.RequestTaskInventory:
491 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 519 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack;
492 if (this.OnRequestTaskInventory != null) 520 if (OnRequestTaskInventory != null)
493 { 521 {
494 this.OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); 522 OnRequestTaskInventory(this, requesttask.InventoryData.LocalID);
495 } 523 }
496 break; 524 break;
497 case PacketType.UpdateTaskInventory: 525 case PacketType.UpdateTaskInventory:
498 //Console.WriteLine(Pack.ToString()); 526 //Console.WriteLine(Pack.ToString());
499 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 527 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket) Pack;
500 if (OnUpdateTaskInventory != null) 528 if (OnUpdateTaskInventory != null)
501 { 529 {
502 if (updatetask.UpdateData.Key == 0) 530 if (updatetask.UpdateData.Key == 0)
503 { 531 {
504 OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID, updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); 532 OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID,
533 updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID);
505 } 534 }
506 } 535 }
507 break; 536 break;
508 case PacketType.RemoveTaskInventory: 537 case PacketType.RemoveTaskInventory:
509 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; 538 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket) Pack;
510 if (OnRemoveTaskItem != null) 539 if (OnRemoveTaskItem != null)
511 { 540 {
512 OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); 541 OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
@@ -517,38 +546,39 @@ namespace OpenSim.Region.ClientStack
517 break; 546 break;
518 case PacketType.RezScript: 547 case PacketType.RezScript:
519 //Console.WriteLine(Pack.ToString()); 548 //Console.WriteLine(Pack.ToString());
520 RezScriptPacket rezScript = (RezScriptPacket)Pack; 549 RezScriptPacket rezScript = (RezScriptPacket) Pack;
521 if (OnRezScript != null) 550 if (OnRezScript != null)
522 { 551 {
523 OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); 552 OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID);
524 } 553 }
525 break; 554 break;
526 case PacketType.MapLayerRequest: 555 case PacketType.MapLayerRequest:
527 this.RequestMapLayer(); 556 RequestMapLayer();
528 break; 557 break;
529 case PacketType.MapBlockRequest: 558 case PacketType.MapBlockRequest:
530 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; 559 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket) Pack;
531 if (OnRequestMapBlocks != null) 560 if (OnRequestMapBlocks != null)
532 { 561 {
533 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 562 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
563 MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
534 } 564 }
535 break; 565 break;
536 case PacketType.TeleportLandmarkRequest: 566 case PacketType.TeleportLandmarkRequest:
537 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 567 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack;
538 568
539 TeleportStartPacket tpStart = new TeleportStartPacket(); 569 TeleportStartPacket tpStart = new TeleportStartPacket();
540 tpStart.Info.TeleportFlags = 8; // tp via lm 570 tpStart.Info.TeleportFlags = 8; // tp via lm
541 this.OutPacket(tpStart); 571 OutPacket(tpStart);
542 572
543 TeleportProgressPacket tpProgress = new TeleportProgressPacket(); 573 TeleportProgressPacket tpProgress = new TeleportProgressPacket();
544 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); 574 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
545 tpProgress.Info.TeleportFlags = 8; 575 tpProgress.Info.TeleportFlags = 8;
546 tpProgress.AgentData.AgentID = tpReq.Info.AgentID; 576 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
547 this.OutPacket(tpProgress); 577 OutPacket(tpProgress);
548 578
549 // Fetch landmark 579 // Fetch landmark
550 LLUUID lmid = tpReq.Info.LandmarkID; 580 LLUUID lmid = tpReq.Info.LandmarkID;
551 AssetBase lma = this.m_assetCache.GetAsset(lmid); 581 AssetBase lma = m_assetCache.GetAsset(lmid);
552 if (lma != null) 582 if (lma != null)
553 { 583 {
554 AssetLandmark lm = new AssetLandmark(lma); 584 AssetLandmark lm = new AssetLandmark(lma);
@@ -558,7 +588,7 @@ namespace OpenSim.Region.ClientStack
558 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 588 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
559 589
560 tpLocal.Info.AgentID = tpReq.Info.AgentID; 590 tpLocal.Info.AgentID = tpReq.Info.AgentID;
561 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 591 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
562 tpLocal.Info.LocationID = 2; 592 tpLocal.Info.LocationID = 2;
563 tpLocal.Info.Position = lm.Position; 593 tpLocal.Info.Position = lm.Position;
564 OutPacket(tpLocal); 594 OutPacket(tpLocal);
@@ -582,12 +612,13 @@ namespace OpenSim.Region.ClientStack
582 } 612 }
583 break; 613 break;
584 case PacketType.TeleportLocationRequest: 614 case PacketType.TeleportLocationRequest:
585 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 615 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket) Pack;
586 // Console.WriteLine(tpLocReq.ToString()); 616 // Console.WriteLine(tpLocReq.ToString());
587 617
588 if (OnTeleportLocationRequest != null) 618 if (OnTeleportLocationRequest != null)
589 { 619 {
590 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); 620 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
621 tpLocReq.Info.LookAt, 16);
591 } 622 }
592 else 623 else
593 { 624 {
@@ -598,76 +629,94 @@ namespace OpenSim.Region.ClientStack
598 OutPacket(tpCancel); 629 OutPacket(tpCancel);
599 } 630 }
600 break; 631 break;
601 #endregion 632
633 #endregion
602 634
603 case PacketType.MoneyBalanceRequest: 635 case PacketType.MoneyBalanceRequest:
604 SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); 636 SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance);
605 break; 637 break;
606 case PacketType.UUIDNameRequest: 638 case PacketType.UUIDNameRequest:
607 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; 639 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket) Pack;
608 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) 640 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
609 { 641 {
610 OnNameFromUUIDRequest(UUIDBlock.ID, this); 642 OnNameFromUUIDRequest(UUIDBlock.ID, this);
611 } 643 }
612 break; 644 break;
613 #region Parcel related packets 645
646 #region Parcel related packets
647
614 case PacketType.ParcelPropertiesRequest: 648 case PacketType.ParcelPropertiesRequest:
615 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; 649 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket) Pack;
616 if (OnParcelPropertiesRequest != null) 650 if (OnParcelPropertiesRequest != null)
617 { 651 {
618 OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); 652 OnParcelPropertiesRequest((int) Math.Round(propertiesRequest.ParcelData.West),
653 (int) Math.Round(propertiesRequest.ParcelData.South),
654 (int) Math.Round(propertiesRequest.ParcelData.East),
655 (int) Math.Round(propertiesRequest.ParcelData.North),
656 propertiesRequest.ParcelData.SequenceID,
657 propertiesRequest.ParcelData.SnapSelection, this);
619 } 658 }
620 break; 659 break;
621 case PacketType.ParcelDivide: 660 case PacketType.ParcelDivide:
622 ParcelDividePacket landDivide = (ParcelDividePacket)Pack; 661 ParcelDividePacket landDivide = (ParcelDividePacket) Pack;
623 if (OnParcelDivideRequest != null) 662 if (OnParcelDivideRequest != null)
624 { 663 {
625 OnParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), (int)Math.Round(landDivide.ParcelData.South), (int)Math.Round(landDivide.ParcelData.East), (int)Math.Round(landDivide.ParcelData.North), this); 664 OnParcelDivideRequest((int) Math.Round(landDivide.ParcelData.West),
665 (int) Math.Round(landDivide.ParcelData.South),
666 (int) Math.Round(landDivide.ParcelData.East),
667 (int) Math.Round(landDivide.ParcelData.North), this);
626 } 668 }
627 break; 669 break;
628 case PacketType.ParcelJoin: 670 case PacketType.ParcelJoin:
629 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; 671 ParcelJoinPacket landJoin = (ParcelJoinPacket) Pack;
630 if (OnParcelJoinRequest != null) 672 if (OnParcelJoinRequest != null)
631 { 673 {
632 OnParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), (int)Math.Round(landJoin.ParcelData.South), (int)Math.Round(landJoin.ParcelData.East), (int)Math.Round(landJoin.ParcelData.North), this); 674 OnParcelJoinRequest((int) Math.Round(landJoin.ParcelData.West),
675 (int) Math.Round(landJoin.ParcelData.South),
676 (int) Math.Round(landJoin.ParcelData.East),
677 (int) Math.Round(landJoin.ParcelData.North), this);
633 } 678 }
634 break; 679 break;
635 case PacketType.ParcelPropertiesUpdate: 680 case PacketType.ParcelPropertiesUpdate:
636 ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; 681 ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket) Pack;
637 if (OnParcelPropertiesUpdateRequest != null) 682 if (OnParcelPropertiesUpdateRequest != null)
638 { 683 {
639 OnParcelPropertiesUpdateRequest(updatePacket, this); 684 OnParcelPropertiesUpdateRequest(updatePacket, this);
640
641 } 685 }
642 break; 686 break;
643 case PacketType.ParcelSelectObjects: 687 case PacketType.ParcelSelectObjects:
644 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; 688 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket) Pack;
645 if (OnParcelSelectObjects != null) 689 if (OnParcelSelectObjects != null)
646 { 690 {
647 OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); 691 OnParcelSelectObjects(selectPacket.ParcelData.LocalID,
692 Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
648 } 693 }
649 break; 694 break;
650 695
651 case PacketType.ParcelObjectOwnersRequest: 696 case PacketType.ParcelObjectOwnersRequest:
652 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; 697 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket) Pack;
653 if (OnParcelObjectOwnerRequest != null) 698 if (OnParcelObjectOwnerRequest != null)
654 { 699 {
655 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 700 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
656 } 701 }
657 break; 702 break;
658 #endregion
659 703
660 #region Estate Packets 704 #endregion
705
706 #region Estate Packets
707
661 case PacketType.EstateOwnerMessage: 708 case PacketType.EstateOwnerMessage:
662 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 709 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket) Pack;
663 if (OnEstateOwnerMessage != null) 710 if (OnEstateOwnerMessage != null)
664 { 711 {
665 OnEstateOwnerMessage(messagePacket, this); 712 OnEstateOwnerMessage(messagePacket, this);
666 } 713 }
667 break; 714 break;
668 #endregion
669 715
670 #region unimplemented handlers 716 #endregion
717
718 #region unimplemented handlers
719
671 case PacketType.AgentIsNowWearing: 720 case PacketType.AgentIsNowWearing:
672 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; 721 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
673 //Console.WriteLine(Pack.ToString()); 722 //Console.WriteLine(Pack.ToString());
@@ -675,7 +724,8 @@ namespace OpenSim.Region.ClientStack
675 case PacketType.ObjectScale: 724 case PacketType.ObjectScale:
676 //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); 725 //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
677 break; 726 break;
678 #endregion 727
728 #endregion
679 } 729 }
680 } 730 }
681 } 731 }
@@ -721,4 +771,4 @@ namespace OpenSim.Region.ClientStack
721 OutPacket(logReply); 771 OutPacket(logReply);
722 } 772 }
723 } 773 }
724} 774} \ No newline at end of file