aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorroot2009-11-26 20:41:38 +0100
committerroot2009-11-26 20:41:38 +0100
commit2c3f6aaa878b5458eeeab8544226ff53b7172f5a (patch)
tree48941505962693508016fafb479c2baaf1b3568f
parentFirst attempt at mult-sit on large single prims. (diff)
parentRemove OS version crap from about dialog (diff)
downloadopensim-SC_OLD-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.zip
opensim-SC_OLD-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.tar.gz
opensim-SC_OLD-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.tar.bz2
opensim-SC_OLD-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.tar.xz
Merge branch 'careminster' into tests
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs74
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs154
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs2
-rw-r--r--OpenSim/Framework/ISceneObject.cs2
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs25
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs111
-rw-r--r--OpenSim/Framework/Tests/CacheTests.cs8
-rw-r--r--OpenSim/Framework/Util.cs26
-rw-r--r--OpenSim/Region/Application/HGCommands.cs2
-rw-r--r--OpenSim/Region/Application/OpenSim.cs20
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4731
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs59
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs76
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs72
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs36
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs49
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandChannel.cs25
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs5
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs122
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs72
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs190
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs444
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs9
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs549
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs62
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs266
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs220
-rw-r--r--OpenSim/Tools/Compiler/Program.cs26
-rw-r--r--bin/NDesk.Options.dllbin0 -> 22016 bytes
-rw-r--r--bin/OpenSim.ini.example3
-rw-r--r--prebuild.xml3
62 files changed, 6423 insertions, 1305 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index ee263a1..8744a08 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -158,6 +158,7 @@ This software uses components from the following developers:
158* Nini (http://nini.sourceforge.net/) 158* Nini (http://nini.sourceforge.net/)
159* log4net (http://logging.apache.org/log4net/) 159* log4net (http://logging.apache.org/log4net/)
160* GlynnTucker.Cache (http://gtcache.sourceforge.net/) 160* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
161* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
161 162
162Some plugins are based on Cable Beach 163Some plugins are based on Cable Beach
163Cable Beach is Copyright (c) 2008 Intel Corporation 164Cable Beach is Copyright (c) 2008 Intel Corporation
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 3bc557d..325816d 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -213,9 +213,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController
213 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) 213 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
214 throw new Exception("region not found"); 214 throw new Exception("region not found");
215 215
216 int timeout = 30000;
217 string message;
218
219 if (requestData.ContainsKey("restart")
220 && ((string)requestData["restart"] == "delayed")
221 && requestData.ContainsKey("milliseconds"))
222 {
223 timeout = Int32.Parse(requestData["milliseconds"].ToString());
224
225 if (timeout < 15000)
226 {
227 //It must be at least 15 seconds or we'll cancel the reboot request
228 timeout = 15000;
229 }
230
231 message
232 = "Region is restarting in " + ((int)(timeout / 1000)).ToString()
233 + " second(s). Please save what you are doing and log out.";
234 }
235 else
236 {
237 message = "Region is restarting in 30 second(s). Please save what you are doing and log out.";
238 }
239
240 if (requestData.ContainsKey("noticetype")
241 && ((string)requestData["noticetype"] == "dialog"))
242 {
243 m_app.SceneManager.ForEachScene(
244 delegate(Scene scene)
245 {
246 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
247 if (dialogModule != null)
248 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
249 });
250 }
251 else
252 {
253 if (!requestData.ContainsKey("noticetype")
254 || ((string)requestData["noticetype"] != "none"))
255 {
256 m_app.SceneManager.ForEachScene(
257 delegate(Scene scene)
258 {
259 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
260 if (dialogModule != null)
261 dialogModule.SendGeneralAlert(message);
262 });
263 }
264 }
265
216 responseData["rebooting"] = true; 266 responseData["rebooting"] = true;
217 response.Value = responseData; 267 response.Value = responseData;
218 rebootedScene.Restart(30); 268 rebootedScene.Restart(timeout / 1000,false);
219 } 269 }
220 catch (Exception e) 270 catch (Exception e)
221 { 271 {
@@ -419,13 +469,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
419 message = "Region is going down now."; 469 message = "Region is going down now.";
420 } 470 }
421 471
422 m_app.SceneManager.ForEachScene( 472 if (requestData.ContainsKey("noticetype")
473 && ((string) requestData["noticetype"] == "dialog"))
474 {
475 m_app.SceneManager.ForEachScene(
423 delegate(Scene scene) 476 delegate(Scene scene)
424 { 477 {
425 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 478 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
426 if (dialogModule != null) 479 if (dialogModule != null)
480 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
481 });
482 }
483 else
484 {
485 if (!requestData.ContainsKey("noticetype")
486 || ((string)requestData["noticetype"] != "none"))
487 {
488 m_app.SceneManager.ForEachScene(
489 delegate(Scene scene)
490 {
491 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
492 if (dialogModule != null)
427 dialogModule.SendGeneralAlert(message); 493 dialogModule.SendGeneralAlert(message);
428 }); 494 });
495 }
496 }
497
498
429 499
430 // Perform shutdown 500 // Perform shutdown
431 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 501 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 063dd91..0ea0cb7 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
@@ -463,6 +464,125 @@ namespace OpenSim.Data.MySQL
463 } 464 }
464 } 465 }
465 466
467 #region Inventory Rollback-via-.sql Support
468 /// <summary>
469 /// Not a good SQL escape function, but it'll do the job (if mutilate the data.)
470 /// Someone may want to write something better here.
471 /// </summary>
472 /// <param name="str"></param>
473 /// <returns></returns>
474 private static string cheapSQLescape(string str)
475 {
476 str = str.Replace("\\", "");
477 str = str.Replace("'", "");
478 str = str.Replace("\"", "");
479 return "'" + str + "'";
480 }
481
482 private static string InventoryItemToSql(InventoryItemBase item)
483 {
484 string sql =
485 "REPLACE /*! INVITEM AT ***$SUBS$*** */ INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName"
486 + ", inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType"
487 + ", creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, inventoryGroupPermissions, salePrice, saleType"
488 + ", creationDate, groupID, groupOwned, flags) VALUES ";
489 sql +=
490 "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription"
491 + ", ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID"
492 + ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?inventoryGroupPermissions, ?salePrice, ?saleType, ?creationDate"
493 + ", ?groupID, ?groupOwned, ?flags);\r\n";
494
495 string itemName = item.Name;
496 string itemDesc = item.Description;
497
498 sql = sql.Replace("$SUBS$", Util.UnixTimeSinceEpoch().ToString());
499
500 sql = sql.Replace("?inventoryID", cheapSQLescape(item.ID.ToString()));
501 sql = sql.Replace("?assetID", cheapSQLescape(item.AssetID.ToString()));
502 sql = sql.Replace("?assetType", cheapSQLescape(item.AssetType.ToString()));
503 sql = sql.Replace("?parentFolderID", cheapSQLescape(item.Folder.ToString()));
504 sql = sql.Replace("?avatarID", cheapSQLescape(item.Owner.ToString()));
505 sql = sql.Replace("?inventoryName", cheapSQLescape(itemName));
506 sql = sql.Replace("?inventoryDescription", cheapSQLescape(itemDesc));
507 sql = sql.Replace("?inventoryNextPermissions", cheapSQLescape(item.NextPermissions.ToString()));
508 sql = sql.Replace("?inventoryCurrentPermissions", cheapSQLescape(item.CurrentPermissions.ToString()));
509 sql = sql.Replace("?invType", cheapSQLescape(item.InvType.ToString()));
510 sql = sql.Replace("?creatorID", cheapSQLescape(item.CreatorId));
511 sql = sql.Replace("?inventoryBasePermissions", cheapSQLescape(item.BasePermissions.ToString()));
512 sql = sql.Replace("?inventoryEveryOnePermissions", cheapSQLescape(item.EveryOnePermissions.ToString()));
513 sql = sql.Replace("?inventoryGroupPermissions", cheapSQLescape(item.GroupPermissions.ToString()));
514 sql = sql.Replace("?salePrice", cheapSQLescape(item.SalePrice.ToString()));
515 sql = sql.Replace("?saleType", cheapSQLescape(unchecked((sbyte)item.SaleType).ToString()));
516 sql = sql.Replace("?creationDate", cheapSQLescape(item.CreationDate.ToString()));
517 sql = sql.Replace("?groupID", cheapSQLescape(item.GroupID.ToString()));
518 sql = sql.Replace("?groupOwned", cheapSQLescape(item.GroupOwned.ToString()));
519 sql = sql.Replace("?flags", cheapSQLescape(item.Flags.ToString()));
520
521 return sql;
522 }
523
524 private static string InventoryFolderToSql(InventoryFolderBase folder)
525 {
526 string sql =
527 "REPLACE /*! INVFOLDER AT ***$SUBS$*** */ INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES ";
528 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version);\r\n";
529
530 string folderName = folder.Name;
531
532 sql = sql.Replace("$SUBS$", Util.UnixTimeSinceEpoch().ToString());
533
534 sql = sql.Replace("?folderID", cheapSQLescape(folder.ID.ToString()));
535 sql = sql.Replace("?agentID", cheapSQLescape(folder.Owner.ToString()));
536 sql = sql.Replace("?parentFolderID", cheapSQLescape(folder.ParentID.ToString()));
537 sql = sql.Replace("?folderName", cheapSQLescape(folderName));
538 sql = sql.Replace("?type", cheapSQLescape(folder.Type.ToString()));
539 sql = sql.Replace("?version", cheapSQLescape(folder.Version.ToString()));
540
541 return sql;
542 }
543
544 private static string getRollbackFolderDate()
545 {
546 return DateTime.UtcNow.Year.ToString() + "-" + DateTime.UtcNow.Month.ToString() + "-" +
547 DateTime.UtcNow.Day.ToString();
548 }
549
550 private void StoreRollbackItem(UUID ItemID)
551 {
552 if(rollbackStore == true)
553 {
554 string todaysPath = RollbackGetTodaysPath();
555
556 InventoryItemBase imb = getInventoryItem(ItemID);
557 string sql = InventoryItemToSql(imb);
558 File.AppendAllText(Path.Combine(todaysPath, imb.Owner.ToString()), sql);
559 }
560 }
561
562 private void StoreRollbackFolder(UUID FolderID)
563 {
564 if (rollbackStore == true)
565 {
566 string todaysPath = RollbackGetTodaysPath();
567
568 InventoryFolderBase ifb = getInventoryFolder(FolderID);
569 string sql = InventoryFolderToSql(ifb);
570 File.AppendAllText(Path.Combine(todaysPath, ifb.Owner.ToString()), sql);
571 }
572 }
573
574 private string RollbackGetTodaysPath()
575 {
576 if (!Directory.Exists(rollbackDir))
577 Directory.CreateDirectory(rollbackDir);
578
579 string todaysPath = Path.Combine(rollbackDir, getRollbackFolderDate());
580 if (!Directory.Exists(todaysPath))
581 Directory.CreateDirectory(todaysPath);
582 return todaysPath;
583 }
584 #endregion
585
466 /// <summary> 586 /// <summary>
467 /// Adds a specified item to the database 587 /// Adds a specified item to the database
468 /// </summary> 588 /// </summary>
@@ -549,6 +669,8 @@ namespace OpenSim.Data.MySQL
549 /// <param name="item">Inventory item to update</param> 669 /// <param name="item">Inventory item to update</param>
550 public void updateInventoryItem(InventoryItemBase item) 670 public void updateInventoryItem(InventoryItemBase item)
551 { 671 {
672 StoreRollbackItem(item.ID);
673
552 addInventoryItem(item); 674 addInventoryItem(item);
553 } 675 }
554 676
@@ -558,6 +680,8 @@ namespace OpenSim.Data.MySQL
558 /// <param name="item">The inventory item UUID to delete</param> 680 /// <param name="item">The inventory item UUID to delete</param>
559 public void deleteInventoryItem(UUID itemID) 681 public void deleteInventoryItem(UUID itemID)
560 { 682 {
683 StoreRollbackItem(itemID);
684
561 try 685 try
562 { 686 {
563 database.CheckConnection(); 687 database.CheckConnection();
@@ -634,6 +758,7 @@ namespace OpenSim.Data.MySQL
634 /// <param name="folder">Folder to update</param> 758 /// <param name="folder">Folder to update</param>
635 public void updateInventoryFolder(InventoryFolderBase folder) 759 public void updateInventoryFolder(InventoryFolderBase folder)
636 { 760 {
761 StoreRollbackFolder(folder.ID);
637 addInventoryFolder(folder); 762 addInventoryFolder(folder);
638 } 763 }
639 764
@@ -644,6 +769,8 @@ namespace OpenSim.Data.MySQL
644 /// <remarks>UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID</remarks> 769 /// <remarks>UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID</remarks>
645 public void moveInventoryFolder(InventoryFolderBase folder) 770 public void moveInventoryFolder(InventoryFolderBase folder)
646 { 771 {
772 StoreRollbackFolder(folder.ID);
773
647 string sql = 774 string sql =
648 "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID"; 775 "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID";
649 776
@@ -805,6 +932,8 @@ namespace OpenSim.Data.MySQL
805 /// <param name="folderID">the folder UUID</param> 932 /// <param name="folderID">the folder UUID</param>
806 protected void deleteOneFolder(UUID folderID) 933 protected void deleteOneFolder(UUID folderID)
807 { 934 {
935 StoreRollbackFolder(folderID);
936
808 try 937 try
809 { 938 {
810 database.CheckConnection(); 939 database.CheckConnection();
@@ -831,6 +960,14 @@ namespace OpenSim.Data.MySQL
831 /// <param name="folderID">the folder UUID</param> 960 /// <param name="folderID">the folder UUID</param>
832 protected void deleteItemsInFolder(UUID folderID) 961 protected void deleteItemsInFolder(UUID folderID)
833 { 962 {
963 if (rollbackStore)
964 {
965 foreach (InventoryItemBase itemBase in getInventoryInFolder(folderID))
966 {
967 StoreRollbackItem(itemBase.ID);
968 }
969 }
970
834 try 971 try
835 { 972 {
836 database.CheckConnection(); 973 database.CheckConnection();
@@ -865,17 +1002,34 @@ namespace OpenSim.Data.MySQL
865 //Delete all sub-folders 1002 //Delete all sub-folders
866 foreach (InventoryFolderBase f in subFolders) 1003 foreach (InventoryFolderBase f in subFolders)
867 { 1004 {
1005 StoreRollbackFolder(f.ID);
868 deleteOneFolder(f.ID); 1006 deleteOneFolder(f.ID);
1007
1008 if(rollbackStore)
1009 {
1010 foreach (InventoryItemBase itemBase in getInventoryInFolder(f.ID))
1011 {
1012 StoreRollbackItem(itemBase.ID);
1013 }
1014 }
869 deleteItemsInFolder(f.ID); 1015 deleteItemsInFolder(f.ID);
870 } 1016 }
871 } 1017 }
872 1018
1019 StoreRollbackFolder(folderID);
873 //Delete the actual row 1020 //Delete the actual row
874 deleteOneFolder(folderID); 1021 deleteOneFolder(folderID);
875 1022
876 // Just delete the folder context in OGM 1023 // Just delete the folder context in OGM
877 if (opengridmode == false) 1024 if (opengridmode == false)
878 { 1025 {
1026 if (rollbackStore)
1027 {
1028 foreach (InventoryItemBase itemBase in getInventoryInFolder(folderID))
1029 {
1030 StoreRollbackItem(itemBase.ID);
1031 }
1032 }
879 deleteItemsInFolder(folderID); 1033 deleteItemsInFolder(folderID);
880 } 1034 }
881 } 1035 }
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 307c6bc..cd59c63 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -32,7 +32,6 @@ namespace OpenSim.Framework
32{ 32{
33 public delegate void ExpectUserDelegate(AgentCircuitData agent); 33 public delegate void ExpectUserDelegate(AgentCircuitData agent);
34 34
35 public delegate bool ExpectPrimDelegate(UUID primID, string objData, int XMLMethod);
36 35
37 public delegate void UpdateNeighbours(List<RegionInfo> neighbours); 36 public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
38 37
@@ -55,7 +54,6 @@ namespace OpenSim.Framework
55 public interface IRegionCommsListener 54 public interface IRegionCommsListener
56 { 55 {
57 event ExpectUserDelegate OnExpectUser; 56 event ExpectUserDelegate OnExpectUser;
58 event ExpectPrimDelegate OnExpectPrim;
59 event GenericCall2 OnExpectChildAgent; 57 event GenericCall2 OnExpectChildAgent;
60 event AgentCrossing OnAvatarCrossingIntoRegion; 58 event AgentCrossing OnAvatarCrossingIntoRegion;
61 event PrimCrossing OnPrimCrossingIntoRegion; 59 event PrimCrossing OnPrimCrossingIntoRegion;
diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs
index 4fc3e01..5147901 100644
--- a/OpenSim/Framework/ISceneObject.cs
+++ b/OpenSim/Framework/ISceneObject.cs
@@ -38,6 +38,6 @@ namespace OpenSim.Framework
38 string ExtraToXmlString(); 38 string ExtraToXmlString();
39 void ExtraFromXmlString(string xmlstr); 39 void ExtraFromXmlString(string xmlstr);
40 string GetStateSnapshot(); 40 string GetStateSnapshot();
41 void SetState(string xmlstr, UUID regionID); 41 void SetState(string xmlstr, IScene s);
42 } 42 }
43} 43}
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index 90200d6..718a556 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -43,7 +43,6 @@ namespace OpenSim.Framework
43 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 43 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
44 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; 44 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
45 private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; 45 private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent;
46 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
47 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser 46 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
48 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; 47 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
49 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 48 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
@@ -53,7 +52,6 @@ namespace OpenSim.Framework
53 #region IRegionCommsListener Members 52 #region IRegionCommsListener Members
54 53
55 public event ExpectUserDelegate OnExpectUser; 54 public event ExpectUserDelegate OnExpectUser;
56 public event ExpectPrimDelegate OnExpectPrim;
57 public event GenericCall2 OnExpectChildAgent; 55 public event GenericCall2 OnExpectChildAgent;
58 public event AgentCrossing OnAvatarCrossingIntoRegion; 56 public event AgentCrossing OnAvatarCrossingIntoRegion;
59 public event PrimCrossing OnPrimCrossingIntoRegion; 57 public event PrimCrossing OnPrimCrossingIntoRegion;
@@ -95,17 +93,6 @@ namespace OpenSim.Framework
95 93
96 } 94 }
97 95
98 public virtual bool TriggerExpectPrim(UUID primID, string objData, int XMLMethod)
99 {
100 handlerExpectPrim = OnExpectPrim;
101 if (handlerExpectPrim != null)
102 {
103 handlerExpectPrim(primID, objData, XMLMethod);
104 return true;
105 }
106 return false;
107 }
108
109 public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) 96 public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
110 { 97 {
111 handlerChildAgentUpdate = OnChildAgentUpdate; 98 handlerChildAgentUpdate = OnChildAgentUpdate;
@@ -128,18 +115,6 @@ namespace OpenSim.Framework
128 return false; 115 return false;
129 } 116 }
130 117
131 public virtual bool TriggerExpectPrimCrossing(UUID primID, Vector3 position,
132 bool isPhysical)
133 {
134 handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
135 if (handlerPrimCrossingIntoRegion != null)
136 {
137 handlerPrimCrossingIntoRegion(primID, position, isPhysical);
138 return true;
139 }
140 return false;
141 }
142
143 public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) 118 public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID)
144 { 119 {
145 handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; 120 handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed;
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 9f98310..0d4215b 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.6.8"; 32 private const string VERSION_NUMBER = "0.6.9-CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 34
35 public enum Flavour 35 public enum Flavour
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 25ae6b0..efe5f0c 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -27,9 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
31using System.Reflection;
30using System.Xml; 32using System.Xml;
31using System.Xml.Schema; 33using System.Xml.Schema;
32using System.Xml.Serialization; 34using System.Xml.Serialization;
35using log4net;
33using OpenMetaverse; 36using OpenMetaverse;
34 37
35namespace OpenSim.Framework 38namespace OpenSim.Framework
@@ -45,6 +48,105 @@ namespace OpenSim.Framework
45 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 49
47 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); 50 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 private Thread LockedByThread;
54 /// <value>
55 /// An advanced lock for inventory data
56 /// </value>
57 private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
58
59 /// <summary>
60 /// Are we readlocked by the calling thread?
61 /// </summary>
62 public bool IsReadLockedByMe()
63 {
64 if (m_itemLock.RecursiveReadCount > 0)
65 {
66 return true;
67 }
68 else
69 {
70 return false;
71 }
72 }
73
74 /// <summary>
75 /// Lock our inventory list for reading (many can read, one can write)
76 /// </summary>
77 public void LockItemsForRead(bool locked)
78 {
79 if (locked)
80 {
81 if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
82 {
83 if (!LockedByThread.IsAlive)
84 {
85 //Locked by dead thread, reset.
86 m_itemLock = new System.Threading.ReaderWriterLockSlim();
87 }
88 }
89
90 if (m_itemLock.RecursiveReadCount > 0)
91 {
92 m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
93 m_itemLock.ExitReadLock();
94 }
95 if (m_itemLock.RecursiveWriteCount > 0)
96 {
97 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
98 m_itemLock.ExitWriteLock();
99 }
100
101 while (!m_itemLock.TryEnterReadLock(60000))
102 {
103 m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
104 if (m_itemLock.IsWriteLockHeld)
105 {
106 m_itemLock = new System.Threading.ReaderWriterLockSlim();
107 }
108 }
109 }
110 else
111 {
112 m_itemLock.ExitReadLock();
113 }
114 }
115
116 /// <summary>
117 /// Lock our inventory list for writing (many can read, one can write)
118 /// </summary>
119 public void LockItemsForWrite(bool locked)
120 {
121 if (locked)
122 {
123 //Enter a write lock, wait indefinately for one to open.
124 if (m_itemLock.RecursiveReadCount > 0)
125 {
126 m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
127 m_itemLock.ExitReadLock();
128 }
129 if (m_itemLock.RecursiveWriteCount > 0)
130 {
131 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
132 m_itemLock.ExitWriteLock();
133 }
134 while (!m_itemLock.TryEnterWriteLock(60000))
135 {
136 m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
137 if (m_itemLock.IsWriteLockHeld)
138 {
139 m_itemLock = new System.Threading.ReaderWriterLockSlim();
140 }
141 }
142
143 LockedByThread = Thread.CurrentThread;
144 }
145 else
146 {
147 m_itemLock.ExitWriteLock();
148 }
149 }
48 150
49 #region ICloneable Members 151 #region ICloneable Members
50 152
@@ -52,13 +154,12 @@ namespace OpenSim.Framework
52 { 154 {
53 TaskInventoryDictionary clone = new TaskInventoryDictionary(); 155 TaskInventoryDictionary clone = new TaskInventoryDictionary();
54 156
55 lock (this) 157 m_itemLock.EnterReadLock();
158 foreach (UUID uuid in Keys)
56 { 159 {
57 foreach (UUID uuid in Keys) 160 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
58 {
59 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
60 }
61 } 161 }
162 m_itemLock.ExitReadLock();
62 163
63 return clone; 164 return clone;
64 } 165 }
diff --git a/OpenSim/Framework/Tests/CacheTests.cs b/OpenSim/Framework/Tests/CacheTests.cs
index e2afd2a..32c0c95 100644
--- a/OpenSim/Framework/Tests/CacheTests.cs
+++ b/OpenSim/Framework/Tests/CacheTests.cs
@@ -78,8 +78,9 @@ namespace OpenSim.Framework.Tests
78 foo[0] = 1; 78 foo[0] = 1;
79 cachedItem.Store(foo); 79 cachedItem.Store(foo);
80 cache.Store(cacheItemUUID.ToString(), cachedItem); 80 cache.Store(cacheItemUUID.ToString(), cachedItem);
81 81
82 object citem = cache.Get(cacheItemUUID.ToString()); 82 cache.Get(cacheItemUUID.ToString());
83 //object citem = cache.Get(cacheItemUUID.ToString());
83 //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now"); 84 //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now");
84 } 85 }
85 86
@@ -94,7 +95,8 @@ namespace OpenSim.Framework.Tests
94 cachedItem.Store(foo); 95 cachedItem.Store(foo);
95 cache.Store(cacheItemUUID.ToString(), cachedItem); 96 cache.Store(cacheItemUUID.ToString(), cachedItem);
96 cache.Invalidate(ImmediateExpiryUUID.ToString()); 97 cache.Invalidate(ImmediateExpiryUUID.ToString());
97 object citem = cache.Get(cacheItemUUID.ToString()); 98 cache.Get(cacheItemUUID.ToString());
99 //object citem = cache.Get(cacheItemUUID.ToString());
98 //Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); 100 //Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
99 } 101 }
100 102
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 87ba5a8..c052745 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -990,19 +990,19 @@ namespace OpenSim.Framework
990 { 990 {
991 string os = String.Empty; 991 string os = String.Empty;
992 992
993 if (Environment.OSVersion.Platform != PlatformID.Unix) 993// if (Environment.OSVersion.Platform != PlatformID.Unix)
994 { 994// {
995 os = Environment.OSVersion.ToString(); 995// os = Environment.OSVersion.ToString();
996 } 996// }
997 else 997// else
998 { 998// {
999 os = ReadEtcIssue(); 999// os = ReadEtcIssue();
1000 } 1000// }
1001 1001//
1002 if (os.Length > 45) 1002// if (os.Length > 45)
1003 { 1003// {
1004 os = os.Substring(0, 45); 1004// os = os.Substring(0, 45);
1005 } 1005// }
1006 1006
1007 return os; 1007 return os;
1008 } 1008 }
diff --git a/OpenSim/Region/Application/HGCommands.cs b/OpenSim/Region/Application/HGCommands.cs
index f503db7..7ae161d 100644
--- a/OpenSim/Region/Application/HGCommands.cs
+++ b/OpenSim/Region/Application/HGCommands.cs
@@ -42,7 +42,7 @@ namespace OpenSim
42{ 42{
43 public class HGCommands 43 public class HGCommands
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, 47 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
48 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) 48 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 60c34df..5228e4b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -232,7 +232,7 @@ namespace OpenSim
232 "Save named prim to XML2", SavePrimsXml2); 232 "Save named prim to XML2", SavePrimsXml2);
233 233
234 m_console.Commands.AddCommand("region", false, "load oar", 234 m_console.Commands.AddCommand("region", false, "load oar",
235 "load oar <oar name>", 235 "load oar [--merge] <oar name>",
236 "Load a region's data from OAR archive", LoadOar); 236 "Load a region's data from OAR archive", LoadOar);
237 237
238 m_console.Commands.AddCommand("region", false, "save oar", 238 m_console.Commands.AddCommand("region", false, "save oar",
@@ -1294,14 +1294,7 @@ namespace OpenSim
1294 { 1294 {
1295 try 1295 try
1296 { 1296 {
1297 if (cmdparams.Length > 2) 1297 m_sceneManager.LoadArchiveToCurrentScene(cmdparams);
1298 {
1299 m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]);
1300 }
1301 else
1302 {
1303 m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
1304 }
1305 } 1298 }
1306 catch (Exception e) 1299 catch (Exception e)
1307 { 1300 {
@@ -1315,14 +1308,7 @@ namespace OpenSim
1315 /// <param name="cmdparams"></param> 1308 /// <param name="cmdparams"></param>
1316 protected void SaveOar(string module, string[] cmdparams) 1309 protected void SaveOar(string module, string[] cmdparams)
1317 { 1310 {
1318 if (cmdparams.Length > 2) 1311 m_sceneManager.SaveCurrentSceneToArchive(cmdparams);
1319 {
1320 m_sceneManager.SaveCurrentSceneToArchive(cmdparams[2]);
1321 }
1322 else
1323 {
1324 m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME);
1325 }
1326 } 1312 }
1327 1313
1328 private static string CombineParams(string[] commandParams, int pos) 1314 private static string CombineParams(string[] commandParams, int pos)
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index cc18f1a..391856b 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -75,11 +75,6 @@ namespace OpenSim
75 /// </value> 75 /// </value>
76 protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; 76 protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml";
77 77
78 /// <value>
79 /// The file used to load and save an opensimulator archive if no filename has been specified
80 /// </value>
81 protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar";
82
83 public ConfigSettings ConfigurationSettings 78 public ConfigSettings ConfigurationSettings
84 { 79 {
85 get { return m_configSettings; } 80 get { return m_configSettings; }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 47251b7..ac16b02 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4307,15 +4307,168 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4307 AddLocalPacketHandler(PacketType.AgentRequestSit, HandleAgentRequestSit); 4307 AddLocalPacketHandler(PacketType.AgentRequestSit, HandleAgentRequestSit);
4308 AddLocalPacketHandler(PacketType.AgentSit, HandleAgentSit); 4308 AddLocalPacketHandler(PacketType.AgentSit, HandleAgentSit);
4309 AddLocalPacketHandler(PacketType.SoundTrigger, HandleSoundTrigger); 4309 AddLocalPacketHandler(PacketType.SoundTrigger, HandleSoundTrigger);
4310 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4310 AddLocalPacketHandler(PacketType.AvatarPickerRequest, HandleAvatarPickerRequest);
4311 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4311 AddLocalPacketHandler(PacketType.AgentDataUpdateRequest, HandleAgentDataUpdateRequest);
4312 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4312 AddLocalPacketHandler(PacketType.UserInfoRequest, HandleUserInfoRequest);
4313 //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 4313 AddLocalPacketHandler(PacketType.UpdateUserInfo, HandleUpdateUserInfo);
4314 4314 AddLocalPacketHandler(PacketType.SetStartLocationRequest, HandleSetStartLocationRequest);
4315 AddLocalPacketHandler(PacketType.AgentThrottle, HandleAgentThrottle);
4316 AddLocalPacketHandler(PacketType.AgentPause, HandleAgentPause);
4317 AddLocalPacketHandler(PacketType.AgentResume, HandleAgentResume);
4318 AddLocalPacketHandler(PacketType.ForceScriptControlRelease, HandleForceScriptControlRelease);
4319 AddLocalPacketHandler(PacketType.ObjectLink, HandleObjectLink);
4320 AddLocalPacketHandler(PacketType.ObjectDelink, HandleObjectDelink);
4321 AddLocalPacketHandler(PacketType.ObjectAdd, HandleObjectAdd);
4322 AddLocalPacketHandler(PacketType.ObjectShape, HandleObjectShape);
4323 AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams);
4324 AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate);
4325 AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects);
4326 AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect);
4327 AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect);
4328 AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition);
4329 AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
4330 AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
4331 AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
4332 AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage);
4333 AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab);
4334 AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate);
4335 AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
4336 AddLocalPacketHandler(PacketType.ObjectSpinStart, HandleObjectSpinStart);
4337 AddLocalPacketHandler(PacketType.ObjectSpinUpdate, HandleObjectSpinUpdate);
4338 AddLocalPacketHandler(PacketType.ObjectSpinStop, HandleObjectSpinStop);
4339 AddLocalPacketHandler(PacketType.ObjectDescription, HandleObjectDescription);
4340 AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName);
4341 AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions);
4342 AddLocalPacketHandler(PacketType.Undo, HandleUndo);
4343 AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay);
4344 AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily);
4345 AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch);
4346 AddLocalPacketHandler(PacketType.ScriptAnswerYes, HandleScriptAnswerYes);
4347 AddLocalPacketHandler(PacketType.ObjectClickAction, HandleObjectClickAction);
4348 AddLocalPacketHandler(PacketType.ObjectMaterial, HandleObjectMaterial);
4349 AddLocalPacketHandler(PacketType.RequestImage, HandleRequestImage);
4350 AddLocalPacketHandler(PacketType.TransferRequest, HandleTransferRequest);
4351 AddLocalPacketHandler(PacketType.AssetUploadRequest, HandleAssetUploadRequest);
4352 AddLocalPacketHandler(PacketType.RequestXfer, HandleRequestXfer);
4353 AddLocalPacketHandler(PacketType.SendXferPacket, HandleSendXferPacket);
4354 AddLocalPacketHandler(PacketType.ConfirmXferPacket, HandleConfirmXferPacket);
4355 AddLocalPacketHandler(PacketType.AbortXfer, HandleAbortXfer);
4356 AddLocalPacketHandler(PacketType.CreateInventoryFolder, HandleCreateInventoryFolder);
4357 AddLocalPacketHandler(PacketType.UpdateInventoryFolder, HandleUpdateInventoryFolder);
4358 AddLocalPacketHandler(PacketType.MoveInventoryFolder, HandleMoveInventoryFolder);
4359 AddLocalPacketHandler(PacketType.CreateInventoryItem, HandleCreateInventoryItem);
4360 AddLocalPacketHandler(PacketType.FetchInventory, HandleFetchInventory);
4361 AddLocalPacketHandler(PacketType.FetchInventoryDescendents, HandleFetchInventoryDescendents);
4362 AddLocalPacketHandler(PacketType.PurgeInventoryDescendents, HandlePurgeInventoryDescendents);
4363 AddLocalPacketHandler(PacketType.UpdateInventoryItem, HandleUpdateInventoryItem);
4364 AddLocalPacketHandler(PacketType.CopyInventoryItem, HandleCopyInventoryItem);
4365 AddLocalPacketHandler(PacketType.MoveInventoryItem, HandleMoveInventoryItem);
4366 AddLocalPacketHandler(PacketType.RemoveInventoryItem, HandleRemoveInventoryItem);
4367 AddLocalPacketHandler(PacketType.RemoveInventoryFolder, HandleRemoveInventoryFolder);
4368 AddLocalPacketHandler(PacketType.RemoveInventoryObjects, HandleRemoveInventoryObjects);
4369 AddLocalPacketHandler(PacketType.RequestTaskInventory, HandleRequestTaskInventory);
4370 AddLocalPacketHandler(PacketType.UpdateTaskInventory, HandleUpdateTaskInventory);
4371 AddLocalPacketHandler(PacketType.RemoveTaskInventory, HandleRemoveTaskInventory);
4372 AddLocalPacketHandler(PacketType.MoveTaskInventory, HandleMoveTaskInventory);
4373 AddLocalPacketHandler(PacketType.RezScript, HandleRezScript);
4374 AddLocalPacketHandler(PacketType.MapLayerRequest, HandleMapLayerRequest);
4375 AddLocalPacketHandler(PacketType.MapBlockRequest, HandleMapBlockRequest);
4376 AddLocalPacketHandler(PacketType.MapNameRequest, HandleMapNameRequest);
4377 AddLocalPacketHandler(PacketType.TeleportLandmarkRequest, HandleTeleportLandmarkRequest);
4378 AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest);
4379 AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest);
4380 AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest);
4381 AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest);
4382 AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest);
4383 AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate);
4384 AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest);
4385 AddLocalPacketHandler(PacketType.ParcelDivide, HandleParcelDivide);
4386 AddLocalPacketHandler(PacketType.ParcelJoin, HandleParcelJoin);
4387 AddLocalPacketHandler(PacketType.ParcelPropertiesUpdate, HandleParcelPropertiesUpdate);
4388 AddLocalPacketHandler(PacketType.ParcelSelectObjects, HandleParcelSelectObjects);
4389 AddLocalPacketHandler(PacketType.ParcelObjectOwnersRequest, HandleParcelObjectOwnersRequest);
4390 AddLocalPacketHandler(PacketType.ParcelGodForceOwner, HandleParcelGodForceOwner);
4391 AddLocalPacketHandler(PacketType.ParcelRelease, HandleParcelRelease);
4392 AddLocalPacketHandler(PacketType.ParcelReclaim, HandleParcelReclaim);
4393 AddLocalPacketHandler(PacketType.ParcelReturnObjects, HandleParcelReturnObjects);
4394 AddLocalPacketHandler(PacketType.ParcelSetOtherCleanTime, HandleParcelSetOtherCleanTime);
4395 AddLocalPacketHandler(PacketType.LandStatRequest, HandleLandStatRequest);
4396 AddLocalPacketHandler(PacketType.ParcelDwellRequest, HandleParcelDwellRequest);
4397 AddLocalPacketHandler(PacketType.EstateOwnerMessage, HandleEstateOwnerMessage);
4398 AddLocalPacketHandler(PacketType.RequestRegionInfo, HandleRequestRegionInfo);
4399 AddLocalPacketHandler(PacketType.EstateCovenantRequest, HandleEstateCovenantRequest);
4400 AddLocalPacketHandler(PacketType.RequestGodlikePowers, HandleRequestGodlikePowers);
4401 AddLocalPacketHandler(PacketType.GodKickUser, HandleGodKickUser);
4402 AddLocalPacketHandler(PacketType.MoneyBalanceRequest, HandleMoneyBalanceRequest);
4403 AddLocalPacketHandler(PacketType.EconomyDataRequest, HandleEconomyDataRequest);
4404 AddLocalPacketHandler(PacketType.RequestPayPrice, HandleRequestPayPrice);
4405 AddLocalPacketHandler(PacketType.ObjectSaleInfo, HandleObjectSaleInfo);
4406 AddLocalPacketHandler(PacketType.ObjectBuy, HandleObjectBuy);
4407 AddLocalPacketHandler(PacketType.GetScriptRunning, HandleGetScriptRunning);
4408 AddLocalPacketHandler(PacketType.SetScriptRunning, HandleSetScriptRunning);
4409 AddLocalPacketHandler(PacketType.ScriptReset, HandleScriptReset);
4410 AddLocalPacketHandler(PacketType.ActivateGestures, HandleActivateGestures);
4411 AddLocalPacketHandler(PacketType.DeactivateGestures, HandleDeactivateGestures);
4412 AddLocalPacketHandler(PacketType.ObjectOwner, HandleObjectOwner);
4413 AddLocalPacketHandler(PacketType.AgentFOV, HandleAgentFOV);
4414 AddLocalPacketHandler(PacketType.ViewerStats, HandleViewerStats);
4415 AddLocalPacketHandler(PacketType.MapItemRequest, HandleMapItemRequest);
4416 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort);
4417 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest);
4418 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
4419 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth);
4420 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
4421 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
4422 AddLocalPacketHandler(PacketType.DirFindQuery, HandleDirFindQuery);
4423 AddLocalPacketHandler(PacketType.DirLandQuery, HandleDirLandQuery);
4424 AddLocalPacketHandler(PacketType.DirPopularQuery, HandleDirPopularQuery);
4425 AddLocalPacketHandler(PacketType.DirClassifiedQuery, HandleDirClassifiedQuery);
4426 AddLocalPacketHandler(PacketType.EventInfoRequest, HandleEventInfoRequest);
4427 AddLocalPacketHandler(PacketType.OfferCallingCard, HandleOfferCallingCard);
4428 AddLocalPacketHandler(PacketType.AcceptCallingCard, HandleAcceptCallingCard);
4429 AddLocalPacketHandler(PacketType.DeclineCallingCard, HandleDeclineCallingCard);
4430 AddLocalPacketHandler(PacketType.ActivateGroup, HandleActivateGroup);
4431 AddLocalPacketHandler(PacketType.GroupTitlesRequest, HandleGroupTitlesRequest);
4432 AddLocalPacketHandler(PacketType.GroupProfileRequest, HandleGroupProfileRequest);
4433 AddLocalPacketHandler(PacketType.GroupMembersRequest, HandleGroupMembersRequest);
4434 AddLocalPacketHandler(PacketType.GroupRoleDataRequest, HandleGroupRoleDataRequest);
4435 AddLocalPacketHandler(PacketType.GroupRoleMembersRequest, HandleGroupRoleMembersRequest);
4436 AddLocalPacketHandler(PacketType.CreateGroupRequest, HandleCreateGroupRequest);
4437 AddLocalPacketHandler(PacketType.UpdateGroupInfo, HandleUpdateGroupInfo);
4438 AddLocalPacketHandler(PacketType.SetGroupAcceptNotices, HandleSetGroupAcceptNotices);
4439 AddLocalPacketHandler(PacketType.GroupTitleUpdate, HandleGroupTitleUpdate);
4440 AddLocalPacketHandler(PacketType.ParcelDeedToGroup, HandleParcelDeedToGroup);
4441 AddLocalPacketHandler(PacketType.GroupNoticesListRequest, HandleGroupNoticesListRequest);
4442 AddLocalPacketHandler(PacketType.GroupNoticeRequest, HandleGroupNoticeRequest);
4443 AddLocalPacketHandler(PacketType.GroupRoleUpdate, HandleGroupRoleUpdate);
4444 AddLocalPacketHandler(PacketType.GroupRoleChanges, HandleGroupRoleChanges);
4445 AddLocalPacketHandler(PacketType.JoinGroupRequest, HandleJoinGroupRequest);
4446 AddLocalPacketHandler(PacketType.LeaveGroupRequest, HandleLeaveGroupRequest);
4447 AddLocalPacketHandler(PacketType.EjectGroupMemberRequest, HandleEjectGroupMemberRequest);
4448 AddLocalPacketHandler(PacketType.InviteGroupRequest, HandleInviteGroupRequest);
4449 AddLocalPacketHandler(PacketType.StartLure, HandleStartLure);
4450 AddLocalPacketHandler(PacketType.TeleportLureRequest, HandleTeleportLureRequest);
4451 AddLocalPacketHandler(PacketType.ClassifiedInfoRequest, HandleClassifiedInfoRequest);
4452 AddLocalPacketHandler(PacketType.ClassifiedInfoUpdate, HandleClassifiedInfoUpdate);
4453 AddLocalPacketHandler(PacketType.ClassifiedDelete, HandleClassifiedDelete);
4454 AddLocalPacketHandler(PacketType.ClassifiedGodDelete, HandleClassifiedGodDelete);
4455 AddLocalPacketHandler(PacketType.EventGodDelete, HandleEventGodDelete);
4456 AddLocalPacketHandler(PacketType.EventNotificationAddRequest, HandleEventNotificationAddRequest);
4457 AddLocalPacketHandler(PacketType.EventNotificationRemoveRequest, HandleEventNotificationRemoveRequest);
4458 AddLocalPacketHandler(PacketType.RetrieveInstantMessages, HandleRetrieveInstantMessages);
4459 AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete);
4460 AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete);
4461 AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate);
4462 AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate);
4463 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate);
4464 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights);
4465 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery);
4315 } 4466 }
4316 4467
4317 #region Packet Handlers 4468 #region Packet Handlers
4318 4469
4470 #region Scene/Avatar
4471
4319 private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) 4472 private bool HandleAgentUpdate(IClientAPI sener, Packet Pack)
4320 { 4473 {
4321 if (OnAgentUpdate != null) 4474 if (OnAgentUpdate != null)
@@ -5243,6 +5396,4432 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5243 return true; 5396 return true;
5244 } 5397 }
5245 5398
5399 private bool HandleAvatarPickerRequest(IClientAPI sender, Packet Pack)
5400 {
5401 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
5402
5403 #region Packet Session and User Check
5404 if (m_checkPackets)
5405 {
5406 if (avRequestQuery.AgentData.SessionID != SessionId ||
5407 avRequestQuery.AgentData.AgentID != AgentId)
5408 return true;
5409 }
5410 #endregion
5411
5412 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
5413 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data;
5414 //m_log.Debug("Agent Sends:" + Utils.BytesToString(querydata.Name));
5415
5416 AvatarPickerRequest handlerAvatarPickerRequest = OnAvatarPickerRequest;
5417 if (handlerAvatarPickerRequest != null)
5418 {
5419 handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
5420 Utils.BytesToString(querydata.Name));
5421 }
5422 return true;
5423 }
5424
5425 private bool HandleAgentDataUpdateRequest(IClientAPI sender, Packet Pack)
5426 {
5427 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
5428
5429 #region Packet Session and User Check
5430 if (m_checkPackets)
5431 {
5432 if (avRequestDataUpdatePacket.AgentData.SessionID != SessionId ||
5433 avRequestDataUpdatePacket.AgentData.AgentID != AgentId)
5434 return true;
5435 }
5436 #endregion
5437
5438 FetchInventory handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest;
5439
5440 if (handlerAgentDataUpdateRequest != null)
5441 {
5442 handlerAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID);
5443 }
5444
5445 return true;
5446 }
5447
5448 private bool HandleUserInfoRequest(IClientAPI sender, Packet Pack)
5449 {
5450 UserInfoRequest handlerUserInfoRequest = OnUserInfoRequest;
5451 if (handlerUserInfoRequest != null)
5452 {
5453 handlerUserInfoRequest(this);
5454 }
5455 else
5456 {
5457 SendUserInfoReply(false, true, "");
5458 }
5459 return true;
5460
5461 }
5462
5463 private bool HandleUpdateUserInfo(IClientAPI sender, Packet Pack)
5464 {
5465 UpdateUserInfoPacket updateUserInfo = (UpdateUserInfoPacket)Pack;
5466
5467 #region Packet Session and User Check
5468 if (m_checkPackets)
5469 {
5470 if (updateUserInfo.AgentData.SessionID != SessionId ||
5471 updateUserInfo.AgentData.AgentID != AgentId)
5472 return true;
5473 }
5474 #endregion
5475
5476 UpdateUserInfo handlerUpdateUserInfo = OnUpdateUserInfo;
5477 if (handlerUpdateUserInfo != null)
5478 {
5479 bool visible = true;
5480 string DirectoryVisibility =
5481 Utils.BytesToString(updateUserInfo.UserData.DirectoryVisibility);
5482 if (DirectoryVisibility == "hidden")
5483 visible = false;
5484
5485 handlerUpdateUserInfo(
5486 updateUserInfo.UserData.IMViaEMail,
5487 visible, this);
5488 }
5489 return true;
5490 }
5491
5492 private bool HandleSetStartLocationRequest(IClientAPI sender, Packet Pack)
5493 {
5494 SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack;
5495
5496 #region Packet Session and User Check
5497 if (m_checkPackets)
5498 {
5499 if (avSetStartLocationRequestPacket.AgentData.SessionID != SessionId ||
5500 avSetStartLocationRequestPacket.AgentData.AgentID != AgentId)
5501 return true;
5502 }
5503 #endregion
5504
5505 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId)
5506 {
5507 TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest;
5508 if (handlerSetStartLocationRequest != null)
5509 {
5510 handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
5511 avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
5512 avSetStartLocationRequestPacket.StartLocationData.LocationID);
5513 }
5514 }
5515 return true;
5516 }
5517
5518 private bool HandleAgentThrottle(IClientAPI sender, Packet Pack)
5519 {
5520 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
5521
5522 #region Packet Session and User Check
5523 if (m_checkPackets)
5524 {
5525 if (atpack.AgentData.SessionID != SessionId ||
5526 atpack.AgentData.AgentID != AgentId)
5527 return true;
5528 }
5529 #endregion
5530
5531 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
5532 return true;
5533 }
5534
5535 private bool HandleAgentPause(IClientAPI sender, Packet Pack)
5536 {
5537 m_udpClient.IsPaused = true;
5538 return true;
5539 }
5540
5541 private bool HandleAgentResume(IClientAPI sender, Packet Pack)
5542 {
5543 m_udpClient.IsPaused = false;
5544 SendStartPingCheck(m_udpClient.CurrentPingSequence++);
5545 return true;
5546 }
5547
5548 private bool HandleForceScriptControlRelease(IClientAPI sender, Packet Pack)
5549 {
5550 ForceReleaseControls handlerForceReleaseControls = OnForceReleaseControls;
5551 if (handlerForceReleaseControls != null)
5552 {
5553 handlerForceReleaseControls(this, AgentId);
5554 }
5555 return true;
5556 }
5557
5558 #endregion Scene/Avatar
5559
5560 #region Objects/m_sceneObjects
5561
5562 private bool HandleObjectLink(IClientAPI sender, Packet Pack)
5563 {
5564 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
5565
5566 #region Packet Session and User Check
5567 if (m_checkPackets)
5568 {
5569 if (link.AgentData.SessionID != SessionId ||
5570 link.AgentData.AgentID != AgentId)
5571 return true;
5572 }
5573 #endregion
5574
5575 uint parentprimid = 0;
5576 List<uint> childrenprims = new List<uint>();
5577 if (link.ObjectData.Length > 1)
5578 {
5579 parentprimid = link.ObjectData[0].ObjectLocalID;
5580
5581 for (int i = 1; i < link.ObjectData.Length; i++)
5582 {
5583 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
5584 }
5585 }
5586 LinkObjects handlerLinkObjects = OnLinkObjects;
5587 if (handlerLinkObjects != null)
5588 {
5589 handlerLinkObjects(this, parentprimid, childrenprims);
5590 }
5591 return true;
5592 }
5593
5594 private bool HandleObjectDelink(IClientAPI sender, Packet Pack)
5595 {
5596 ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack;
5597
5598 #region Packet Session and User Check
5599 if (m_checkPackets)
5600 {
5601 if (delink.AgentData.SessionID != SessionId ||
5602 delink.AgentData.AgentID != AgentId)
5603 return true;
5604 }
5605 #endregion
5606
5607 // It appears the prim at index 0 is not always the root prim (for
5608 // instance, when one prim of a link set has been edited independently
5609 // of the others). Therefore, we'll pass all the ids onto the delink
5610 // method for it to decide which is the root.
5611 List<uint> prims = new List<uint>();
5612 for (int i = 0; i < delink.ObjectData.Length; i++)
5613 {
5614 prims.Add(delink.ObjectData[i].ObjectLocalID);
5615 }
5616 DelinkObjects handlerDelinkObjects = OnDelinkObjects;
5617 if (handlerDelinkObjects != null)
5618 {
5619 handlerDelinkObjects(prims);
5620 }
5621
5622 return true;
5623 }
5624
5625 private bool HandleObjectAdd(IClientAPI sender, Packet Pack)
5626 {
5627 if (OnAddPrim != null)
5628 {
5629 ObjectAddPacket addPacket = (ObjectAddPacket)Pack;
5630
5631 #region Packet Session and User Check
5632 if (m_checkPackets)
5633 {
5634 if (addPacket.AgentData.SessionID != SessionId ||
5635 addPacket.AgentData.AgentID != AgentId)
5636 return true;
5637 }
5638 #endregion
5639
5640 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
5641 // m_log.Info("[REZData]: " + addPacket.ToString());
5642 //BypassRaycast: 1
5643 //RayStart: <69.79469, 158.2652, 98.40343>
5644 //RayEnd: <61.97724, 141.995, 92.58341>
5645 //RayTargetID: 00000000-0000-0000-0000-000000000000
5646
5647 //Check to see if adding the prim is allowed; useful for any module wanting to restrict the
5648 //object from rezing initially
5649
5650 AddNewPrim handlerAddPrim = OnAddPrim;
5651 if (handlerAddPrim != null)
5652 handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
5653 }
5654 return true;
5655 }
5656
5657 private bool HandleObjectShape(IClientAPI sender, Packet Pack)
5658 {
5659 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack;
5660
5661 #region Packet Session and User Check
5662 if (m_checkPackets)
5663 {
5664 if (shapePacket.AgentData.SessionID != SessionId ||
5665 shapePacket.AgentData.AgentID != AgentId)
5666 return true;
5667 }
5668 #endregion
5669
5670 UpdateShape handlerUpdatePrimShape = null;
5671 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
5672 {
5673 handlerUpdatePrimShape = OnUpdatePrimShape;
5674 if (handlerUpdatePrimShape != null)
5675 {
5676 UpdateShapeArgs shapeData = new UpdateShapeArgs();
5677 shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID;
5678 shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin;
5679 shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve;
5680 shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd;
5681 shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset;
5682 shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions;
5683 shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX;
5684 shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY;
5685 shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX;
5686 shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY;
5687 shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew;
5688 shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX;
5689 shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY;
5690 shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist;
5691 shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin;
5692 shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin;
5693 shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve;
5694 shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd;
5695 shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow;
5696
5697 handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID,
5698 shapeData);
5699 }
5700 }
5701 return true;
5702 }
5703
5704 private bool HandleObjectExtraParams(IClientAPI sender, Packet Pack)
5705 {
5706 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack;
5707
5708 #region Packet Session and User Check
5709 if (m_checkPackets)
5710 {
5711 if (extraPar.AgentData.SessionID != SessionId ||
5712 extraPar.AgentData.AgentID != AgentId)
5713 return true;
5714 }
5715 #endregion
5716
5717 ObjectExtraParams handlerUpdateExtraParams = OnUpdateExtraParams;
5718 if (handlerUpdateExtraParams != null)
5719 {
5720 for (int i = 0; i < extraPar.ObjectData.Length; i++)
5721 {
5722 handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[i].ObjectLocalID,
5723 extraPar.ObjectData[i].ParamType,
5724 extraPar.ObjectData[i].ParamInUse, extraPar.ObjectData[i].ParamData);
5725 }
5726 }
5727 return true;
5728 }
5729
5730 private bool HandleObjectDuplicate(IClientAPI sender, Packet Pack)
5731 {
5732 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
5733
5734 #region Packet Session and User Check
5735 if (m_checkPackets)
5736 {
5737 if (dupe.AgentData.SessionID != SessionId ||
5738 dupe.AgentData.AgentID != AgentId)
5739 return true;
5740 }
5741 #endregion
5742
5743 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
5744
5745 ObjectDuplicate handlerObjectDuplicate = null;
5746
5747 for (int i = 0; i < dupe.ObjectData.Length; i++)
5748 {
5749 handlerObjectDuplicate = OnObjectDuplicate;
5750 if (handlerObjectDuplicate != null)
5751 {
5752 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
5753 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
5754 AgentandGroupData.GroupID);
5755 }
5756 }
5757
5758 return true;
5759 }
5760
5761 private bool HandleRequestMultipleObjects(IClientAPI sender, Packet Pack)
5762 {
5763 RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack;
5764
5765 #region Packet Session and User Check
5766 if (m_checkPackets)
5767 {
5768 if (incomingRequest.AgentData.SessionID != SessionId ||
5769 incomingRequest.AgentData.AgentID != AgentId)
5770 return true;
5771 }
5772 #endregion
5773
5774 ObjectRequest handlerObjectRequest = null;
5775
5776 for (int i = 0; i < incomingRequest.ObjectData.Length; i++)
5777 {
5778 handlerObjectRequest = OnObjectRequest;
5779 if (handlerObjectRequest != null)
5780 {
5781 handlerObjectRequest(incomingRequest.ObjectData[i].ID, this);
5782 }
5783 }
5784 return true;
5785 }
5786
5787 private bool HandleObjectSelect(IClientAPI sender, Packet Pack)
5788 {
5789 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
5790
5791 #region Packet Session and User Check
5792 if (m_checkPackets)
5793 {
5794 if (incomingselect.AgentData.SessionID != SessionId ||
5795 incomingselect.AgentData.AgentID != AgentId)
5796 return true;
5797 }
5798 #endregion
5799
5800 ObjectSelect handlerObjectSelect = null;
5801
5802 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
5803 {
5804 handlerObjectSelect = OnObjectSelect;
5805 if (handlerObjectSelect != null)
5806 {
5807 handlerObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
5808 }
5809 }
5810 return true;
5811 }
5812
5813 private bool HandleObjectDeselect(IClientAPI sender, Packet Pack)
5814 {
5815 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
5816
5817 #region Packet Session and User Check
5818 if (m_checkPackets)
5819 {
5820 if (incomingdeselect.AgentData.SessionID != SessionId ||
5821 incomingdeselect.AgentData.AgentID != AgentId)
5822 return true;
5823 }
5824 #endregion
5825
5826 ObjectDeselect handlerObjectDeselect = null;
5827
5828 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
5829 {
5830 handlerObjectDeselect = OnObjectDeselect;
5831 if (handlerObjectDeselect != null)
5832 {
5833 OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this);
5834 }
5835 }
5836 return true;
5837 }
5838
5839 private bool HandleObjectPosition(IClientAPI sender, Packet Pack)
5840 {
5841 // DEPRECATED: but till libsecondlife removes it, people will use it
5842 ObjectPositionPacket position = (ObjectPositionPacket)Pack;
5843
5844 #region Packet Session and User Check
5845 if (m_checkPackets)
5846 {
5847 if (position.AgentData.SessionID != SessionId ||
5848 position.AgentData.AgentID != AgentId)
5849 return true;
5850 }
5851 #endregion
5852
5853
5854 for (int i = 0; i < position.ObjectData.Length; i++)
5855 {
5856 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition;
5857 if (handlerUpdateVector != null)
5858 handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this);
5859 }
5860
5861 return true;
5862 }
5863
5864 private bool HandleObjectScale(IClientAPI sender, Packet Pack)
5865 {
5866 // DEPRECATED: but till libsecondlife removes it, people will use it
5867 ObjectScalePacket scale = (ObjectScalePacket)Pack;
5868
5869 #region Packet Session and User Check
5870 if (m_checkPackets)
5871 {
5872 if (scale.AgentData.SessionID != SessionId ||
5873 scale.AgentData.AgentID != AgentId)
5874 return true;
5875 }
5876 #endregion
5877
5878 for (int i = 0; i < scale.ObjectData.Length; i++)
5879 {
5880 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
5881 if (handlerUpdatePrimGroupScale != null)
5882 handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this);
5883 }
5884
5885 return true;
5886 }
5887
5888 private bool HandleObjectRotation(IClientAPI sender, Packet Pack)
5889 {
5890 // DEPRECATED: but till libsecondlife removes it, people will use it
5891 ObjectRotationPacket rotation = (ObjectRotationPacket)Pack;
5892
5893 #region Packet Session and User Check
5894 if (m_checkPackets)
5895 {
5896 if (rotation.AgentData.SessionID != SessionId ||
5897 rotation.AgentData.AgentID != AgentId)
5898 return true;
5899 }
5900 #endregion
5901
5902 for (int i = 0; i < rotation.ObjectData.Length; i++)
5903 {
5904 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
5905 if (handlerUpdatePrimRotation != null)
5906 handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this);
5907 }
5908
5909 return true;
5910 }
5911
5912 private bool HandleObjectFlagUpdate(IClientAPI sender, Packet Pack)
5913 {
5914 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
5915
5916 #region Packet Session and User Check
5917 if (m_checkPackets)
5918 {
5919 if (flags.AgentData.SessionID != SessionId ||
5920 flags.AgentData.AgentID != AgentId)
5921 return true;
5922 }
5923 #endregion
5924
5925 UpdatePrimFlags handlerUpdatePrimFlags = OnUpdatePrimFlags;
5926
5927 if (handlerUpdatePrimFlags != null)
5928 {
5929 byte[] data = Pack.ToBytes();
5930 // 46,47,48 are special positions within the packet
5931 // This may change so perhaps we need a better way
5932 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
5933 bool UsePhysics = (data[46] != 0) ? true : false;
5934 bool IsTemporary = (data[47] != 0) ? true : false;
5935 bool IsPhantom = (data[48] != 0) ? true : false;
5936 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
5937 }
5938 return true;
5939 }
5940
5941 private bool HandleObjectImage(IClientAPI sender, Packet Pack)
5942 {
5943 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
5944
5945 UpdatePrimTexture handlerUpdatePrimTexture = null;
5946 for (int i = 0; i < imagePack.ObjectData.Length; i++)
5947 {
5948 handlerUpdatePrimTexture = OnUpdatePrimTexture;
5949 if (handlerUpdatePrimTexture != null)
5950 {
5951 handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
5952 imagePack.ObjectData[i].TextureEntry, this);
5953 }
5954 }
5955 return true;
5956 }
5957
5958 private bool HandleObjectGrab(IClientAPI sender, Packet Pack)
5959 {
5960 ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
5961
5962 #region Packet Session and User Check
5963 if (m_checkPackets)
5964 {
5965 if (grab.AgentData.SessionID != SessionId ||
5966 grab.AgentData.AgentID != AgentId)
5967 return true;
5968 }
5969 #endregion
5970
5971 GrabObject handlerGrabObject = OnGrabObject;
5972
5973 if (handlerGrabObject != null)
5974 {
5975 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
5976 if ((grab.SurfaceInfo != null) && (grab.SurfaceInfo.Length > 0))
5977 {
5978 foreach (ObjectGrabPacket.SurfaceInfoBlock surfaceInfo in grab.SurfaceInfo)
5979 {
5980 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
5981 arg.Binormal = surfaceInfo.Binormal;
5982 arg.FaceIndex = surfaceInfo.FaceIndex;
5983 arg.Normal = surfaceInfo.Normal;
5984 arg.Position = surfaceInfo.Position;
5985 arg.STCoord = surfaceInfo.STCoord;
5986 arg.UVCoord = surfaceInfo.UVCoord;
5987 touchArgs.Add(arg);
5988 }
5989 }
5990 handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs);
5991 }
5992 return true;
5993 }
5994
5995 private bool HandleObjectGrabUpdate(IClientAPI sender, Packet Pack)
5996 {
5997 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack;
5998
5999 #region Packet Session and User Check
6000 if (m_checkPackets)
6001 {
6002 if (grabUpdate.AgentData.SessionID != SessionId ||
6003 grabUpdate.AgentData.AgentID != AgentId)
6004 return true;
6005 }
6006 #endregion
6007
6008 MoveObject handlerGrabUpdate = OnGrabUpdate;
6009
6010 if (handlerGrabUpdate != null)
6011 {
6012 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
6013 if ((grabUpdate.SurfaceInfo != null) && (grabUpdate.SurfaceInfo.Length > 0))
6014 {
6015 foreach (ObjectGrabUpdatePacket.SurfaceInfoBlock surfaceInfo in grabUpdate.SurfaceInfo)
6016 {
6017 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
6018 arg.Binormal = surfaceInfo.Binormal;
6019 arg.FaceIndex = surfaceInfo.FaceIndex;
6020 arg.Normal = surfaceInfo.Normal;
6021 arg.Position = surfaceInfo.Position;
6022 arg.STCoord = surfaceInfo.STCoord;
6023 arg.UVCoord = surfaceInfo.UVCoord;
6024 touchArgs.Add(arg);
6025 }
6026 }
6027 handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
6028 grabUpdate.ObjectData.GrabPosition, this, touchArgs);
6029 }
6030 return true;
6031 }
6032
6033 private bool HandleObjectDeGrab(IClientAPI sender, Packet Pack)
6034 {
6035 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack;
6036
6037 #region Packet Session and User Check
6038 if (m_checkPackets)
6039 {
6040 if (deGrab.AgentData.SessionID != SessionId ||
6041 deGrab.AgentData.AgentID != AgentId)
6042 return true;
6043 }
6044 #endregion
6045
6046 DeGrabObject handlerDeGrabObject = OnDeGrabObject;
6047 if (handlerDeGrabObject != null)
6048 {
6049 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
6050 if ((deGrab.SurfaceInfo != null) && (deGrab.SurfaceInfo.Length > 0))
6051 {
6052 foreach (ObjectDeGrabPacket.SurfaceInfoBlock surfaceInfo in deGrab.SurfaceInfo)
6053 {
6054 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
6055 arg.Binormal = surfaceInfo.Binormal;
6056 arg.FaceIndex = surfaceInfo.FaceIndex;
6057 arg.Normal = surfaceInfo.Normal;
6058 arg.Position = surfaceInfo.Position;
6059 arg.STCoord = surfaceInfo.STCoord;
6060 arg.UVCoord = surfaceInfo.UVCoord;
6061 touchArgs.Add(arg);
6062 }
6063 }
6064 handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs);
6065 }
6066 return true;
6067 }
6068
6069 private bool HandleObjectSpinStart(IClientAPI sender, Packet Pack)
6070 {
6071 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet");
6072 ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack;
6073
6074 #region Packet Session and User Check
6075 if (m_checkPackets)
6076 {
6077 if (spinStart.AgentData.SessionID != SessionId ||
6078 spinStart.AgentData.AgentID != AgentId)
6079 return true;
6080 }
6081 #endregion
6082
6083 SpinStart handlerSpinStart = OnSpinStart;
6084 if (handlerSpinStart != null)
6085 {
6086 handlerSpinStart(spinStart.ObjectData.ObjectID, this);
6087 }
6088 return true;
6089 }
6090
6091 private bool HandleObjectSpinUpdate(IClientAPI sender, Packet Pack)
6092 {
6093 //m_log.Warn("[CLIENT]: unhandled ObjectSpinUpdate packet");
6094 ObjectSpinUpdatePacket spinUpdate = (ObjectSpinUpdatePacket)Pack;
6095
6096 #region Packet Session and User Check
6097 if (m_checkPackets)
6098 {
6099 if (spinUpdate.AgentData.SessionID != SessionId ||
6100 spinUpdate.AgentData.AgentID != AgentId)
6101 return true;
6102 }
6103 #endregion
6104
6105 Vector3 axis;
6106 float angle;
6107 spinUpdate.ObjectData.Rotation.GetAxisAngle(out axis, out angle);
6108 //m_log.Warn("[CLIENT]: ObjectSpinUpdate packet rot axis:" + axis + " angle:" + angle);
6109
6110 SpinObject handlerSpinUpdate = OnSpinUpdate;
6111 if (handlerSpinUpdate != null)
6112 {
6113 handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this);
6114 }
6115 return true;
6116 }
6117
6118 private bool HandleObjectSpinStop(IClientAPI sender, Packet Pack)
6119 {
6120 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet");
6121 ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack;
6122
6123 #region Packet Session and User Check
6124 if (m_checkPackets)
6125 {
6126 if (spinStop.AgentData.SessionID != SessionId ||
6127 spinStop.AgentData.AgentID != AgentId)
6128 return true;
6129 }
6130 #endregion
6131
6132 SpinStop handlerSpinStop = OnSpinStop;
6133 if (handlerSpinStop != null)
6134 {
6135 handlerSpinStop(spinStop.ObjectData.ObjectID, this);
6136 }
6137 return true;
6138 }
6139
6140 private bool HandleObjectDescription(IClientAPI sender, Packet Pack)
6141 {
6142 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
6143
6144 #region Packet Session and User Check
6145 if (m_checkPackets)
6146 {
6147 if (objDes.AgentData.SessionID != SessionId ||
6148 objDes.AgentData.AgentID != AgentId)
6149 return true;
6150 }
6151 #endregion
6152
6153 GenericCall7 handlerObjectDescription = null;
6154
6155 for (int i = 0; i < objDes.ObjectData.Length; i++)
6156 {
6157 handlerObjectDescription = OnObjectDescription;
6158 if (handlerObjectDescription != null)
6159 {
6160 handlerObjectDescription(this, objDes.ObjectData[i].LocalID,
6161 Util.FieldToString(objDes.ObjectData[i].Description));
6162 }
6163 }
6164 return true;
6165 }
6166
6167 private bool HandleObjectName(IClientAPI sender, Packet Pack)
6168 {
6169 ObjectNamePacket objName = (ObjectNamePacket)Pack;
6170
6171 #region Packet Session and User Check
6172 if (m_checkPackets)
6173 {
6174 if (objName.AgentData.SessionID != SessionId ||
6175 objName.AgentData.AgentID != AgentId)
6176 return true;
6177 }
6178 #endregion
6179
6180 GenericCall7 handlerObjectName = null;
6181 for (int i = 0; i < objName.ObjectData.Length; i++)
6182 {
6183 handlerObjectName = OnObjectName;
6184 if (handlerObjectName != null)
6185 {
6186 handlerObjectName(this, objName.ObjectData[i].LocalID,
6187 Util.FieldToString(objName.ObjectData[i].Name));
6188 }
6189 }
6190 return true;
6191 }
6192
6193 private bool HandleObjectPermissions(IClientAPI sender, Packet Pack)
6194 {
6195 if (OnObjectPermissions != null)
6196 {
6197 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
6198
6199 #region Packet Session and User Check
6200 if (m_checkPackets)
6201 {
6202 if (newobjPerms.AgentData.SessionID != SessionId ||
6203 newobjPerms.AgentData.AgentID != AgentId)
6204 return true;
6205 }
6206 #endregion
6207
6208 UUID AgentID = newobjPerms.AgentData.AgentID;
6209 UUID SessionID = newobjPerms.AgentData.SessionID;
6210
6211 ObjectPermissions handlerObjectPermissions = null;
6212
6213 for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
6214 {
6215 ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i];
6216
6217 byte field = permChanges.Field;
6218 uint localID = permChanges.ObjectLocalID;
6219 uint mask = permChanges.Mask;
6220 byte set = permChanges.Set;
6221
6222 handlerObjectPermissions = OnObjectPermissions;
6223
6224 if (handlerObjectPermissions != null)
6225 handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
6226 }
6227 }
6228
6229 // Here's our data,
6230 // PermField contains the field the info goes into
6231 // PermField determines which mask we're changing
6232 //
6233 // chmask is the mask of the change
6234 // setTF is whether we're adding it or taking it away
6235 //
6236 // objLocalID is the localID of the object.
6237
6238 // Unfortunately, we have to pass the event the packet because objData is an array
6239 // That means multiple object perms may be updated in a single packet.
6240
6241 return true;
6242 }
6243
6244 private bool HandleUndo(IClientAPI sender, Packet Pack)
6245 {
6246 UndoPacket undoitem = (UndoPacket)Pack;
6247
6248 #region Packet Session and User Check
6249 if (m_checkPackets)
6250 {
6251 if (undoitem.AgentData.SessionID != SessionId ||
6252 undoitem.AgentData.AgentID != AgentId)
6253 return true;
6254 }
6255 #endregion
6256
6257 if (undoitem.ObjectData.Length > 0)
6258 {
6259 for (int i = 0; i < undoitem.ObjectData.Length; i++)
6260 {
6261 UUID objiD = undoitem.ObjectData[i].ObjectID;
6262 AgentSit handlerOnUndo = OnUndo;
6263 if (handlerOnUndo != null)
6264 {
6265 handlerOnUndo(this, objiD);
6266 }
6267
6268 }
6269 }
6270 return true;
6271 }
6272
6273 private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack)
6274 {
6275 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack;
6276
6277 #region Packet Session and User Check
6278 if (m_checkPackets)
6279 {
6280 if (dupeOnRay.AgentData.SessionID != SessionId ||
6281 dupeOnRay.AgentData.AgentID != AgentId)
6282 return true;
6283 }
6284 #endregion
6285
6286 ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null;
6287
6288 for (int i = 0; i < dupeOnRay.ObjectData.Length; i++)
6289 {
6290 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay;
6291 if (handlerObjectDuplicateOnRay != null)
6292 {
6293 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
6294 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
6295 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
6296 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
6297 }
6298 }
6299
6300 return true;
6301 }
6302
6303 private bool HandleRequestObjectPropertiesFamily(IClientAPI sender, Packet Pack)
6304 {
6305 //This powers the little tooltip that appears when you move your mouse over an object
6306 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
6307
6308 #region Packet Session and User Check
6309 if (m_checkPackets)
6310 {
6311 if (packToolTip.AgentData.SessionID != SessionId ||
6312 packToolTip.AgentData.AgentID != AgentId)
6313 return true;
6314 }
6315 #endregion
6316
6317 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
6318
6319 RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily;
6320
6321 if (handlerRequestObjectPropertiesFamily != null)
6322 {
6323 handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags,
6324 packObjBlock.ObjectID);
6325 }
6326
6327 return true;
6328 }
6329
6330 private bool HandleObjectIncludeInSearch(IClientAPI sender, Packet Pack)
6331 {
6332 //This lets us set objects to appear in search (stuff like DataSnapshot, etc)
6333 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack;
6334 ObjectIncludeInSearch handlerObjectIncludeInSearch = null;
6335
6336 #region Packet Session and User Check
6337 if (m_checkPackets)
6338 {
6339 if (packInSearch.AgentData.SessionID != SessionId ||
6340 packInSearch.AgentData.AgentID != AgentId)
6341 return true;
6342 }
6343 #endregion
6344
6345 foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData)
6346 {
6347 bool inSearch = objData.IncludeInSearch;
6348 uint localID = objData.ObjectLocalID;
6349
6350 handlerObjectIncludeInSearch = OnObjectIncludeInSearch;
6351
6352 if (handlerObjectIncludeInSearch != null)
6353 {
6354 handlerObjectIncludeInSearch(this, inSearch, localID);
6355 }
6356 }
6357 return true;
6358 }
6359
6360 private bool HandleScriptAnswerYes(IClientAPI sender, Packet Pack)
6361 {
6362 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack;
6363
6364 #region Packet Session and User Check
6365 if (m_checkPackets)
6366 {
6367 if (scriptAnswer.AgentData.SessionID != SessionId ||
6368 scriptAnswer.AgentData.AgentID != AgentId)
6369 return true;
6370 }
6371 #endregion
6372
6373 ScriptAnswer handlerScriptAnswer = OnScriptAnswer;
6374 if (handlerScriptAnswer != null)
6375 {
6376 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions);
6377 }
6378 return true;
6379 }
6380
6381 private bool HandleObjectClickAction(IClientAPI sender, Packet Pack)
6382 {
6383 ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack;
6384
6385 #region Packet Session and User Check
6386 if (m_checkPackets)
6387 {
6388 if (ocpacket.AgentData.SessionID != SessionId ||
6389 ocpacket.AgentData.AgentID != AgentId)
6390 return true;
6391 }
6392 #endregion
6393
6394 GenericCall7 handlerObjectClickAction = OnObjectClickAction;
6395 if (handlerObjectClickAction != null)
6396 {
6397 foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData)
6398 {
6399 byte action = odata.ClickAction;
6400 uint localID = odata.ObjectLocalID;
6401 handlerObjectClickAction(this, localID, action.ToString());
6402 }
6403 }
6404 return true;
6405 }
6406
6407 private bool HandleObjectMaterial(IClientAPI sender, Packet Pack)
6408 {
6409 ObjectMaterialPacket ompacket = (ObjectMaterialPacket)Pack;
6410
6411 #region Packet Session and User Check
6412 if (m_checkPackets)
6413 {
6414 if (ompacket.AgentData.SessionID != SessionId ||
6415 ompacket.AgentData.AgentID != AgentId)
6416 return true;
6417 }
6418 #endregion
6419
6420 GenericCall7 handlerObjectMaterial = OnObjectMaterial;
6421 if (handlerObjectMaterial != null)
6422 {
6423 foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData)
6424 {
6425 byte material = odata.Material;
6426 uint localID = odata.ObjectLocalID;
6427 handlerObjectMaterial(this, localID, material.ToString());
6428 }
6429 }
6430 return true;
6431 }
6432
6433 #endregion Objects/m_sceneObjects
6434
6435 #region Inventory/Asset/Other related packets
6436
6437 private bool HandleRequestImage(IClientAPI sender, Packet Pack)
6438 {
6439 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
6440 //m_log.Debug("image request: " + Pack.ToString());
6441
6442 #region Packet Session and User Check
6443 if (m_checkPackets)
6444 {
6445 if (imageRequest.AgentData.SessionID != SessionId ||
6446 imageRequest.AgentData.AgentID != AgentId)
6447 return true;
6448 }
6449 #endregion
6450
6451 //handlerTextureRequest = null;
6452 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
6453 {
6454 if (OnRequestTexture != null)
6455 {
6456 TextureRequestArgs args = new TextureRequestArgs();
6457
6458 RequestImagePacket.RequestImageBlock block = imageRequest.RequestImage[i];
6459
6460 args.RequestedAssetID = block.Image;
6461 args.DiscardLevel = block.DiscardLevel;
6462 args.PacketNumber = block.Packet;
6463 args.Priority = block.DownloadPriority;
6464 args.requestSequence = imageRequest.Header.Sequence;
6465
6466 // NOTE: This is not a built in part of the LLUDP protocol, but we double the
6467 // priority of avatar textures to get avatars rezzing in faster than the
6468 // surrounding scene
6469 if ((ImageType)block.Type == ImageType.Baked)
6470 args.Priority *= 2.0f;
6471
6472 //handlerTextureRequest = OnRequestTexture;
6473
6474 //if (handlerTextureRequest != null)
6475 //OnRequestTexture(this, args);
6476
6477 // in the end, we null this, so we have to check if it's null
6478 if (m_imageManager != null)
6479 {
6480 m_imageManager.EnqueueReq(args);
6481 }
6482 }
6483 }
6484 return true;
6485 }
6486
6487 private bool HandleTransferRequest(IClientAPI sender, Packet Pack)
6488 {
6489 //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
6490
6491 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
6492 //m_log.Debug("Transfer Request: " + transfer.ToString());
6493 // Validate inventory transfers
6494 // Has to be done here, because AssetCache can't do it
6495 //
6496 UUID taskID = UUID.Zero;
6497 if (transfer.TransferInfo.SourceType == 3)
6498 {
6499 taskID = new UUID(transfer.TransferInfo.Params, 48);
6500 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
6501 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
6502 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
6503 {
6504 if (taskID != UUID.Zero) // Prim
6505 {
6506 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
6507 if (part == null)
6508 return true;
6509
6510 if (part.OwnerID != AgentId)
6511 return true;
6512
6513 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
6514 return true;
6515
6516 TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
6517 if (ti == null)
6518 return true;
6519
6520 if (ti.OwnerID != AgentId)
6521 return true;
6522
6523 if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
6524 return true;
6525
6526 if (ti.AssetID != requestID)
6527 return true;
6528 }
6529 else // Agent
6530 {
6531 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
6532 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
6533 assetRequestItem = invService.GetItem(assetRequestItem);
6534 if (assetRequestItem == null)
6535 {
6536 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
6537 if (assetRequestItem == null)
6538 return true;
6539 }
6540
6541 // At this point, we need to apply perms
6542 // only to notecards and scripts. All
6543 // other asset types are always available
6544 //
6545 if (assetRequestItem.AssetType == 10)
6546 {
6547 if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
6548 {
6549 SendAgentAlertMessage("Insufficient permissions to view script", false);
6550 return true;
6551 }
6552 }
6553 else if (assetRequestItem.AssetType == 7)
6554 {
6555 if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
6556 {
6557 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
6558 return true;
6559 }
6560 }
6561
6562 if (assetRequestItem.AssetID != requestID)
6563 return true;
6564 }
6565 }
6566 }
6567
6568 //m_assetCache.AddAssetRequest(this, transfer);
6569
6570 MakeAssetRequest(transfer, taskID);
6571
6572 /* RequestAsset = OnRequestAsset;
6573 if (RequestAsset != null)
6574 {
6575 RequestAsset(this, transfer);
6576 }*/
6577 return true;
6578 }
6579
6580 private bool HandleAssetUploadRequest(IClientAPI sender, Packet Pack)
6581 {
6582 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
6583
6584
6585 // m_log.Debug("upload request " + request.ToString());
6586 // m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
6587 UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
6588
6589 UDPAssetUploadRequest handlerAssetUploadRequest = OnAssetUploadRequest;
6590
6591 if (handlerAssetUploadRequest != null)
6592 {
6593 handlerAssetUploadRequest(this, temp,
6594 request.AssetBlock.TransactionID, request.AssetBlock.Type,
6595 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal,
6596 request.AssetBlock.Tempfile);
6597 }
6598 return true;
6599 }
6600
6601 private bool HandleRequestXfer(IClientAPI sender, Packet Pack)
6602 {
6603 RequestXferPacket xferReq = (RequestXferPacket)Pack;
6604
6605 RequestXfer handlerRequestXfer = OnRequestXfer;
6606
6607 if (handlerRequestXfer != null)
6608 {
6609 handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
6610 }
6611 return true;
6612 }
6613
6614 private bool HandleSendXferPacket(IClientAPI sender, Packet Pack)
6615 {
6616 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
6617
6618 XferReceive handlerXferReceive = OnXferReceive;
6619 if (handlerXferReceive != null)
6620 {
6621 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
6622 }
6623 return true;
6624 }
6625
6626 private bool HandleConfirmXferPacket(IClientAPI sender, Packet Pack)
6627 {
6628 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack;
6629
6630 ConfirmXfer handlerConfirmXfer = OnConfirmXfer;
6631 if (handlerConfirmXfer != null)
6632 {
6633 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
6634 }
6635 return true;
6636 }
6637
6638 private bool HandleAbortXfer(IClientAPI sender, Packet Pack)
6639 {
6640 AbortXferPacket abortXfer = (AbortXferPacket)Pack;
6641 AbortXfer handlerAbortXfer = OnAbortXfer;
6642 if (handlerAbortXfer != null)
6643 {
6644 handlerAbortXfer(this, abortXfer.XferID.ID);
6645 }
6646
6647 return true;
6648 }
6649
6650 private bool HandleCreateInventoryFolder(IClientAPI sender, Packet Pack)
6651 {
6652 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
6653
6654 #region Packet Session and User Check
6655 if (m_checkPackets)
6656 {
6657 if (invFolder.AgentData.SessionID != SessionId ||
6658 invFolder.AgentData.AgentID != AgentId)
6659 return true;
6660 }
6661 #endregion
6662
6663 CreateInventoryFolder handlerCreateInventoryFolder = OnCreateNewInventoryFolder;
6664 if (handlerCreateInventoryFolder != null)
6665 {
6666 handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID,
6667 (ushort)invFolder.FolderData.Type,
6668 Util.FieldToString(invFolder.FolderData.Name),
6669 invFolder.FolderData.ParentID);
6670 }
6671 return true;
6672 }
6673
6674 private bool HandleUpdateInventoryFolder(IClientAPI sender, Packet Pack)
6675 {
6676 if (OnUpdateInventoryFolder != null)
6677 {
6678 UpdateInventoryFolderPacket invFolderx = (UpdateInventoryFolderPacket)Pack;
6679
6680 #region Packet Session and User Check
6681 if (m_checkPackets)
6682 {
6683 if (invFolderx.AgentData.SessionID != SessionId ||
6684 invFolderx.AgentData.AgentID != AgentId)
6685 return true;
6686 }
6687 #endregion
6688
6689 UpdateInventoryFolder handlerUpdateInventoryFolder = null;
6690
6691 for (int i = 0; i < invFolderx.FolderData.Length; i++)
6692 {
6693 handlerUpdateInventoryFolder = OnUpdateInventoryFolder;
6694 if (handlerUpdateInventoryFolder != null)
6695 {
6696 OnUpdateInventoryFolder(this, invFolderx.FolderData[i].FolderID,
6697 (ushort)invFolderx.FolderData[i].Type,
6698 Util.FieldToString(invFolderx.FolderData[i].Name),
6699 invFolderx.FolderData[i].ParentID);
6700 }
6701 }
6702 }
6703 return true;
6704 }
6705
6706 private bool HandleMoveInventoryFolder(IClientAPI sender, Packet Pack)
6707 {
6708 if (OnMoveInventoryFolder != null)
6709 {
6710 MoveInventoryFolderPacket invFoldery = (MoveInventoryFolderPacket)Pack;
6711
6712 #region Packet Session and User Check
6713 if (m_checkPackets)
6714 {
6715 if (invFoldery.AgentData.SessionID != SessionId ||
6716 invFoldery.AgentData.AgentID != AgentId)
6717 return true;
6718 }
6719 #endregion
6720
6721 MoveInventoryFolder handlerMoveInventoryFolder = null;
6722
6723 for (int i = 0; i < invFoldery.InventoryData.Length; i++)
6724 {
6725 handlerMoveInventoryFolder = OnMoveInventoryFolder;
6726 if (handlerMoveInventoryFolder != null)
6727 {
6728 OnMoveInventoryFolder(this, invFoldery.InventoryData[i].FolderID,
6729 invFoldery.InventoryData[i].ParentID);
6730 }
6731 }
6732 }
6733 return true;
6734 }
6735
6736 private bool HandleCreateInventoryItem(IClientAPI sender, Packet Pack)
6737 {
6738 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
6739
6740 #region Packet Session and User Check
6741 if (m_checkPackets)
6742 {
6743 if (createItem.AgentData.SessionID != SessionId ||
6744 createItem.AgentData.AgentID != AgentId)
6745 return true;
6746 }
6747 #endregion
6748
6749 CreateNewInventoryItem handlerCreateNewInventoryItem = OnCreateNewInventoryItem;
6750 if (handlerCreateNewInventoryItem != null)
6751 {
6752 handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
6753 createItem.InventoryBlock.FolderID,
6754 createItem.InventoryBlock.CallbackID,
6755 Util.FieldToString(createItem.InventoryBlock.Description),
6756 Util.FieldToString(createItem.InventoryBlock.Name),
6757 createItem.InventoryBlock.InvType,
6758 createItem.InventoryBlock.Type,
6759 createItem.InventoryBlock.WearableType,
6760 createItem.InventoryBlock.NextOwnerMask,
6761 Util.UnixTimeSinceEpoch());
6762 }
6763 return true;
6764 }
6765
6766 private bool HandleFetchInventory(IClientAPI sender, Packet Pack)
6767 {
6768 if (OnFetchInventory != null)
6769 {
6770 FetchInventoryPacket FetchInventoryx = (FetchInventoryPacket)Pack;
6771
6772 #region Packet Session and User Check
6773 if (m_checkPackets)
6774 {
6775 if (FetchInventoryx.AgentData.SessionID != SessionId ||
6776 FetchInventoryx.AgentData.AgentID != AgentId)
6777 return true;
6778 }
6779 #endregion
6780
6781 FetchInventory handlerFetchInventory = null;
6782
6783 for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++)
6784 {
6785 handlerFetchInventory = OnFetchInventory;
6786
6787 if (handlerFetchInventory != null)
6788 {
6789 OnFetchInventory(this, FetchInventoryx.InventoryData[i].ItemID,
6790 FetchInventoryx.InventoryData[i].OwnerID);
6791 }
6792 }
6793 }
6794 return true;
6795 }
6796
6797 private bool HandleFetchInventoryDescendents(IClientAPI sender, Packet Pack)
6798 {
6799 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
6800
6801 #region Packet Session and User Check
6802 if (m_checkPackets)
6803 {
6804 if (Fetch.AgentData.SessionID != SessionId ||
6805 Fetch.AgentData.AgentID != AgentId)
6806 return true;
6807 }
6808 #endregion
6809
6810 FetchInventoryDescendents handlerFetchInventoryDescendents = OnFetchInventoryDescendents;
6811 if (handlerFetchInventoryDescendents != null)
6812 {
6813 handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
6814 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
6815 Fetch.InventoryData.SortOrder);
6816 }
6817 return true;
6818 }
6819
6820 private bool HandlePurgeInventoryDescendents(IClientAPI sender, Packet Pack)
6821 {
6822 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack;
6823
6824 #region Packet Session and User Check
6825 if (m_checkPackets)
6826 {
6827 if (Purge.AgentData.SessionID != SessionId ||
6828 Purge.AgentData.AgentID != AgentId)
6829 return true;
6830 }
6831 #endregion
6832
6833 PurgeInventoryDescendents handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents;
6834 if (handlerPurgeInventoryDescendents != null)
6835 {
6836 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
6837 }
6838 return true;
6839 }
6840
6841 private bool HandleUpdateInventoryItem(IClientAPI sender, Packet Pack)
6842 {
6843 UpdateInventoryItemPacket inventoryItemUpdate = (UpdateInventoryItemPacket)Pack;
6844
6845 #region Packet Session and User Check
6846 if (m_checkPackets)
6847 {
6848 if (inventoryItemUpdate.AgentData.SessionID != SessionId ||
6849 inventoryItemUpdate.AgentData.AgentID != AgentId)
6850 return true;
6851 }
6852 #endregion
6853
6854 if (OnUpdateInventoryItem != null)
6855 {
6856 UpdateInventoryItem handlerUpdateInventoryItem = null;
6857 for (int i = 0; i < inventoryItemUpdate.InventoryData.Length; i++)
6858 {
6859 handlerUpdateInventoryItem = OnUpdateInventoryItem;
6860
6861 if (handlerUpdateInventoryItem != null)
6862 {
6863 InventoryItemBase itemUpd = new InventoryItemBase();
6864 itemUpd.ID = inventoryItemUpdate.InventoryData[i].ItemID;
6865 itemUpd.Name = Util.FieldToString(inventoryItemUpdate.InventoryData[i].Name);
6866 itemUpd.Description = Util.FieldToString(inventoryItemUpdate.InventoryData[i].Description);
6867 itemUpd.GroupID = inventoryItemUpdate.InventoryData[i].GroupID;
6868 itemUpd.GroupOwned = inventoryItemUpdate.InventoryData[i].GroupOwned;
6869 itemUpd.GroupPermissions = inventoryItemUpdate.InventoryData[i].GroupMask;
6870 itemUpd.NextPermissions = inventoryItemUpdate.InventoryData[i].NextOwnerMask;
6871 itemUpd.EveryOnePermissions = inventoryItemUpdate.InventoryData[i].EveryoneMask;
6872 itemUpd.CreationDate = inventoryItemUpdate.InventoryData[i].CreationDate;
6873 itemUpd.Folder = inventoryItemUpdate.InventoryData[i].FolderID;
6874 itemUpd.InvType = inventoryItemUpdate.InventoryData[i].InvType;
6875 itemUpd.SalePrice = inventoryItemUpdate.InventoryData[i].SalePrice;
6876 itemUpd.SaleType = inventoryItemUpdate.InventoryData[i].SaleType;
6877 itemUpd.Flags = inventoryItemUpdate.InventoryData[i].Flags;
6878
6879 OnUpdateInventoryItem(this, inventoryItemUpdate.InventoryData[i].TransactionID,
6880 inventoryItemUpdate.InventoryData[i].ItemID,
6881 itemUpd);
6882 }
6883 }
6884 }
6885 return true;
6886 }
6887
6888 private bool HandleCopyInventoryItem(IClientAPI sender, Packet Pack)
6889 {
6890 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack;
6891
6892 #region Packet Session and User Check
6893 if (m_checkPackets)
6894 {
6895 if (copyitem.AgentData.SessionID != SessionId ||
6896 copyitem.AgentData.AgentID != AgentId)
6897 return true;
6898 }
6899 #endregion
6900
6901 CopyInventoryItem handlerCopyInventoryItem = null;
6902 if (OnCopyInventoryItem != null)
6903 {
6904 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData)
6905 {
6906 handlerCopyInventoryItem = OnCopyInventoryItem;
6907 if (handlerCopyInventoryItem != null)
6908 {
6909 handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID,
6910 datablock.OldItemID, datablock.NewFolderID,
6911 Util.FieldToString(datablock.NewName));
6912 }
6913 }
6914 }
6915 return true;
6916 }
6917
6918 private bool HandleMoveInventoryItem(IClientAPI sender, Packet Pack)
6919 {
6920 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
6921
6922 #region Packet Session and User Check
6923 if (m_checkPackets)
6924 {
6925 if (moveitem.AgentData.SessionID != SessionId ||
6926 moveitem.AgentData.AgentID != AgentId)
6927 return true;
6928 }
6929 #endregion
6930
6931 if (OnMoveInventoryItem != null)
6932 {
6933 MoveInventoryItem handlerMoveInventoryItem = null;
6934 InventoryItemBase itm = null;
6935 List<InventoryItemBase> items = new List<InventoryItemBase>();
6936 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
6937 {
6938 itm = new InventoryItemBase(datablock.ItemID, AgentId);
6939 itm.Folder = datablock.FolderID;
6940 itm.Name = Util.FieldToString(datablock.NewName);
6941 // weird, comes out as empty string
6942 //m_log.DebugFormat("[XXX] new name: {0}", itm.Name);
6943 items.Add(itm);
6944 }
6945 handlerMoveInventoryItem = OnMoveInventoryItem;
6946 if (handlerMoveInventoryItem != null)
6947 {
6948 handlerMoveInventoryItem(this, items);
6949 }
6950 }
6951 return true;
6952 }
6953
6954 private bool HandleRemoveInventoryItem(IClientAPI sender, Packet Pack)
6955 {
6956 RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack;
6957
6958 #region Packet Session and User Check
6959 if (m_checkPackets)
6960 {
6961 if (removeItem.AgentData.SessionID != SessionId ||
6962 removeItem.AgentData.AgentID != AgentId)
6963 return true;
6964 }
6965 #endregion
6966
6967 if (OnRemoveInventoryItem != null)
6968 {
6969 RemoveInventoryItem handlerRemoveInventoryItem = null;
6970 List<UUID> uuids = new List<UUID>();
6971 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
6972 {
6973 uuids.Add(datablock.ItemID);
6974 }
6975 handlerRemoveInventoryItem = OnRemoveInventoryItem;
6976 if (handlerRemoveInventoryItem != null)
6977 {
6978 handlerRemoveInventoryItem(this, uuids);
6979 }
6980
6981 }
6982 return true;
6983 }
6984
6985 private bool HandleRemoveInventoryFolder(IClientAPI sender, Packet Pack)
6986 {
6987 RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack;
6988
6989 #region Packet Session and User Check
6990 if (m_checkPackets)
6991 {
6992 if (removeFolder.AgentData.SessionID != SessionId ||
6993 removeFolder.AgentData.AgentID != AgentId)
6994 return true;
6995 }
6996 #endregion
6997
6998 if (OnRemoveInventoryFolder != null)
6999 {
7000 RemoveInventoryFolder handlerRemoveInventoryFolder = null;
7001 List<UUID> uuids = new List<UUID>();
7002 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
7003 {
7004 uuids.Add(datablock.FolderID);
7005 }
7006 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7007 if (handlerRemoveInventoryFolder != null)
7008 {
7009 handlerRemoveInventoryFolder(this, uuids);
7010 }
7011 }
7012 return true;
7013 }
7014
7015 private bool HandleRemoveInventoryObjects(IClientAPI sender, Packet Pack)
7016 {
7017 RemoveInventoryObjectsPacket removeObject = (RemoveInventoryObjectsPacket)Pack;
7018 #region Packet Session and User Check
7019 if (m_checkPackets)
7020 {
7021 if (removeObject.AgentData.SessionID != SessionId ||
7022 removeObject.AgentData.AgentID != AgentId)
7023 return true;
7024 }
7025 #endregion
7026 if (OnRemoveInventoryFolder != null)
7027 {
7028 RemoveInventoryFolder handlerRemoveInventoryFolder = null;
7029 List<UUID> uuids = new List<UUID>();
7030 foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
7031 {
7032 uuids.Add(datablock.FolderID);
7033 }
7034 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
7035 if (handlerRemoveInventoryFolder != null)
7036 {
7037 handlerRemoveInventoryFolder(this, uuids);
7038 }
7039 }
7040
7041 if (OnRemoveInventoryItem != null)
7042 {
7043 RemoveInventoryItem handlerRemoveInventoryItem = null;
7044 List<UUID> uuids = new List<UUID>();
7045 foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData)
7046 {
7047 uuids.Add(datablock.ItemID);
7048 }
7049 handlerRemoveInventoryItem = OnRemoveInventoryItem;
7050 if (handlerRemoveInventoryItem != null)
7051 {
7052 handlerRemoveInventoryItem(this, uuids);
7053 }
7054 }
7055 return true;
7056 }
7057
7058 private bool HandleRequestTaskInventory(IClientAPI sender, Packet Pack)
7059 {
7060 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
7061
7062 #region Packet Session and User Check
7063 if (m_checkPackets)
7064 {
7065 if (requesttask.AgentData.SessionID != SessionId ||
7066 requesttask.AgentData.AgentID != AgentId)
7067 return true;
7068 }
7069 #endregion
7070
7071 RequestTaskInventory handlerRequestTaskInventory = OnRequestTaskInventory;
7072 if (handlerRequestTaskInventory != null)
7073 {
7074 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID);
7075 }
7076 return true;
7077 }
7078
7079 private bool HandleUpdateTaskInventory(IClientAPI sender, Packet Pack)
7080 {
7081 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
7082
7083 #region Packet Session and User Check
7084 if (m_checkPackets)
7085 {
7086 if (updatetask.AgentData.SessionID != SessionId ||
7087 updatetask.AgentData.AgentID != AgentId)
7088 return true;
7089 }
7090 #endregion
7091
7092 if (OnUpdateTaskInventory != null)
7093 {
7094 if (updatetask.UpdateData.Key == 0)
7095 {
7096 UpdateTaskInventory handlerUpdateTaskInventory = OnUpdateTaskInventory;
7097 if (handlerUpdateTaskInventory != null)
7098 {
7099 TaskInventoryItem newTaskItem = new TaskInventoryItem();
7100 newTaskItem.ItemID = updatetask.InventoryData.ItemID;
7101 newTaskItem.ParentID = updatetask.InventoryData.FolderID;
7102 newTaskItem.CreatorID = updatetask.InventoryData.CreatorID;
7103 newTaskItem.OwnerID = updatetask.InventoryData.OwnerID;
7104 newTaskItem.GroupID = updatetask.InventoryData.GroupID;
7105 newTaskItem.BasePermissions = updatetask.InventoryData.BaseMask;
7106 newTaskItem.CurrentPermissions = updatetask.InventoryData.OwnerMask;
7107 newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
7108 newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
7109 newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask;
7110 //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned;
7111 newTaskItem.Type = updatetask.InventoryData.Type;
7112 newTaskItem.InvType = updatetask.InventoryData.InvType;
7113 newTaskItem.Flags = updatetask.InventoryData.Flags;
7114 //newTaskItem.SaleType=updatetask.InventoryData.SaleType;
7115 //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;;
7116 newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
7117 newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
7118 newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
7119 handlerUpdateTaskInventory(this, updatetask.InventoryData.TransactionID,
7120 newTaskItem, updatetask.UpdateData.LocalID);
7121 }
7122 }
7123 }
7124
7125 return true;
7126 }
7127
7128 private bool HandleRemoveTaskInventory(IClientAPI sender, Packet Pack)
7129 {
7130 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
7131
7132 #region Packet Session and User Check
7133 if (m_checkPackets)
7134 {
7135 if (removeTask.AgentData.SessionID != SessionId ||
7136 removeTask.AgentData.AgentID != AgentId)
7137 return true;
7138 }
7139 #endregion
7140
7141 RemoveTaskInventory handlerRemoveTaskItem = OnRemoveTaskItem;
7142
7143 if (handlerRemoveTaskItem != null)
7144 {
7145 handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
7146 }
7147
7148 return true;
7149 }
7150
7151 private bool HandleMoveTaskInventory(IClientAPI sender, Packet Pack)
7152 {
7153 MoveTaskInventoryPacket moveTaskInventoryPacket = (MoveTaskInventoryPacket)Pack;
7154
7155 #region Packet Session and User Check
7156 if (m_checkPackets)
7157 {
7158 if (moveTaskInventoryPacket.AgentData.SessionID != SessionId ||
7159 moveTaskInventoryPacket.AgentData.AgentID != AgentId)
7160 return true;
7161 }
7162 #endregion
7163
7164 MoveTaskInventory handlerMoveTaskItem = OnMoveTaskItem;
7165
7166 if (handlerMoveTaskItem != null)
7167 {
7168 handlerMoveTaskItem(
7169 this, moveTaskInventoryPacket.AgentData.FolderID,
7170 moveTaskInventoryPacket.InventoryData.LocalID,
7171 moveTaskInventoryPacket.InventoryData.ItemID);
7172 }
7173
7174 return true;
7175 }
7176
7177 private bool HandleRezScript(IClientAPI sender, Packet Pack)
7178 {
7179 //m_log.Debug(Pack.ToString());
7180 RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
7181
7182 #region Packet Session and User Check
7183 if (m_checkPackets)
7184 {
7185 if (rezScriptx.AgentData.SessionID != SessionId ||
7186 rezScriptx.AgentData.AgentID != AgentId)
7187 return true;
7188 }
7189 #endregion
7190
7191 RezScript handlerRezScript = OnRezScript;
7192 InventoryItemBase item = new InventoryItemBase();
7193 item.ID = rezScriptx.InventoryBlock.ItemID;
7194 item.Folder = rezScriptx.InventoryBlock.FolderID;
7195 item.CreatorId = rezScriptx.InventoryBlock.CreatorID.ToString();
7196 item.Owner = rezScriptx.InventoryBlock.OwnerID;
7197 item.BasePermissions = rezScriptx.InventoryBlock.BaseMask;
7198 item.CurrentPermissions = rezScriptx.InventoryBlock.OwnerMask;
7199 item.EveryOnePermissions = rezScriptx.InventoryBlock.EveryoneMask;
7200 item.NextPermissions = rezScriptx.InventoryBlock.NextOwnerMask;
7201 item.GroupPermissions = rezScriptx.InventoryBlock.GroupMask;
7202 item.GroupOwned = rezScriptx.InventoryBlock.GroupOwned;
7203 item.GroupID = rezScriptx.InventoryBlock.GroupID;
7204 item.AssetType = rezScriptx.InventoryBlock.Type;
7205 item.InvType = rezScriptx.InventoryBlock.InvType;
7206 item.Flags = rezScriptx.InventoryBlock.Flags;
7207 item.SaleType = rezScriptx.InventoryBlock.SaleType;
7208 item.SalePrice = rezScriptx.InventoryBlock.SalePrice;
7209 item.Name = Util.FieldToString(rezScriptx.InventoryBlock.Name);
7210 item.Description = Util.FieldToString(rezScriptx.InventoryBlock.Description);
7211 item.CreationDate = rezScriptx.InventoryBlock.CreationDate;
7212
7213 if (handlerRezScript != null)
7214 {
7215 handlerRezScript(this, item, rezScriptx.InventoryBlock.TransactionID, rezScriptx.UpdateBlock.ObjectLocalID);
7216 }
7217 return true;
7218 }
7219
7220 private bool HandleMapLayerRequest(IClientAPI sender, Packet Pack)
7221 {
7222 RequestMapLayer();
7223 return true;
7224 }
7225
7226 private bool HandleMapBlockRequest(IClientAPI sender, Packet Pack)
7227 {
7228 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
7229
7230 #region Packet Session and User Check
7231 if (m_checkPackets)
7232 {
7233 if (MapRequest.AgentData.SessionID != SessionId ||
7234 MapRequest.AgentData.AgentID != AgentId)
7235 return true;
7236 }
7237 #endregion
7238
7239 RequestMapBlocks handlerRequestMapBlocks = OnRequestMapBlocks;
7240 if (handlerRequestMapBlocks != null)
7241 {
7242 handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
7243 MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY, MapRequest.AgentData.Flags);
7244 }
7245 return true;
7246 }
7247
7248 private bool HandleMapNameRequest(IClientAPI sender, Packet Pack)
7249 {
7250 MapNameRequestPacket map = (MapNameRequestPacket)Pack;
7251
7252 #region Packet Session and User Check
7253 if (m_checkPackets)
7254 {
7255 if (map.AgentData.SessionID != SessionId ||
7256 map.AgentData.AgentID != AgentId)
7257 return true;
7258 }
7259 #endregion
7260
7261 string mapName = Util.UTF8.GetString(map.NameData.Name, 0,
7262 map.NameData.Name.Length - 1);
7263 RequestMapName handlerMapNameRequest = OnMapNameRequest;
7264 if (handlerMapNameRequest != null)
7265 {
7266 handlerMapNameRequest(this, mapName);
7267 }
7268 return true;
7269 }
7270
7271 private bool HandleTeleportLandmarkRequest(IClientAPI sender, Packet Pack)
7272 {
7273 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
7274
7275 #region Packet Session and User Check
7276 if (m_checkPackets)
7277 {
7278 if (tpReq.Info.SessionID != SessionId ||
7279 tpReq.Info.AgentID != AgentId)
7280 return true;
7281 }
7282 #endregion
7283
7284 UUID lmid = tpReq.Info.LandmarkID;
7285 AssetLandmark lm;
7286 if (lmid != UUID.Zero)
7287 {
7288 //AssetBase lma = m_assetCache.GetAsset(lmid, false);
7289 AssetBase lma = m_assetService.Get(lmid.ToString());
7290
7291 if (lma == null)
7292 {
7293 // Failed to find landmark
7294 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
7295 tpCancel.Info.SessionID = tpReq.Info.SessionID;
7296 tpCancel.Info.AgentID = tpReq.Info.AgentID;
7297 OutPacket(tpCancel, ThrottleOutPacketType.Task);
7298 }
7299
7300 try
7301 {
7302 lm = new AssetLandmark(lma);
7303 }
7304 catch (NullReferenceException)
7305 {
7306 // asset not found generates null ref inside the assetlandmark constructor.
7307 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
7308 tpCancel.Info.SessionID = tpReq.Info.SessionID;
7309 tpCancel.Info.AgentID = tpReq.Info.AgentID;
7310 OutPacket(tpCancel, ThrottleOutPacketType.Task);
7311 return true;
7312 }
7313 }
7314 else
7315 {
7316 // Teleport home request
7317 UUIDNameRequest handlerTeleportHomeRequest = OnTeleportHomeRequest;
7318 if (handlerTeleportHomeRequest != null)
7319 {
7320 handlerTeleportHomeRequest(AgentId, this);
7321 }
7322 return true;
7323 }
7324
7325 TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
7326 if (handlerTeleportLandmarkRequest != null)
7327 {
7328 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position);
7329 }
7330 else
7331 {
7332 //no event handler so cancel request
7333
7334
7335 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
7336 tpCancel.Info.AgentID = tpReq.Info.AgentID;
7337 tpCancel.Info.SessionID = tpReq.Info.SessionID;
7338 OutPacket(tpCancel, ThrottleOutPacketType.Task);
7339
7340 }
7341 return true;
7342 }
7343
7344 private bool HandleTeleportLocationRequest(IClientAPI sender, Packet Pack)
7345 {
7346 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
7347 // m_log.Debug(tpLocReq.ToString());
7348
7349 #region Packet Session and User Check
7350 if (m_checkPackets)
7351 {
7352 if (tpLocReq.AgentData.SessionID != SessionId ||
7353 tpLocReq.AgentData.AgentID != AgentId)
7354 return true;
7355 }
7356 #endregion
7357
7358 TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest;
7359 if (handlerTeleportLocationRequest != null)
7360 {
7361 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
7362 tpLocReq.Info.LookAt, 16);
7363 }
7364 else
7365 {
7366 //no event handler so cancel request
7367 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
7368 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
7369 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
7370 OutPacket(tpCancel, ThrottleOutPacketType.Task);
7371 }
7372 return true;
7373 }
7374
7375 #endregion Inventory/Asset/Other related packets
7376
7377 private bool HandleUUIDNameRequest(IClientAPI sender, Packet Pack)
7378 {
7379 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
7380
7381 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
7382 {
7383 UUIDNameRequest handlerNameRequest = OnNameFromUUIDRequest;
7384 if (handlerNameRequest != null)
7385 {
7386 handlerNameRequest(UUIDBlock.ID, this);
7387 }
7388 }
7389 return true;
7390 }
7391
7392 #region Parcel related packets
7393
7394 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
7395 {
7396 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
7397
7398 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
7399 if (handlerRegionHandleRequest != null)
7400 {
7401 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID);
7402 }
7403 return true;
7404 }
7405
7406 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)
7407 {
7408 ParcelInfoRequestPacket pirPack = (ParcelInfoRequestPacket)Pack;
7409
7410 #region Packet Session and User Check
7411 if (m_checkPackets)
7412 {
7413 if (pirPack.AgentData.SessionID != SessionId ||
7414 pirPack.AgentData.AgentID != AgentId)
7415 return true;
7416 }
7417 #endregion
7418
7419 ParcelInfoRequest handlerParcelInfoRequest = OnParcelInfoRequest;
7420 if (handlerParcelInfoRequest != null)
7421 {
7422 handlerParcelInfoRequest(this, pirPack.Data.ParcelID);
7423 }
7424 return true;
7425 }
7426
7427 private bool HandleParcelAccessListRequest(IClientAPI sender, Packet Pack)
7428 {
7429 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
7430
7431 #region Packet Session and User Check
7432 if (m_checkPackets)
7433 {
7434 if (requestPacket.AgentData.SessionID != SessionId ||
7435 requestPacket.AgentData.AgentID != AgentId)
7436 return true;
7437 }
7438 #endregion
7439
7440 ParcelAccessListRequest handlerParcelAccessListRequest = OnParcelAccessListRequest;
7441
7442 if (handlerParcelAccessListRequest != null)
7443 {
7444 handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID,
7445 requestPacket.Data.Flags, requestPacket.Data.SequenceID,
7446 requestPacket.Data.LocalID, this);
7447 }
7448 return true;
7449 }
7450
7451 private bool HandleParcelAccessListUpdate(IClientAPI sender, Packet Pack)
7452 {
7453 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack;
7454
7455 #region Packet Session and User Check
7456 if (m_checkPackets)
7457 {
7458 if (updatePacket.AgentData.SessionID != SessionId ||
7459 updatePacket.AgentData.AgentID != AgentId)
7460 return true;
7461 }
7462 #endregion
7463
7464 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
7465 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
7466 {
7467 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
7468 entry.AgentID = block.ID;
7469 entry.Flags = (AccessList)block.Flags;
7470 entry.Time = new DateTime();
7471 entries.Add(entry);
7472 }
7473
7474 ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest;
7475 if (handlerParcelAccessListUpdateRequest != null)
7476 {
7477 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
7478 updatePacket.AgentData.SessionID, updatePacket.Data.Flags,
7479 updatePacket.Data.LocalID, entries, this);
7480 }
7481 return true;
7482 }
7483
7484 private bool HandleParcelPropertiesRequest(IClientAPI sender, Packet Pack)
7485 {
7486 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
7487
7488 #region Packet Session and User Check
7489 if (m_checkPackets)
7490 {
7491 if (propertiesRequest.AgentData.SessionID != SessionId ||
7492 propertiesRequest.AgentData.AgentID != AgentId)
7493 return true;
7494 }
7495 #endregion
7496
7497 ParcelPropertiesRequest handlerParcelPropertiesRequest = OnParcelPropertiesRequest;
7498 if (handlerParcelPropertiesRequest != null)
7499 {
7500 handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West),
7501 (int)Math.Round(propertiesRequest.ParcelData.South),
7502 (int)Math.Round(propertiesRequest.ParcelData.East),
7503 (int)Math.Round(propertiesRequest.ParcelData.North),
7504 propertiesRequest.ParcelData.SequenceID,
7505 propertiesRequest.ParcelData.SnapSelection, this);
7506 }
7507 return true;
7508 }
7509
7510 private bool HandleParcelDivide(IClientAPI sender, Packet Pack)
7511 {
7512 ParcelDividePacket landDivide = (ParcelDividePacket)Pack;
7513
7514 #region Packet Session and User Check
7515 if (m_checkPackets)
7516 {
7517 if (landDivide.AgentData.SessionID != SessionId ||
7518 landDivide.AgentData.AgentID != AgentId)
7519 return true;
7520 }
7521 #endregion
7522
7523 ParcelDivideRequest handlerParcelDivideRequest = OnParcelDivideRequest;
7524 if (handlerParcelDivideRequest != null)
7525 {
7526 handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West),
7527 (int)Math.Round(landDivide.ParcelData.South),
7528 (int)Math.Round(landDivide.ParcelData.East),
7529 (int)Math.Round(landDivide.ParcelData.North), this);
7530 }
7531 return true;
7532 }
7533
7534 private bool HandleParcelJoin(IClientAPI sender, Packet Pack)
7535 {
7536 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack;
7537
7538 #region Packet Session and User Check
7539 if (m_checkPackets)
7540 {
7541 if (landJoin.AgentData.SessionID != SessionId ||
7542 landJoin.AgentData.AgentID != AgentId)
7543 return true;
7544 }
7545 #endregion
7546
7547 ParcelJoinRequest handlerParcelJoinRequest = OnParcelJoinRequest;
7548
7549 if (handlerParcelJoinRequest != null)
7550 {
7551 handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West),
7552 (int)Math.Round(landJoin.ParcelData.South),
7553 (int)Math.Round(landJoin.ParcelData.East),
7554 (int)Math.Round(landJoin.ParcelData.North), this);
7555 }
7556 return true;
7557 }
7558
7559 private bool HandleParcelPropertiesUpdate(IClientAPI sender, Packet Pack)
7560 {
7561 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack;
7562
7563 #region Packet Session and User Check
7564 if (m_checkPackets)
7565 {
7566 if (parcelPropertiesPacket.AgentData.SessionID != SessionId ||
7567 parcelPropertiesPacket.AgentData.AgentID != AgentId)
7568 return true;
7569 }
7570 #endregion
7571
7572 ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest;
7573
7574 if (handlerParcelPropertiesUpdateRequest != null)
7575 {
7576 LandUpdateArgs args = new LandUpdateArgs();
7577
7578 args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID;
7579 args.Category = (ParcelCategory)parcelPropertiesPacket.ParcelData.Category;
7580 args.Desc = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc);
7581 args.GroupID = parcelPropertiesPacket.ParcelData.GroupID;
7582 args.LandingType = parcelPropertiesPacket.ParcelData.LandingType;
7583 args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale;
7584 args.MediaID = parcelPropertiesPacket.ParcelData.MediaID;
7585 args.MediaURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL);
7586 args.MusicURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL);
7587 args.Name = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name);
7588 args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags;
7589 args.PassHours = parcelPropertiesPacket.ParcelData.PassHours;
7590 args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice;
7591 args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice;
7592 args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID;
7593 args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation;
7594 args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt;
7595 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this);
7596 }
7597 return true;
7598 }
7599
7600 private bool HandleParcelSelectObjects(IClientAPI sender, Packet Pack)
7601 {
7602 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
7603
7604 #region Packet Session and User Check
7605 if (m_checkPackets)
7606 {
7607 if (selectPacket.AgentData.SessionID != SessionId ||
7608 selectPacket.AgentData.AgentID != AgentId)
7609 return true;
7610 }
7611 #endregion
7612
7613 List<UUID> returnIDs = new List<UUID>();
7614
7615 foreach (ParcelSelectObjectsPacket.ReturnIDsBlock rb in
7616 selectPacket.ReturnIDs)
7617 {
7618 returnIDs.Add(rb.ReturnID);
7619 }
7620
7621 ParcelSelectObjects handlerParcelSelectObjects = OnParcelSelectObjects;
7622
7623 if (handlerParcelSelectObjects != null)
7624 {
7625 handlerParcelSelectObjects(selectPacket.ParcelData.LocalID,
7626 Convert.ToInt32(selectPacket.ParcelData.ReturnType), returnIDs, this);
7627 }
7628 return true;
7629 }
7630
7631 private bool HandleParcelObjectOwnersRequest(IClientAPI sender, Packet Pack)
7632 {
7633 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
7634
7635 #region Packet Session and User Check
7636 if (m_checkPackets)
7637 {
7638 if (reqPacket.AgentData.SessionID != SessionId ||
7639 reqPacket.AgentData.AgentID != AgentId)
7640 return true;
7641 }
7642 #endregion
7643
7644 ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest;
7645
7646 if (handlerParcelObjectOwnerRequest != null)
7647 {
7648 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
7649 }
7650 return true;
7651
7652 }
7653
7654 private bool HandleParcelGodForceOwner(IClientAPI sender, Packet Pack)
7655 {
7656 ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack;
7657
7658 #region Packet Session and User Check
7659 if (m_checkPackets)
7660 {
7661 if (godForceOwnerPacket.AgentData.SessionID != SessionId ||
7662 godForceOwnerPacket.AgentData.AgentID != AgentId)
7663 return true;
7664 }
7665 #endregion
7666
7667 ParcelGodForceOwner handlerParcelGodForceOwner = OnParcelGodForceOwner;
7668 if (handlerParcelGodForceOwner != null)
7669 {
7670 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this);
7671 }
7672 return true;
7673 }
7674
7675 private bool HandleParcelRelease(IClientAPI sender, Packet Pack)
7676 {
7677 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack;
7678
7679 #region Packet Session and User Check
7680 if (m_checkPackets)
7681 {
7682 if (releasePacket.AgentData.SessionID != SessionId ||
7683 releasePacket.AgentData.AgentID != AgentId)
7684 return true;
7685 }
7686 #endregion
7687
7688 ParcelAbandonRequest handlerParcelAbandonRequest = OnParcelAbandonRequest;
7689 if (handlerParcelAbandonRequest != null)
7690 {
7691 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
7692 }
7693 return true;
7694 }
7695
7696 private bool HandleParcelReclaim(IClientAPI sender, Packet Pack)
7697 {
7698 ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack;
7699
7700 #region Packet Session and User Check
7701 if (m_checkPackets)
7702 {
7703 if (reclaimPacket.AgentData.SessionID != SessionId ||
7704 reclaimPacket.AgentData.AgentID != AgentId)
7705 return true;
7706 }
7707 #endregion
7708
7709 ParcelReclaim handlerParcelReclaim = OnParcelReclaim;
7710 if (handlerParcelReclaim != null)
7711 {
7712 handlerParcelReclaim(reclaimPacket.Data.LocalID, this);
7713 }
7714 return true;
7715 }
7716
7717 private bool HandleParcelReturnObjects(IClientAPI sender, Packet Pack)
7718 {
7719 ParcelReturnObjectsPacket parcelReturnObjects = (ParcelReturnObjectsPacket)Pack;
7720
7721 #region Packet Session and User Check
7722 if (m_checkPackets)
7723 {
7724 if (parcelReturnObjects.AgentData.SessionID != SessionId ||
7725 parcelReturnObjects.AgentData.AgentID != AgentId)
7726 return true;
7727 }
7728 #endregion
7729
7730 UUID[] puserselectedOwnerIDs = new UUID[parcelReturnObjects.OwnerIDs.Length];
7731 for (int parceliterator = 0; parceliterator < parcelReturnObjects.OwnerIDs.Length; parceliterator++)
7732 puserselectedOwnerIDs[parceliterator] = parcelReturnObjects.OwnerIDs[parceliterator].OwnerID;
7733
7734 UUID[] puserselectedTaskIDs = new UUID[parcelReturnObjects.TaskIDs.Length];
7735
7736 for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++)
7737 puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID;
7738
7739 ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest;
7740 if (handlerParcelReturnObjectsRequest != null)
7741 {
7742 handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this);
7743
7744 }
7745 return true;
7746 }
7747
7748 private bool HandleParcelSetOtherCleanTime(IClientAPI sender, Packet Pack)
7749 {
7750 ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack;
7751
7752 #region Packet Session and User Check
7753 if (m_checkPackets)
7754 {
7755 if (parcelSetOtherCleanTimePacket.AgentData.SessionID != SessionId ||
7756 parcelSetOtherCleanTimePacket.AgentData.AgentID != AgentId)
7757 return true;
7758 }
7759 #endregion
7760
7761 ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime;
7762 if (handlerParcelSetOtherCleanTime != null)
7763 {
7764 handlerParcelSetOtherCleanTime(this,
7765 parcelSetOtherCleanTimePacket.ParcelData.LocalID,
7766 parcelSetOtherCleanTimePacket.ParcelData.OtherCleanTime);
7767 }
7768 return true;
7769 }
7770
7771 private bool HandleLandStatRequest(IClientAPI sender, Packet Pack)
7772 {
7773 LandStatRequestPacket lsrp = (LandStatRequestPacket)Pack;
7774
7775 #region Packet Session and User Check
7776 if (m_checkPackets)
7777 {
7778 if (lsrp.AgentData.SessionID != SessionId ||
7779 lsrp.AgentData.AgentID != AgentId)
7780 return true;
7781 }
7782 #endregion
7783
7784 GodLandStatRequest handlerLandStatRequest = OnLandStatRequest;
7785 if (handlerLandStatRequest != null)
7786 {
7787 handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this);
7788 }
7789 return true;
7790 }
7791
7792 private bool HandleParcelDwellRequest(IClientAPI sender, Packet Pack)
7793 {
7794 ParcelDwellRequestPacket dwellrq =
7795 (ParcelDwellRequestPacket)Pack;
7796
7797 #region Packet Session and User Check
7798 if (m_checkPackets)
7799 {
7800 if (dwellrq.AgentData.SessionID != SessionId ||
7801 dwellrq.AgentData.AgentID != AgentId)
7802 return true;
7803 }
7804 #endregion
7805
7806 ParcelDwellRequest handlerParcelDwellRequest = OnParcelDwellRequest;
7807 if (handlerParcelDwellRequest != null)
7808 {
7809 handlerParcelDwellRequest(dwellrq.Data.LocalID, this);
7810 }
7811 return true;
7812 }
7813
7814 #endregion Parcel related packets
7815
7816 #region Estate Packets
7817
7818 private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack)
7819 {
7820 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
7821 //m_log.Debug(messagePacket.ToString());
7822 GodLandStatRequest handlerLandStatRequest;
7823
7824 #region Packet Session and User Check
7825 if (m_checkPackets)
7826 {
7827 if (messagePacket.AgentData.SessionID != SessionId ||
7828 messagePacket.AgentData.AgentID != AgentId)
7829 return true;
7830 }
7831 #endregion
7832
7833 switch (Utils.BytesToString(messagePacket.MethodData.Method))
7834 {
7835 case "getinfo":
7836 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7837 {
7838 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
7839 }
7840 return true;
7841 case "setregioninfo":
7842 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7843 {
7844 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter),
7845 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
7846 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))),
7847 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)),
7848 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)),
7849 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter));
7850 }
7851 return true;
7852 // case "texturebase":
7853 // if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7854 // {
7855 // foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
7856 // {
7857 // string s = Utils.BytesToString(block.Parameter);
7858 // string[] splitField = s.Split(' ');
7859 // if (splitField.Length == 2)
7860 // {
7861 // UUID tempUUID = new UUID(splitField[1]);
7862 // OnSetEstateTerrainBaseTexture(this, Convert.ToInt16(splitField[0]), tempUUID);
7863 // }
7864 // }
7865 // }
7866 // break;
7867 case "texturedetail":
7868 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7869 {
7870 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
7871 {
7872 string s = Utils.BytesToString(block.Parameter);
7873 string[] splitField = s.Split(' ');
7874 if (splitField.Length == 2)
7875 {
7876 Int16 corner = Convert.ToInt16(splitField[0]);
7877 UUID textureUUID = new UUID(splitField[1]);
7878
7879 OnSetEstateTerrainDetailTexture(this, corner, textureUUID);
7880 }
7881 }
7882 }
7883
7884 return true;
7885 case "textureheights":
7886 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7887 {
7888 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
7889 {
7890 string s = Utils.BytesToString(block.Parameter);
7891 string[] splitField = s.Split(' ');
7892 if (splitField.Length == 3)
7893 {
7894 Int16 corner = Convert.ToInt16(splitField[0]);
7895 float lowValue = (float)Convert.ToDecimal(splitField[1]);
7896 float highValue = (float)Convert.ToDecimal(splitField[2]);
7897
7898 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue);
7899 }
7900 }
7901 }
7902 return true;
7903 case "texturecommit":
7904 OnCommitEstateTerrainTextureRequest(this);
7905 return true;
7906 case "setregionterrain":
7907 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7908 {
7909 if (messagePacket.ParamList.Length != 9)
7910 {
7911 m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
7912 }
7913 else
7914 {
7915 try
7916 {
7917 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
7918 if (!tmp.Contains(".")) tmp += ".00";
7919 float WaterHeight = (float)Convert.ToDecimal(tmp);
7920 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
7921 if (!tmp.Contains(".")) tmp += ".00";
7922 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
7923 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter);
7924 if (!tmp.Contains(".")) tmp += ".00";
7925 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
7926 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
7927 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
7928 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter));
7929 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
7930 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
7931 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter));
7932
7933 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
7934
7935 }
7936 catch (Exception ex)
7937 {
7938 m_log.Error("EstateOwnerMessage: Exception while setting terrain settings: \n" + messagePacket + "\n" + ex);
7939 }
7940 }
7941 }
7942
7943 return true;
7944 case "restart":
7945 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7946 {
7947 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
7948 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
7949 {
7950 float timeSeconds;
7951 Utils.TryParseSingle(Utils.BytesToString(block.Parameter), out timeSeconds);
7952 timeSeconds = (int)timeSeconds;
7953 OnEstateRestartSimRequest(this, (int)timeSeconds);
7954
7955 }
7956 }
7957 return true;
7958 case "estatechangecovenantid":
7959 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7960 {
7961 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
7962 {
7963 UUID newCovenantID = new UUID(Utils.BytesToString(block.Parameter));
7964 OnEstateChangeCovenantRequest(this, newCovenantID);
7965 }
7966 }
7967 return true;
7968 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
7969 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7970 {
7971 int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
7972 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)));
7973
7974 }
7975 return true;
7976 case "simulatormessage":
7977 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7978 {
7979 UUID invoice = messagePacket.MethodData.Invoice;
7980 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
7981 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
7982 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
7983 UUID sessionID = messagePacket.AgentData.SessionID;
7984 OnSimulatorBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
7985 }
7986 return true;
7987 case "instantmessage":
7988 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
7989 {
7990 if (messagePacket.ParamList.Length < 5)
7991 return true;
7992 UUID invoice = messagePacket.MethodData.Invoice;
7993 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
7994 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
7995 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
7996 UUID sessionID = messagePacket.AgentData.SessionID;
7997 OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
7998 }
7999 return true;
8000 case "setregiondebug":
8001 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
8002 {
8003 UUID invoice = messagePacket.MethodData.Invoice;
8004 UUID SenderID = messagePacket.AgentData.AgentID;
8005 bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter);
8006 bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
8007 bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
8008
8009 OnEstateDebugRegionRequest(this, invoice, SenderID, scripted, collisionEvents, physics);
8010 }
8011 return true;
8012 case "teleporthomeuser":
8013 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
8014 {
8015 UUID invoice = messagePacket.MethodData.Invoice;
8016 UUID SenderID = messagePacket.AgentData.AgentID;
8017 UUID Prey;
8018
8019 UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[1].Parameter), out Prey);
8020
8021 OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey);
8022 }
8023 return true;
8024 case "teleporthomeallusers":
8025 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
8026 {
8027 UUID invoice = messagePacket.MethodData.Invoice;
8028 UUID SenderID = messagePacket.AgentData.AgentID;
8029 OnEstateTeleportAllUsersHomeRequest(this, invoice, SenderID);
8030 }
8031 return true;
8032 case "colliders":
8033 handlerLandStatRequest = OnLandStatRequest;
8034 if (handlerLandStatRequest != null)
8035 {
8036 handlerLandStatRequest(0, 1, 0, "", this);
8037 }
8038 return true;
8039 case "scripts":
8040 handlerLandStatRequest = OnLandStatRequest;
8041 if (handlerLandStatRequest != null)
8042 {
8043 handlerLandStatRequest(0, 0, 0, "", this);
8044 }
8045 return true;
8046 case "terrain":
8047 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
8048 {
8049 if (messagePacket.ParamList.Length > 0)
8050 {
8051 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake")
8052 {
8053 BakeTerrain handlerBakeTerrain = OnBakeTerrain;
8054 if (handlerBakeTerrain != null)
8055 {
8056 handlerBakeTerrain(this);
8057 }
8058 }
8059 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "download filename")
8060 {
8061 if (messagePacket.ParamList.Length > 1)
8062 {
8063 RequestTerrain handlerRequestTerrain = OnRequestTerrain;
8064 if (handlerRequestTerrain != null)
8065 {
8066 handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
8067 }
8068 }
8069 }
8070 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "upload filename")
8071 {
8072 if (messagePacket.ParamList.Length > 1)
8073 {
8074 RequestTerrain handlerUploadTerrain = OnUploadTerrain;
8075 if (handlerUploadTerrain != null)
8076 {
8077 handlerUploadTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
8078 }
8079 }
8080 }
8081
8082 }
8083
8084
8085 }
8086 return true;
8087
8088 case "estatechangeinfo":
8089 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
8090 {
8091 UUID invoice = messagePacket.MethodData.Invoice;
8092 UUID SenderID = messagePacket.AgentData.AgentID;
8093 UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
8094 UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
8095
8096 EstateChangeInfo handlerEstateChangeInfo = OnEstateChangeInfo;
8097 if (handlerEstateChangeInfo != null)
8098 {
8099 handlerEstateChangeInfo(this, invoice, SenderID, param1, param2);
8100 }
8101 }
8102 return true;
8103
8104 default:
8105 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
8106 return true;
8107 }
8108
8109 //int parcelID, uint reportType, uint requestflags, string filter
8110
8111 //lsrp.RequestData.ParcelLocalID;
8112 //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
8113 //lsrp.RequestData.RequestFlags;
8114 //lsrp.RequestData.Filter;
8115
8116// return true;
8117 }
8118
8119 private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
8120 {
8121 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
8122
8123 #region Packet Session and User Check
8124 if (m_checkPackets)
8125 {
8126 if (mPacket.SessionID != SessionId ||
8127 mPacket.AgentID != AgentId)
8128 return true;
8129 }
8130 #endregion
8131
8132 RegionInfoRequest handlerRegionInfoRequest = OnRegionInfoRequest;
8133 if (handlerRegionInfoRequest != null)
8134 {
8135 handlerRegionInfoRequest(this);
8136 }
8137 return true;
8138 }
8139
8140 private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack)
8141 {
8142
8143 //EstateCovenantRequestPacket.AgentDataBlock epack =
8144 // ((EstateCovenantRequestPacket)Pack).AgentData;
8145
8146 EstateCovenantRequest handlerEstateCovenantRequest = OnEstateCovenantRequest;
8147 if (handlerEstateCovenantRequest != null)
8148 {
8149 handlerEstateCovenantRequest(this);
8150 }
8151 return true;
8152
8153 }
8154
8155 #endregion Estate Packets
8156
8157 #region GodPackets
8158
8159 private bool HandleRequestGodlikePowers(IClientAPI sender, Packet Pack)
8160 {
8161 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
8162 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
8163 UUID token = rblock.Token;
8164
8165 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData;
8166
8167 RequestGodlikePowers handlerReqGodlikePowers = OnRequestGodlikePowers;
8168
8169 if (handlerReqGodlikePowers != null)
8170 {
8171 handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this);
8172 }
8173
8174 return true;
8175 }
8176 private bool HandleGodKickUser(IClientAPI sender, Packet Pack)
8177 {
8178 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
8179
8180 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
8181 {
8182 GodKickUser handlerGodKickUser = OnGodKickUser;
8183 if (handlerGodKickUser != null)
8184 {
8185 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
8186 gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason);
8187 }
8188 }
8189 else
8190 {
8191 SendAgentAlertMessage("Kick request denied", false);
8192 }
8193 //KickUserPacket kupack = new KickUserPacket();
8194 //KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;
8195
8196 //kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID;
8197 //kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID;
8198
8199 //kupack.TargetBlock.TargetIP = (uint)0;
8200 //kupack.TargetBlock.TargetPort = (ushort)0;
8201 //kupack.UserInfo.Reason = gkupack.UserInfo.Reason;
8202
8203 //OutPacket(kupack, ThrottleOutPacketType.Task);
8204 return true;
8205 }
8206 #endregion GodPackets
8207
8208 #region Economy/Transaction Packets
8209
8210 private bool HandleMoneyBalanceRequest(IClientAPI sender, Packet Pack)
8211 {
8212 MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack;
8213
8214 #region Packet Session and User Check
8215 if (m_checkPackets)
8216 {
8217 if (moneybalancerequestpacket.AgentData.SessionID != SessionId ||
8218 moneybalancerequestpacket.AgentData.AgentID != AgentId)
8219 return true;
8220 }
8221 #endregion
8222
8223 MoneyBalanceRequest handlerMoneyBalanceRequest = OnMoneyBalanceRequest;
8224
8225 if (handlerMoneyBalanceRequest != null)
8226 {
8227 handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID);
8228 }
8229
8230 return true;
8231 }
8232 private bool HandleEconomyDataRequest(IClientAPI sender, Packet Pack)
8233 {
8234 EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest;
8235 if (handlerEconomoyDataRequest != null)
8236 {
8237 handlerEconomoyDataRequest(AgentId);
8238 }
8239 return true;
8240 }
8241 private bool HandleRequestPayPrice(IClientAPI sender, Packet Pack)
8242 {
8243 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack;
8244
8245 RequestPayPrice handlerRequestPayPrice = OnRequestPayPrice;
8246 if (handlerRequestPayPrice != null)
8247 {
8248 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID);
8249 }
8250 return true;
8251 }
8252 private bool HandleObjectSaleInfo(IClientAPI sender, Packet Pack)
8253 {
8254 ObjectSaleInfoPacket objectSaleInfoPacket = (ObjectSaleInfoPacket)Pack;
8255
8256 #region Packet Session and User Check
8257 if (m_checkPackets)
8258 {
8259 if (objectSaleInfoPacket.AgentData.SessionID != SessionId ||
8260 objectSaleInfoPacket.AgentData.AgentID != AgentId)
8261 return true;
8262 }
8263 #endregion
8264
8265 ObjectSaleInfo handlerObjectSaleInfo = OnObjectSaleInfo;
8266 if (handlerObjectSaleInfo != null)
8267 {
8268 foreach (ObjectSaleInfoPacket.ObjectDataBlock d
8269 in objectSaleInfoPacket.ObjectData)
8270 {
8271 handlerObjectSaleInfo(this,
8272 objectSaleInfoPacket.AgentData.AgentID,
8273 objectSaleInfoPacket.AgentData.SessionID,
8274 d.LocalID,
8275 d.SaleType,
8276 d.SalePrice);
8277 }
8278 }
8279 return true;
8280 }
8281 private bool HandleObjectBuy(IClientAPI sender, Packet Pack)
8282 {
8283 ObjectBuyPacket objectBuyPacket = (ObjectBuyPacket)Pack;
8284
8285 #region Packet Session and User Check
8286 if (m_checkPackets)
8287 {
8288 if (objectBuyPacket.AgentData.SessionID != SessionId ||
8289 objectBuyPacket.AgentData.AgentID != AgentId)
8290 return true;
8291 }
8292 #endregion
8293
8294 ObjectBuy handlerObjectBuy = OnObjectBuy;
8295
8296 if (handlerObjectBuy != null)
8297 {
8298 foreach (ObjectBuyPacket.ObjectDataBlock d
8299 in objectBuyPacket.ObjectData)
8300 {
8301 handlerObjectBuy(this,
8302 objectBuyPacket.AgentData.AgentID,
8303 objectBuyPacket.AgentData.SessionID,
8304 objectBuyPacket.AgentData.GroupID,
8305 objectBuyPacket.AgentData.CategoryID,
8306 d.ObjectLocalID,
8307 d.SaleType,
8308 d.SalePrice);
8309 }
8310 }
8311 return true;
8312 }
8313
8314 #endregion Economy/Transaction Packets
8315
8316 #region Script Packets
8317 private bool HandleGetScriptRunning(IClientAPI sender, Packet Pack)
8318 {
8319 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack;
8320
8321 GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning;
8322 if (handlerGetScriptRunning != null)
8323 {
8324 handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID);
8325 }
8326 return true;
8327 }
8328 private bool HandleSetScriptRunning(IClientAPI sender, Packet Pack)
8329 {
8330 SetScriptRunningPacket setScriptRunning = (SetScriptRunningPacket)Pack;
8331
8332 #region Packet Session and User Check
8333 if (m_checkPackets)
8334 {
8335 if (setScriptRunning.AgentData.SessionID != SessionId ||
8336 setScriptRunning.AgentData.AgentID != AgentId)
8337 return true;
8338 }
8339 #endregion
8340
8341 SetScriptRunning handlerSetScriptRunning = OnSetScriptRunning;
8342 if (handlerSetScriptRunning != null)
8343 {
8344 handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running);
8345 }
8346 return true;
8347 }
8348
8349 private bool HandleScriptReset(IClientAPI sender, Packet Pack)
8350 {
8351 ScriptResetPacket scriptResetPacket = (ScriptResetPacket)Pack;
8352
8353 #region Packet Session and User Check
8354 if (m_checkPackets)
8355 {
8356 if (scriptResetPacket.AgentData.SessionID != SessionId ||
8357 scriptResetPacket.AgentData.AgentID != AgentId)
8358 return true;
8359 }
8360 #endregion
8361
8362 ScriptReset handlerScriptReset = OnScriptReset;
8363 if (handlerScriptReset != null)
8364 {
8365 handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID);
8366 }
8367 return true;
8368 }
8369
8370 #endregion Script Packets
8371
8372 #region Gesture Managment
8373
8374 private bool HandleActivateGestures(IClientAPI sender, Packet Pack)
8375 {
8376 ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack;
8377
8378 #region Packet Session and User Check
8379 if (m_checkPackets)
8380 {
8381 if (activateGesturePacket.AgentData.SessionID != SessionId ||
8382 activateGesturePacket.AgentData.AgentID != AgentId)
8383 return true;
8384 }
8385 #endregion
8386
8387 ActivateGesture handlerActivateGesture = OnActivateGesture;
8388 if (handlerActivateGesture != null)
8389 {
8390 handlerActivateGesture(this,
8391 activateGesturePacket.Data[0].AssetID,
8392 activateGesturePacket.Data[0].ItemID);
8393 }
8394 else m_log.Error("Null pointer for activateGesture");
8395
8396 return true;
8397 }
8398 private bool HandleDeactivateGestures(IClientAPI sender, Packet Pack)
8399 {
8400 DeactivateGesturesPacket deactivateGesturePacket = (DeactivateGesturesPacket)Pack;
8401
8402 #region Packet Session and User Check
8403 if (m_checkPackets)
8404 {
8405 if (deactivateGesturePacket.AgentData.SessionID != SessionId ||
8406 deactivateGesturePacket.AgentData.AgentID != AgentId)
8407 return true;
8408 }
8409 #endregion
8410
8411 DeactivateGesture handlerDeactivateGesture = OnDeactivateGesture;
8412 if (handlerDeactivateGesture != null)
8413 {
8414 handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID);
8415 }
8416 return true;
8417 }
8418 private bool HandleObjectOwner(IClientAPI sender, Packet Pack)
8419 {
8420 ObjectOwnerPacket objectOwnerPacket = (ObjectOwnerPacket)Pack;
8421
8422 #region Packet Session and User Check
8423 if (m_checkPackets)
8424 {
8425 if (objectOwnerPacket.AgentData.SessionID != SessionId ||
8426 objectOwnerPacket.AgentData.AgentID != AgentId)
8427 return true;
8428 }
8429 #endregion
8430
8431 List<uint> localIDs = new List<uint>();
8432
8433 foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData)
8434 localIDs.Add(d.ObjectLocalID);
8435
8436 ObjectOwner handlerObjectOwner = OnObjectOwner;
8437 if (handlerObjectOwner != null)
8438 {
8439 handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs);
8440 }
8441 return true;
8442 }
8443
8444 #endregion Gesture Managment
8445
8446 private bool HandleAgentFOV(IClientAPI sender, Packet Pack)
8447 {
8448 AgentFOVPacket fovPacket = (AgentFOVPacket)Pack;
8449
8450 if (fovPacket.FOVBlock.GenCounter > m_agentFOVCounter)
8451 {
8452 m_agentFOVCounter = fovPacket.FOVBlock.GenCounter;
8453 AgentFOV handlerAgentFOV = OnAgentFOV;
8454 if (handlerAgentFOV != null)
8455 {
8456 handlerAgentFOV(this, fovPacket.FOVBlock.VerticalAngle);
8457 }
8458 }
8459 return true;
8460 }
8461
8462 #region unimplemented handlers
8463
8464 private bool HandleViewerStats(IClientAPI sender, Packet Pack)
8465 {
8466 // TODO: handle this packet
8467 //m_log.Warn("[CLIENT]: unhandled ViewerStats packet");
8468 return true;
8469 }
8470
8471 private bool HandleMapItemRequest(IClientAPI sender, Packet Pack)
8472 {
8473 MapItemRequestPacket mirpk = (MapItemRequestPacket)Pack;
8474
8475 #region Packet Session and User Check
8476 if (m_checkPackets)
8477 {
8478 if (mirpk.AgentData.SessionID != SessionId ||
8479 mirpk.AgentData.AgentID != AgentId)
8480 return true;
8481 }
8482 #endregion
8483
8484 //m_log.Debug(mirpk.ToString());
8485 MapItemRequest handlerMapItemRequest = OnMapItemRequest;
8486 if (handlerMapItemRequest != null)
8487 {
8488 handlerMapItemRequest(this, mirpk.AgentData.Flags, mirpk.AgentData.EstateID,
8489 mirpk.AgentData.Godlike, mirpk.RequestData.ItemType,
8490 mirpk.RequestData.RegionHandle);
8491
8492 }
8493 return true;
8494 }
8495
8496 private bool HandleTransferAbort(IClientAPI sender, Packet Pack)
8497 {
8498 return true;
8499 }
8500
8501 private bool HandleMuteListRequest(IClientAPI sender, Packet Pack)
8502 {
8503 MuteListRequestPacket muteListRequest =
8504 (MuteListRequestPacket)Pack;
8505
8506 #region Packet Session and User Check
8507 if (m_checkPackets)
8508 {
8509 if (muteListRequest.AgentData.SessionID != SessionId ||
8510 muteListRequest.AgentData.AgentID != AgentId)
8511 return true;
8512 }
8513 #endregion
8514
8515 MuteListRequest handlerMuteListRequest = OnMuteListRequest;
8516 if (handlerMuteListRequest != null)
8517 {
8518 handlerMuteListRequest(this, muteListRequest.MuteData.MuteCRC);
8519 }
8520 else
8521 {
8522 SendUseCachedMuteList();
8523 }
8524 return true;
8525 }
8526
8527 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
8528 {
8529 return true;
8530 }
8531
8532 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
8533 {
8534 return true;
8535 }
8536
8537 private bool HandleInventoryDescendents(IClientAPI sender, Packet Pack)
8538 {
8539 return true;
8540 }
8541
8542 #endregion unimplemented handlers
8543
8544 #region Dir handlers
8545
8546 private bool HandleDirPlacesQuery(IClientAPI sender, Packet Pack)
8547 {
8548 DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack;
8549 //m_log.Debug(dirPlacesQueryPacket.ToString());
8550
8551 #region Packet Session and User Check
8552 if (m_checkPackets)
8553 {
8554 if (dirPlacesQueryPacket.AgentData.SessionID != SessionId ||
8555 dirPlacesQueryPacket.AgentData.AgentID != AgentId)
8556 return true;
8557 }
8558 #endregion
8559
8560 DirPlacesQuery handlerDirPlacesQuery = OnDirPlacesQuery;
8561 if (handlerDirPlacesQuery != null)
8562 {
8563 handlerDirPlacesQuery(this,
8564 dirPlacesQueryPacket.QueryData.QueryID,
8565 Utils.BytesToString(
8566 dirPlacesQueryPacket.QueryData.QueryText),
8567 (int)dirPlacesQueryPacket.QueryData.QueryFlags,
8568 (int)dirPlacesQueryPacket.QueryData.Category,
8569 Utils.BytesToString(
8570 dirPlacesQueryPacket.QueryData.SimName),
8571 dirPlacesQueryPacket.QueryData.QueryStart);
8572 }
8573 return true;
8574 }
8575
8576 private bool HandleDirFindQuery(IClientAPI sender, Packet Pack)
8577 {
8578 DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack;
8579
8580 #region Packet Session and User Check
8581 if (m_checkPackets)
8582 {
8583 if (dirFindQueryPacket.AgentData.SessionID != SessionId ||
8584 dirFindQueryPacket.AgentData.AgentID != AgentId)
8585 return true;
8586 }
8587 #endregion
8588
8589 DirFindQuery handlerDirFindQuery = OnDirFindQuery;
8590 if (handlerDirFindQuery != null)
8591 {
8592 handlerDirFindQuery(this,
8593 dirFindQueryPacket.QueryData.QueryID,
8594 Utils.BytesToString(
8595 dirFindQueryPacket.QueryData.QueryText),
8596 dirFindQueryPacket.QueryData.QueryFlags,
8597 dirFindQueryPacket.QueryData.QueryStart);
8598 }
8599 return true;
8600 }
8601
8602 private bool HandleDirLandQuery(IClientAPI sender, Packet Pack)
8603 {
8604 DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack;
8605
8606 #region Packet Session and User Check
8607 if (m_checkPackets)
8608 {
8609 if (dirLandQueryPacket.AgentData.SessionID != SessionId ||
8610 dirLandQueryPacket.AgentData.AgentID != AgentId)
8611 return true;
8612 }
8613 #endregion
8614
8615 DirLandQuery handlerDirLandQuery = OnDirLandQuery;
8616 if (handlerDirLandQuery != null)
8617 {
8618 handlerDirLandQuery(this,
8619 dirLandQueryPacket.QueryData.QueryID,
8620 dirLandQueryPacket.QueryData.QueryFlags,
8621 dirLandQueryPacket.QueryData.SearchType,
8622 dirLandQueryPacket.QueryData.Price,
8623 dirLandQueryPacket.QueryData.Area,
8624 dirLandQueryPacket.QueryData.QueryStart);
8625 }
8626 return true;
8627 }
8628
8629 private bool HandleDirPopularQuery(IClientAPI sender, Packet Pack)
8630 {
8631 DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack;
8632
8633 #region Packet Session and User Check
8634 if (m_checkPackets)
8635 {
8636 if (dirPopularQueryPacket.AgentData.SessionID != SessionId ||
8637 dirPopularQueryPacket.AgentData.AgentID != AgentId)
8638 return true;
8639 }
8640 #endregion
8641
8642 DirPopularQuery handlerDirPopularQuery = OnDirPopularQuery;
8643 if (handlerDirPopularQuery != null)
8644 {
8645 handlerDirPopularQuery(this,
8646 dirPopularQueryPacket.QueryData.QueryID,
8647 dirPopularQueryPacket.QueryData.QueryFlags);
8648 }
8649 return true;
8650 }
8651
8652 private bool HandleDirClassifiedQuery(IClientAPI sender, Packet Pack)
8653 {
8654 DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack;
8655
8656 #region Packet Session and User Check
8657 if (m_checkPackets)
8658 {
8659 if (dirClassifiedQueryPacket.AgentData.SessionID != SessionId ||
8660 dirClassifiedQueryPacket.AgentData.AgentID != AgentId)
8661 return true;
8662 }
8663 #endregion
8664
8665 DirClassifiedQuery handlerDirClassifiedQuery = OnDirClassifiedQuery;
8666 if (handlerDirClassifiedQuery != null)
8667 {
8668 handlerDirClassifiedQuery(this,
8669 dirClassifiedQueryPacket.QueryData.QueryID,
8670 Utils.BytesToString(
8671 dirClassifiedQueryPacket.QueryData.QueryText),
8672 dirClassifiedQueryPacket.QueryData.QueryFlags,
8673 dirClassifiedQueryPacket.QueryData.Category,
8674 dirClassifiedQueryPacket.QueryData.QueryStart);
8675 }
8676 return true;
8677 }
8678
8679 private bool HandleEventInfoRequest(IClientAPI sender, Packet Pack)
8680 {
8681 EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack;
8682
8683 #region Packet Session and User Check
8684 if (m_checkPackets)
8685 {
8686 if (eventInfoRequestPacket.AgentData.SessionID != SessionId ||
8687 eventInfoRequestPacket.AgentData.AgentID != AgentId)
8688 return true;
8689 }
8690 #endregion
8691
8692 if (OnEventInfoRequest != null)
8693 {
8694 OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID);
8695 }
8696 return true;
8697 }
8698
8699 #endregion
8700
8701 #region Calling Card
8702
8703 private bool HandleOfferCallingCard(IClientAPI sender, Packet Pack)
8704 {
8705 OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack;
8706
8707 #region Packet Session and User Check
8708 if (m_checkPackets)
8709 {
8710 if (offerCallingCardPacket.AgentData.SessionID != SessionId ||
8711 offerCallingCardPacket.AgentData.AgentID != AgentId)
8712 return true;
8713 }
8714 #endregion
8715
8716 if (OnOfferCallingCard != null)
8717 {
8718 OnOfferCallingCard(this,
8719 offerCallingCardPacket.AgentBlock.DestID,
8720 offerCallingCardPacket.AgentBlock.TransactionID);
8721 }
8722 return true;
8723 }
8724
8725 private bool HandleAcceptCallingCard(IClientAPI sender, Packet Pack)
8726 {
8727 AcceptCallingCardPacket acceptCallingCardPacket = (AcceptCallingCardPacket)Pack;
8728
8729 #region Packet Session and User Check
8730 if (m_checkPackets)
8731 {
8732 if (acceptCallingCardPacket.AgentData.SessionID != SessionId ||
8733 acceptCallingCardPacket.AgentData.AgentID != AgentId)
8734 return true;
8735 }
8736 #endregion
8737
8738 // according to http://wiki.secondlife.com/wiki/AcceptCallingCard FolderData should
8739 // contain exactly one entry
8740 if (OnAcceptCallingCard != null && acceptCallingCardPacket.FolderData.Length > 0)
8741 {
8742 OnAcceptCallingCard(this,
8743 acceptCallingCardPacket.TransactionBlock.TransactionID,
8744 acceptCallingCardPacket.FolderData[0].FolderID);
8745 }
8746 return true;
8747 }
8748
8749 private bool HandleDeclineCallingCard(IClientAPI sender, Packet Pack)
8750 {
8751 DeclineCallingCardPacket declineCallingCardPacket = (DeclineCallingCardPacket)Pack;
8752
8753 #region Packet Session and User Check
8754 if (m_checkPackets)
8755 {
8756 if (declineCallingCardPacket.AgentData.SessionID != SessionId ||
8757 declineCallingCardPacket.AgentData.AgentID != AgentId)
8758 return true;
8759 }
8760 #endregion
8761
8762 if (OnDeclineCallingCard != null)
8763 {
8764 OnDeclineCallingCard(this,
8765 declineCallingCardPacket.TransactionBlock.TransactionID);
8766 }
8767 return true;
8768 }
8769
8770 #endregion Calling Card
8771
8772 #region Groups
8773
8774 private bool HandleActivateGroup(IClientAPI sender, Packet Pack)
8775 {
8776 ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack;
8777
8778 #region Packet Session and User Check
8779 if (m_checkPackets)
8780 {
8781 if (activateGroupPacket.AgentData.SessionID != SessionId ||
8782 activateGroupPacket.AgentData.AgentID != AgentId)
8783 return true;
8784 }
8785 #endregion
8786
8787 if (m_GroupsModule != null)
8788 {
8789 m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID);
8790 m_GroupsModule.SendAgentGroupDataUpdate(this);
8791 }
8792 return true;
8793
8794 }
8795
8796 private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack)
8797 {
8798 GroupTitlesRequestPacket groupTitlesRequest =
8799 (GroupTitlesRequestPacket)Pack;
8800
8801 #region Packet Session and User Check
8802 if (m_checkPackets)
8803 {
8804 if (groupTitlesRequest.AgentData.SessionID != SessionId ||
8805 groupTitlesRequest.AgentData.AgentID != AgentId)
8806 return true;
8807 }
8808 #endregion
8809
8810 if (m_GroupsModule != null)
8811 {
8812 GroupTitlesReplyPacket groupTitlesReply = (GroupTitlesReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupTitlesReply);
8813
8814 groupTitlesReply.AgentData =
8815 new GroupTitlesReplyPacket.AgentDataBlock();
8816
8817 groupTitlesReply.AgentData.AgentID = AgentId;
8818 groupTitlesReply.AgentData.GroupID =
8819 groupTitlesRequest.AgentData.GroupID;
8820
8821 groupTitlesReply.AgentData.RequestID =
8822 groupTitlesRequest.AgentData.RequestID;
8823
8824 List<GroupTitlesData> titles =
8825 m_GroupsModule.GroupTitlesRequest(this,
8826 groupTitlesRequest.AgentData.GroupID);
8827
8828 groupTitlesReply.GroupData =
8829 new GroupTitlesReplyPacket.GroupDataBlock[titles.Count];
8830
8831 int i = 0;
8832 foreach (GroupTitlesData d in titles)
8833 {
8834 groupTitlesReply.GroupData[i] =
8835 new GroupTitlesReplyPacket.GroupDataBlock();
8836
8837 groupTitlesReply.GroupData[i].Title =
8838 Util.StringToBytes256(d.Name);
8839 groupTitlesReply.GroupData[i].RoleID =
8840 d.UUID;
8841 groupTitlesReply.GroupData[i].Selected =
8842 d.Selected;
8843 i++;
8844 }
8845
8846 OutPacket(groupTitlesReply, ThrottleOutPacketType.Task);
8847 }
8848 return true;
8849 }
8850 private bool HandleGroupProfileRequest(IClientAPI sender, Packet Pack)
8851 {
8852 GroupProfileRequestPacket groupProfileRequest =
8853 (GroupProfileRequestPacket)Pack;
8854
8855 #region Packet Session and User Check
8856 if (m_checkPackets)
8857 {
8858 if (groupProfileRequest.AgentData.SessionID != SessionId ||
8859 groupProfileRequest.AgentData.AgentID != AgentId)
8860 return true;
8861 }
8862 #endregion
8863
8864 if (m_GroupsModule != null)
8865 {
8866 GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply);
8867
8868 groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock();
8869 groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock();
8870 groupProfileReply.AgentData.AgentID = AgentId;
8871
8872 GroupProfileData d = m_GroupsModule.GroupProfileRequest(this,
8873 groupProfileRequest.GroupData.GroupID);
8874
8875 groupProfileReply.GroupData.GroupID = d.GroupID;
8876 groupProfileReply.GroupData.Name = Util.StringToBytes256(d.Name);
8877 groupProfileReply.GroupData.Charter = Util.StringToBytes1024(d.Charter);
8878 groupProfileReply.GroupData.ShowInList = d.ShowInList;
8879 groupProfileReply.GroupData.MemberTitle = Util.StringToBytes256(d.MemberTitle);
8880 groupProfileReply.GroupData.PowersMask = d.PowersMask;
8881 groupProfileReply.GroupData.InsigniaID = d.InsigniaID;
8882 groupProfileReply.GroupData.FounderID = d.FounderID;
8883 groupProfileReply.GroupData.MembershipFee = d.MembershipFee;
8884 groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment;
8885 groupProfileReply.GroupData.Money = d.Money;
8886 groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount;
8887 groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount;
8888 groupProfileReply.GroupData.AllowPublish = d.AllowPublish;
8889 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
8890 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
8891
8892 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
8893 }
8894 return true;
8895 }
8896 private bool HandleGroupMembersRequest(IClientAPI sender, Packet Pack)
8897 {
8898 GroupMembersRequestPacket groupMembersRequestPacket =
8899 (GroupMembersRequestPacket)Pack;
8900
8901 #region Packet Session and User Check
8902 if (m_checkPackets)
8903 {
8904 if (groupMembersRequestPacket.AgentData.SessionID != SessionId ||
8905 groupMembersRequestPacket.AgentData.AgentID != AgentId)
8906 return true;
8907 }
8908 #endregion
8909
8910 if (m_GroupsModule != null)
8911 {
8912 List<GroupMembersData> members =
8913 m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
8914
8915 int memberCount = members.Count;
8916
8917 while (true)
8918 {
8919 int blockCount = members.Count;
8920 if (blockCount > 40)
8921 blockCount = 40;
8922
8923 GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply);
8924
8925 groupMembersReply.AgentData =
8926 new GroupMembersReplyPacket.AgentDataBlock();
8927 groupMembersReply.GroupData =
8928 new GroupMembersReplyPacket.GroupDataBlock();
8929 groupMembersReply.MemberData =
8930 new GroupMembersReplyPacket.MemberDataBlock[
8931 blockCount];
8932
8933 groupMembersReply.AgentData.AgentID = AgentId;
8934 groupMembersReply.GroupData.GroupID =
8935 groupMembersRequestPacket.GroupData.GroupID;
8936 groupMembersReply.GroupData.RequestID =
8937 groupMembersRequestPacket.GroupData.RequestID;
8938 groupMembersReply.GroupData.MemberCount = memberCount;
8939
8940 for (int i = 0; i < blockCount; i++)
8941 {
8942 GroupMembersData m = members[0];
8943 members.RemoveAt(0);
8944
8945 groupMembersReply.MemberData[i] =
8946 new GroupMembersReplyPacket.MemberDataBlock();
8947 groupMembersReply.MemberData[i].AgentID =
8948 m.AgentID;
8949 groupMembersReply.MemberData[i].Contribution =
8950 m.Contribution;
8951 groupMembersReply.MemberData[i].OnlineStatus =
8952 Util.StringToBytes256(m.OnlineStatus);
8953 groupMembersReply.MemberData[i].AgentPowers =
8954 m.AgentPowers;
8955 groupMembersReply.MemberData[i].Title =
8956 Util.StringToBytes256(m.Title);
8957 groupMembersReply.MemberData[i].IsOwner =
8958 m.IsOwner;
8959 }
8960 OutPacket(groupMembersReply, ThrottleOutPacketType.Task);
8961 if (members.Count == 0)
8962 return true;
8963 }
8964 }
8965 return true;
8966 }
8967 private bool HandleGroupRoleDataRequest(IClientAPI sender, Packet Pack)
8968 {
8969 GroupRoleDataRequestPacket groupRolesRequest =
8970 (GroupRoleDataRequestPacket)Pack;
8971
8972 #region Packet Session and User Check
8973 if (m_checkPackets)
8974 {
8975 if (groupRolesRequest.AgentData.SessionID != SessionId ||
8976 groupRolesRequest.AgentData.AgentID != AgentId)
8977 return true;
8978 }
8979 #endregion
8980
8981 if (m_GroupsModule != null)
8982 {
8983 GroupRoleDataReplyPacket groupRolesReply = (GroupRoleDataReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleDataReply);
8984
8985 groupRolesReply.AgentData =
8986 new GroupRoleDataReplyPacket.AgentDataBlock();
8987
8988 groupRolesReply.AgentData.AgentID = AgentId;
8989
8990 groupRolesReply.GroupData =
8991 new GroupRoleDataReplyPacket.GroupDataBlock();
8992
8993 groupRolesReply.GroupData.GroupID =
8994 groupRolesRequest.GroupData.GroupID;
8995
8996 groupRolesReply.GroupData.RequestID =
8997 groupRolesRequest.GroupData.RequestID;
8998
8999 List<GroupRolesData> titles =
9000 m_GroupsModule.GroupRoleDataRequest(this,
9001 groupRolesRequest.GroupData.GroupID);
9002
9003 groupRolesReply.GroupData.RoleCount =
9004 titles.Count;
9005
9006 groupRolesReply.RoleData =
9007 new GroupRoleDataReplyPacket.RoleDataBlock[titles.Count];
9008
9009 int i = 0;
9010 foreach (GroupRolesData d in titles)
9011 {
9012 groupRolesReply.RoleData[i] =
9013 new GroupRoleDataReplyPacket.RoleDataBlock();
9014
9015 groupRolesReply.RoleData[i].RoleID =
9016 d.RoleID;
9017 groupRolesReply.RoleData[i].Name =
9018 Util.StringToBytes256(d.Name);
9019 groupRolesReply.RoleData[i].Title =
9020 Util.StringToBytes256(d.Title);
9021 groupRolesReply.RoleData[i].Description =
9022 Util.StringToBytes1024(d.Description);
9023 groupRolesReply.RoleData[i].Powers =
9024 d.Powers;
9025 groupRolesReply.RoleData[i].Members =
9026 (uint)d.Members;
9027
9028 i++;
9029 }
9030
9031 OutPacket(groupRolesReply, ThrottleOutPacketType.Task);
9032 }
9033 return true;
9034 }
9035 private bool HandleGroupRoleMembersRequest(IClientAPI sender, Packet Pack)
9036 {
9037 GroupRoleMembersRequestPacket groupRoleMembersRequest =
9038 (GroupRoleMembersRequestPacket)Pack;
9039
9040 #region Packet Session and User Check
9041 if (m_checkPackets)
9042 {
9043 if (groupRoleMembersRequest.AgentData.SessionID != SessionId ||
9044 groupRoleMembersRequest.AgentData.AgentID != AgentId)
9045 return true;
9046 }
9047 #endregion
9048
9049 if (m_GroupsModule != null)
9050 {
9051 List<GroupRoleMembersData> mappings =
9052 m_GroupsModule.GroupRoleMembersRequest(this,
9053 groupRoleMembersRequest.GroupData.GroupID);
9054
9055 int mappingsCount = mappings.Count;
9056
9057 while (mappings.Count > 0)
9058 {
9059 int pairs = mappings.Count;
9060 if (pairs > 32)
9061 pairs = 32;
9062
9063 GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply);
9064 groupRoleMembersReply.AgentData =
9065 new GroupRoleMembersReplyPacket.AgentDataBlock();
9066 groupRoleMembersReply.AgentData.AgentID =
9067 AgentId;
9068 groupRoleMembersReply.AgentData.GroupID =
9069 groupRoleMembersRequest.GroupData.GroupID;
9070 groupRoleMembersReply.AgentData.RequestID =
9071 groupRoleMembersRequest.GroupData.RequestID;
9072
9073 groupRoleMembersReply.AgentData.TotalPairs =
9074 (uint)mappingsCount;
9075
9076 groupRoleMembersReply.MemberData =
9077 new GroupRoleMembersReplyPacket.MemberDataBlock[pairs];
9078
9079 for (int i = 0; i < pairs; i++)
9080 {
9081 GroupRoleMembersData d = mappings[0];
9082 mappings.RemoveAt(0);
9083
9084 groupRoleMembersReply.MemberData[i] =
9085 new GroupRoleMembersReplyPacket.MemberDataBlock();
9086
9087 groupRoleMembersReply.MemberData[i].RoleID =
9088 d.RoleID;
9089 groupRoleMembersReply.MemberData[i].MemberID =
9090 d.MemberID;
9091 }
9092
9093 OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task);
9094 }
9095 }
9096 return true;
9097 }
9098 private bool HandleCreateGroupRequest(IClientAPI sender, Packet Pack)
9099 {
9100 CreateGroupRequestPacket createGroupRequest =
9101 (CreateGroupRequestPacket)Pack;
9102
9103 #region Packet Session and User Check
9104 if (m_checkPackets)
9105 {
9106 if (createGroupRequest.AgentData.SessionID != SessionId ||
9107 createGroupRequest.AgentData.AgentID != AgentId)
9108 return true;
9109 }
9110 #endregion
9111
9112 if (m_GroupsModule != null)
9113 {
9114 m_GroupsModule.CreateGroup(this,
9115 Utils.BytesToString(createGroupRequest.GroupData.Name),
9116 Utils.BytesToString(createGroupRequest.GroupData.Charter),
9117 createGroupRequest.GroupData.ShowInList,
9118 createGroupRequest.GroupData.InsigniaID,
9119 createGroupRequest.GroupData.MembershipFee,
9120 createGroupRequest.GroupData.OpenEnrollment,
9121 createGroupRequest.GroupData.AllowPublish,
9122 createGroupRequest.GroupData.MaturePublish);
9123 }
9124 return true;
9125 }
9126 private bool HandleUpdateGroupInfo(IClientAPI sender, Packet Pack)
9127 {
9128 UpdateGroupInfoPacket updateGroupInfo =
9129 (UpdateGroupInfoPacket)Pack;
9130
9131 #region Packet Session and User Check
9132 if (m_checkPackets)
9133 {
9134 if (updateGroupInfo.AgentData.SessionID != SessionId ||
9135 updateGroupInfo.AgentData.AgentID != AgentId)
9136 return true;
9137 }
9138 #endregion
9139
9140 if (m_GroupsModule != null)
9141 {
9142 m_GroupsModule.UpdateGroupInfo(this,
9143 updateGroupInfo.GroupData.GroupID,
9144 Utils.BytesToString(updateGroupInfo.GroupData.Charter),
9145 updateGroupInfo.GroupData.ShowInList,
9146 updateGroupInfo.GroupData.InsigniaID,
9147 updateGroupInfo.GroupData.MembershipFee,
9148 updateGroupInfo.GroupData.OpenEnrollment,
9149 updateGroupInfo.GroupData.AllowPublish,
9150 updateGroupInfo.GroupData.MaturePublish);
9151 }
9152
9153 return true;
9154 }
9155 private bool HandleSetGroupAcceptNotices(IClientAPI sender, Packet Pack)
9156 {
9157 SetGroupAcceptNoticesPacket setGroupAcceptNotices =
9158 (SetGroupAcceptNoticesPacket)Pack;
9159
9160 #region Packet Session and User Check
9161 if (m_checkPackets)
9162 {
9163 if (setGroupAcceptNotices.AgentData.SessionID != SessionId ||
9164 setGroupAcceptNotices.AgentData.AgentID != AgentId)
9165 return true;
9166 }
9167 #endregion
9168
9169 if (m_GroupsModule != null)
9170 {
9171 m_GroupsModule.SetGroupAcceptNotices(this,
9172 setGroupAcceptNotices.Data.GroupID,
9173 setGroupAcceptNotices.Data.AcceptNotices,
9174 setGroupAcceptNotices.NewData.ListInProfile);
9175 }
9176
9177 return true;
9178 }
9179 private bool HandleGroupTitleUpdate(IClientAPI sender, Packet Pack)
9180 {
9181 GroupTitleUpdatePacket groupTitleUpdate =
9182 (GroupTitleUpdatePacket)Pack;
9183
9184 #region Packet Session and User Check
9185 if (m_checkPackets)
9186 {
9187 if (groupTitleUpdate.AgentData.SessionID != SessionId ||
9188 groupTitleUpdate.AgentData.AgentID != AgentId)
9189 return true;
9190 }
9191 #endregion
9192
9193 if (m_GroupsModule != null)
9194 {
9195 m_GroupsModule.GroupTitleUpdate(this,
9196 groupTitleUpdate.AgentData.GroupID,
9197 groupTitleUpdate.AgentData.TitleRoleID);
9198 }
9199
9200 return true;
9201 }
9202 private bool HandleParcelDeedToGroup(IClientAPI sender, Packet Pack)
9203 {
9204 ParcelDeedToGroupPacket parcelDeedToGroup = (ParcelDeedToGroupPacket)Pack;
9205 if (m_GroupsModule != null)
9206 {
9207 ParcelDeedToGroup handlerParcelDeedToGroup = OnParcelDeedToGroup;
9208 if (handlerParcelDeedToGroup != null)
9209 {
9210 handlerParcelDeedToGroup(parcelDeedToGroup.Data.LocalID, parcelDeedToGroup.Data.GroupID, this);
9211
9212 }
9213 }
9214
9215 return true;
9216 }
9217 private bool HandleGroupNoticesListRequest(IClientAPI sender, Packet Pack)
9218 {
9219 GroupNoticesListRequestPacket groupNoticesListRequest =
9220 (GroupNoticesListRequestPacket)Pack;
9221
9222 #region Packet Session and User Check
9223 if (m_checkPackets)
9224 {
9225 if (groupNoticesListRequest.AgentData.SessionID != SessionId ||
9226 groupNoticesListRequest.AgentData.AgentID != AgentId)
9227 return true;
9228 }
9229 #endregion
9230
9231 if (m_GroupsModule != null)
9232 {
9233 GroupNoticeData[] gn =
9234 m_GroupsModule.GroupNoticesListRequest(this,
9235 groupNoticesListRequest.Data.GroupID);
9236
9237 GroupNoticesListReplyPacket groupNoticesListReply = (GroupNoticesListReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupNoticesListReply);
9238 groupNoticesListReply.AgentData =
9239 new GroupNoticesListReplyPacket.AgentDataBlock();
9240 groupNoticesListReply.AgentData.AgentID = AgentId;
9241 groupNoticesListReply.AgentData.GroupID = groupNoticesListRequest.Data.GroupID;
9242
9243 groupNoticesListReply.Data = new GroupNoticesListReplyPacket.DataBlock[gn.Length];
9244
9245 int i = 0;
9246 foreach (GroupNoticeData g in gn)
9247 {
9248 groupNoticesListReply.Data[i] = new GroupNoticesListReplyPacket.DataBlock();
9249 groupNoticesListReply.Data[i].NoticeID =
9250 g.NoticeID;
9251 groupNoticesListReply.Data[i].Timestamp =
9252 g.Timestamp;
9253 groupNoticesListReply.Data[i].FromName =
9254 Util.StringToBytes256(g.FromName);
9255 groupNoticesListReply.Data[i].Subject =
9256 Util.StringToBytes256(g.Subject);
9257 groupNoticesListReply.Data[i].HasAttachment =
9258 g.HasAttachment;
9259 groupNoticesListReply.Data[i].AssetType =
9260 g.AssetType;
9261 i++;
9262 }
9263
9264 OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task);
9265 }
9266
9267 return true;
9268 }
9269 private bool HandleGroupNoticeRequest(IClientAPI sender, Packet Pack)
9270 {
9271 GroupNoticeRequestPacket groupNoticeRequest =
9272 (GroupNoticeRequestPacket)Pack;
9273
9274 #region Packet Session and User Check
9275 if (m_checkPackets)
9276 {
9277 if (groupNoticeRequest.AgentData.SessionID != SessionId ||
9278 groupNoticeRequest.AgentData.AgentID != AgentId)
9279 return true;
9280 }
9281 #endregion
9282
9283 if (m_GroupsModule != null)
9284 {
9285 m_GroupsModule.GroupNoticeRequest(this,
9286 groupNoticeRequest.Data.GroupNoticeID);
9287 }
9288 return true;
9289 }
9290 private bool HandleGroupRoleUpdate(IClientAPI sender, Packet Pack)
9291 {
9292 GroupRoleUpdatePacket groupRoleUpdate =
9293 (GroupRoleUpdatePacket)Pack;
9294
9295 #region Packet Session and User Check
9296 if (m_checkPackets)
9297 {
9298 if (groupRoleUpdate.AgentData.SessionID != SessionId ||
9299 groupRoleUpdate.AgentData.AgentID != AgentId)
9300 return true;
9301 }
9302 #endregion
9303
9304 if (m_GroupsModule != null)
9305 {
9306 foreach (GroupRoleUpdatePacket.RoleDataBlock d in
9307 groupRoleUpdate.RoleData)
9308 {
9309 m_GroupsModule.GroupRoleUpdate(this,
9310 groupRoleUpdate.AgentData.GroupID,
9311 d.RoleID,
9312 Utils.BytesToString(d.Name),
9313 Utils.BytesToString(d.Description),
9314 Utils.BytesToString(d.Title),
9315 d.Powers,
9316 d.UpdateType);
9317 }
9318 m_GroupsModule.NotifyChange(groupRoleUpdate.AgentData.GroupID);
9319 }
9320 return true;
9321 }
9322 private bool HandleGroupRoleChanges(IClientAPI sender, Packet Pack)
9323 {
9324 GroupRoleChangesPacket groupRoleChanges =
9325 (GroupRoleChangesPacket)Pack;
9326
9327 #region Packet Session and User Check
9328 if (m_checkPackets)
9329 {
9330 if (groupRoleChanges.AgentData.SessionID != SessionId ||
9331 groupRoleChanges.AgentData.AgentID != AgentId)
9332 return true;
9333 }
9334 #endregion
9335
9336 if (m_GroupsModule != null)
9337 {
9338 foreach (GroupRoleChangesPacket.RoleChangeBlock d in
9339 groupRoleChanges.RoleChange)
9340 {
9341 m_GroupsModule.GroupRoleChanges(this,
9342 groupRoleChanges.AgentData.GroupID,
9343 d.RoleID,
9344 d.MemberID,
9345 d.Change);
9346 }
9347 m_GroupsModule.NotifyChange(groupRoleChanges.AgentData.GroupID);
9348 }
9349 return true;
9350 }
9351 private bool HandleJoinGroupRequest(IClientAPI sender, Packet Pack)
9352 {
9353 JoinGroupRequestPacket joinGroupRequest =
9354 (JoinGroupRequestPacket)Pack;
9355
9356 #region Packet Session and User Check
9357 if (m_checkPackets)
9358 {
9359 if (joinGroupRequest.AgentData.SessionID != SessionId ||
9360 joinGroupRequest.AgentData.AgentID != AgentId)
9361 return true;
9362 }
9363 #endregion
9364
9365 if (m_GroupsModule != null)
9366 {
9367 m_GroupsModule.JoinGroupRequest(this,
9368 joinGroupRequest.GroupData.GroupID);
9369 }
9370 return true;
9371 }
9372 private bool HandleLeaveGroupRequest(IClientAPI sender, Packet Pack)
9373 {
9374 LeaveGroupRequestPacket leaveGroupRequest =
9375 (LeaveGroupRequestPacket)Pack;
9376
9377 #region Packet Session and User Check
9378 if (m_checkPackets)
9379 {
9380 if (leaveGroupRequest.AgentData.SessionID != SessionId ||
9381 leaveGroupRequest.AgentData.AgentID != AgentId)
9382 return true;
9383 }
9384 #endregion
9385
9386 if (m_GroupsModule != null)
9387 {
9388 m_GroupsModule.LeaveGroupRequest(this,
9389 leaveGroupRequest.GroupData.GroupID);
9390 }
9391 return true;
9392 }
9393 private bool HandleEjectGroupMemberRequest(IClientAPI sender, Packet Pack)
9394 {
9395 EjectGroupMemberRequestPacket ejectGroupMemberRequest =
9396 (EjectGroupMemberRequestPacket)Pack;
9397
9398 #region Packet Session and User Check
9399 if (m_checkPackets)
9400 {
9401 if (ejectGroupMemberRequest.AgentData.SessionID != SessionId ||
9402 ejectGroupMemberRequest.AgentData.AgentID != AgentId)
9403 return true;
9404 }
9405 #endregion
9406
9407 if (m_GroupsModule != null)
9408 {
9409 foreach (EjectGroupMemberRequestPacket.EjectDataBlock e
9410 in ejectGroupMemberRequest.EjectData)
9411 {
9412 m_GroupsModule.EjectGroupMemberRequest(this,
9413 ejectGroupMemberRequest.GroupData.GroupID,
9414 e.EjecteeID);
9415 }
9416 }
9417 return true;
9418 }
9419 private bool HandleInviteGroupRequest(IClientAPI sender, Packet Pack)
9420 {
9421 InviteGroupRequestPacket inviteGroupRequest =
9422 (InviteGroupRequestPacket)Pack;
9423
9424 #region Packet Session and User Check
9425 if (m_checkPackets)
9426 {
9427 if (inviteGroupRequest.AgentData.SessionID != SessionId ||
9428 inviteGroupRequest.AgentData.AgentID != AgentId)
9429 return true;
9430 }
9431 #endregion
9432
9433 if (m_GroupsModule != null)
9434 {
9435 foreach (InviteGroupRequestPacket.InviteDataBlock b in
9436 inviteGroupRequest.InviteData)
9437 {
9438 m_GroupsModule.InviteGroupRequest(this,
9439 inviteGroupRequest.GroupData.GroupID,
9440 b.InviteeID,
9441 b.RoleID);
9442 }
9443 }
9444 return true;
9445 }
9446
9447 #endregion Groups
9448
9449 private bool HandleStartLure(IClientAPI sender, Packet Pack)
9450 {
9451 StartLurePacket startLureRequest = (StartLurePacket)Pack;
9452
9453 #region Packet Session and User Check
9454 if (m_checkPackets)
9455 {
9456 if (startLureRequest.AgentData.SessionID != SessionId ||
9457 startLureRequest.AgentData.AgentID != AgentId)
9458 return true;
9459 }
9460 #endregion
9461
9462 StartLure handlerStartLure = OnStartLure;
9463 if (handlerStartLure != null)
9464 handlerStartLure(startLureRequest.Info.LureType,
9465 Utils.BytesToString(
9466 startLureRequest.Info.Message),
9467 startLureRequest.TargetData[0].TargetID,
9468 this);
9469 return true;
9470 }
9471 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
9472 {
9473 TeleportLureRequestPacket teleportLureRequest =
9474 (TeleportLureRequestPacket)Pack;
9475
9476 #region Packet Session and User Check
9477 if (m_checkPackets)
9478 {
9479 if (teleportLureRequest.Info.SessionID != SessionId ||
9480 teleportLureRequest.Info.AgentID != AgentId)
9481 return true;
9482 }
9483 #endregion
9484
9485 TeleportLureRequest handlerTeleportLureRequest = OnTeleportLureRequest;
9486 if (handlerTeleportLureRequest != null)
9487 handlerTeleportLureRequest(
9488 teleportLureRequest.Info.LureID,
9489 teleportLureRequest.Info.TeleportFlags,
9490 this);
9491 return true;
9492 }
9493 private bool HandleClassifiedInfoRequest(IClientAPI sender, Packet Pack)
9494 {
9495 ClassifiedInfoRequestPacket classifiedInfoRequest =
9496 (ClassifiedInfoRequestPacket)Pack;
9497
9498 #region Packet Session and User Check
9499 if (m_checkPackets)
9500 {
9501 if (classifiedInfoRequest.AgentData.SessionID != SessionId ||
9502 classifiedInfoRequest.AgentData.AgentID != AgentId)
9503 return true;
9504 }
9505 #endregion
9506
9507 ClassifiedInfoRequest handlerClassifiedInfoRequest = OnClassifiedInfoRequest;
9508 if (handlerClassifiedInfoRequest != null)
9509 handlerClassifiedInfoRequest(
9510 classifiedInfoRequest.Data.ClassifiedID,
9511 this);
9512 return true;
9513 }
9514 private bool HandleClassifiedInfoUpdate(IClientAPI sender, Packet Pack)
9515 {
9516 ClassifiedInfoUpdatePacket classifiedInfoUpdate =
9517 (ClassifiedInfoUpdatePacket)Pack;
9518
9519 #region Packet Session and User Check
9520 if (m_checkPackets)
9521 {
9522 if (classifiedInfoUpdate.AgentData.SessionID != SessionId ||
9523 classifiedInfoUpdate.AgentData.AgentID != AgentId)
9524 return true;
9525 }
9526 #endregion
9527
9528 ClassifiedInfoUpdate handlerClassifiedInfoUpdate = OnClassifiedInfoUpdate;
9529 if (handlerClassifiedInfoUpdate != null)
9530 handlerClassifiedInfoUpdate(
9531 classifiedInfoUpdate.Data.ClassifiedID,
9532 classifiedInfoUpdate.Data.Category,
9533 Utils.BytesToString(
9534 classifiedInfoUpdate.Data.Name),
9535 Utils.BytesToString(
9536 classifiedInfoUpdate.Data.Desc),
9537 classifiedInfoUpdate.Data.ParcelID,
9538 classifiedInfoUpdate.Data.ParentEstate,
9539 classifiedInfoUpdate.Data.SnapshotID,
9540 new Vector3(
9541 classifiedInfoUpdate.Data.PosGlobal),
9542 classifiedInfoUpdate.Data.ClassifiedFlags,
9543 classifiedInfoUpdate.Data.PriceForListing,
9544 this);
9545 return true;
9546 }
9547 private bool HandleClassifiedDelete(IClientAPI sender, Packet Pack)
9548 {
9549 ClassifiedDeletePacket classifiedDelete =
9550 (ClassifiedDeletePacket)Pack;
9551
9552 #region Packet Session and User Check
9553 if (m_checkPackets)
9554 {
9555 if (classifiedDelete.AgentData.SessionID != SessionId ||
9556 classifiedDelete.AgentData.AgentID != AgentId)
9557 return true;
9558 }
9559 #endregion
9560
9561 ClassifiedDelete handlerClassifiedDelete = OnClassifiedDelete;
9562 if (handlerClassifiedDelete != null)
9563 handlerClassifiedDelete(
9564 classifiedDelete.Data.ClassifiedID,
9565 this);
9566 return true;
9567 }
9568 private bool HandleClassifiedGodDelete(IClientAPI sender, Packet Pack)
9569 {
9570 ClassifiedGodDeletePacket classifiedGodDelete =
9571 (ClassifiedGodDeletePacket)Pack;
9572
9573 #region Packet Session and User Check
9574 if (m_checkPackets)
9575 {
9576 if (classifiedGodDelete.AgentData.SessionID != SessionId ||
9577 classifiedGodDelete.AgentData.AgentID != AgentId)
9578 return true;
9579 }
9580 #endregion
9581
9582 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
9583 if (handlerClassifiedGodDelete != null)
9584 handlerClassifiedGodDelete(
9585 classifiedGodDelete.Data.ClassifiedID,
9586 this);
9587 return true;
9588 }
9589 private bool HandleEventGodDelete(IClientAPI sender, Packet Pack)
9590 {
9591 EventGodDeletePacket eventGodDelete =
9592 (EventGodDeletePacket)Pack;
9593
9594 #region Packet Session and User Check
9595 if (m_checkPackets)
9596 {
9597 if (eventGodDelete.AgentData.SessionID != SessionId ||
9598 eventGodDelete.AgentData.AgentID != AgentId)
9599 return true;
9600 }
9601 #endregion
9602
9603 EventGodDelete handlerEventGodDelete = OnEventGodDelete;
9604 if (handlerEventGodDelete != null)
9605 handlerEventGodDelete(
9606 eventGodDelete.EventData.EventID,
9607 eventGodDelete.QueryData.QueryID,
9608 Utils.BytesToString(
9609 eventGodDelete.QueryData.QueryText),
9610 eventGodDelete.QueryData.QueryFlags,
9611 eventGodDelete.QueryData.QueryStart,
9612 this);
9613 return true;
9614 }
9615 private bool HandleEventNotificationAddRequest(IClientAPI sender, Packet Pack)
9616 {
9617 EventNotificationAddRequestPacket eventNotificationAdd =
9618 (EventNotificationAddRequestPacket)Pack;
9619
9620 #region Packet Session and User Check
9621 if (m_checkPackets)
9622 {
9623 if (eventNotificationAdd.AgentData.SessionID != SessionId ||
9624 eventNotificationAdd.AgentData.AgentID != AgentId)
9625 return true;
9626 }
9627 #endregion
9628
9629 EventNotificationAddRequest handlerEventNotificationAddRequest = OnEventNotificationAddRequest;
9630 if (handlerEventNotificationAddRequest != null)
9631 handlerEventNotificationAddRequest(
9632 eventNotificationAdd.EventData.EventID, this);
9633 return true;
9634 }
9635 private bool HandleEventNotificationRemoveRequest(IClientAPI sender, Packet Pack)
9636 {
9637 EventNotificationRemoveRequestPacket eventNotificationRemove =
9638 (EventNotificationRemoveRequestPacket)Pack;
9639
9640 #region Packet Session and User Check
9641 if (m_checkPackets)
9642 {
9643 if (eventNotificationRemove.AgentData.SessionID != SessionId ||
9644 eventNotificationRemove.AgentData.AgentID != AgentId)
9645 return true;
9646 }
9647 #endregion
9648
9649 EventNotificationRemoveRequest handlerEventNotificationRemoveRequest = OnEventNotificationRemoveRequest;
9650 if (handlerEventNotificationRemoveRequest != null)
9651 handlerEventNotificationRemoveRequest(
9652 eventNotificationRemove.EventData.EventID, this);
9653 return true;
9654 }
9655 private bool HandleRetrieveInstantMessages(IClientAPI sender, Packet Pack)
9656 {
9657 RetrieveInstantMessagesPacket rimpInstantMessagePack = (RetrieveInstantMessagesPacket)Pack;
9658
9659 #region Packet Session and User Check
9660 if (m_checkPackets)
9661 {
9662 if (rimpInstantMessagePack.AgentData.SessionID != SessionId ||
9663 rimpInstantMessagePack.AgentData.AgentID != AgentId)
9664 return true;
9665 }
9666 #endregion
9667
9668 RetrieveInstantMessages handlerRetrieveInstantMessages = OnRetrieveInstantMessages;
9669 if (handlerRetrieveInstantMessages != null)
9670 handlerRetrieveInstantMessages(this);
9671 return true;
9672 }
9673 private bool HandlePickDelete(IClientAPI sender, Packet Pack)
9674 {
9675 PickDeletePacket pickDelete =
9676 (PickDeletePacket)Pack;
9677
9678 #region Packet Session and User Check
9679 if (m_checkPackets)
9680 {
9681 if (pickDelete.AgentData.SessionID != SessionId ||
9682 pickDelete.AgentData.AgentID != AgentId)
9683 return true;
9684 }
9685 #endregion
9686
9687 PickDelete handlerPickDelete = OnPickDelete;
9688 if (handlerPickDelete != null)
9689 handlerPickDelete(this, pickDelete.Data.PickID);
9690 return true;
9691 }
9692 private bool HandlePickGodDelete(IClientAPI sender, Packet Pack)
9693 {
9694 PickGodDeletePacket pickGodDelete =
9695 (PickGodDeletePacket)Pack;
9696
9697 #region Packet Session and User Check
9698 if (m_checkPackets)
9699 {
9700 if (pickGodDelete.AgentData.SessionID != SessionId ||
9701 pickGodDelete.AgentData.AgentID != AgentId)
9702 return true;
9703 }
9704 #endregion
9705
9706 PickGodDelete handlerPickGodDelete = OnPickGodDelete;
9707 if (handlerPickGodDelete != null)
9708 handlerPickGodDelete(this,
9709 pickGodDelete.AgentData.AgentID,
9710 pickGodDelete.Data.PickID,
9711 pickGodDelete.Data.QueryID);
9712 return true;
9713 }
9714 private bool HandlePickInfoUpdate(IClientAPI sender, Packet Pack)
9715 {
9716 PickInfoUpdatePacket pickInfoUpdate =
9717 (PickInfoUpdatePacket)Pack;
9718
9719 #region Packet Session and User Check
9720 if (m_checkPackets)
9721 {
9722 if (pickInfoUpdate.AgentData.SessionID != SessionId ||
9723 pickInfoUpdate.AgentData.AgentID != AgentId)
9724 return true;
9725 }
9726 #endregion
9727
9728 PickInfoUpdate handlerPickInfoUpdate = OnPickInfoUpdate;
9729 if (handlerPickInfoUpdate != null)
9730 handlerPickInfoUpdate(this,
9731 pickInfoUpdate.Data.PickID,
9732 pickInfoUpdate.Data.CreatorID,
9733 pickInfoUpdate.Data.TopPick,
9734 Utils.BytesToString(pickInfoUpdate.Data.Name),
9735 Utils.BytesToString(pickInfoUpdate.Data.Desc),
9736 pickInfoUpdate.Data.SnapshotID,
9737 pickInfoUpdate.Data.SortOrder,
9738 pickInfoUpdate.Data.Enabled);
9739 return true;
9740 }
9741 private bool HandleAvatarNotesUpdate(IClientAPI sender, Packet Pack)
9742 {
9743 AvatarNotesUpdatePacket avatarNotesUpdate =
9744 (AvatarNotesUpdatePacket)Pack;
9745
9746 #region Packet Session and User Check
9747 if (m_checkPackets)
9748 {
9749 if (avatarNotesUpdate.AgentData.SessionID != SessionId ||
9750 avatarNotesUpdate.AgentData.AgentID != AgentId)
9751 return true;
9752 }
9753 #endregion
9754
9755 AvatarNotesUpdate handlerAvatarNotesUpdate = OnAvatarNotesUpdate;
9756 if (handlerAvatarNotesUpdate != null)
9757 handlerAvatarNotesUpdate(this,
9758 avatarNotesUpdate.Data.TargetID,
9759 Utils.BytesToString(avatarNotesUpdate.Data.Notes));
9760 return true;
9761 }
9762 private bool HandleAvatarInterestsUpdate(IClientAPI sender, Packet Pack)
9763 {
9764 AvatarInterestsUpdatePacket avatarInterestUpdate =
9765 (AvatarInterestsUpdatePacket)Pack;
9766
9767 #region Packet Session and User Check
9768 if (m_checkPackets)
9769 {
9770 if (avatarInterestUpdate.AgentData.SessionID != SessionId ||
9771 avatarInterestUpdate.AgentData.AgentID != AgentId)
9772 return true;
9773 }
9774 #endregion
9775
9776 AvatarInterestUpdate handlerAvatarInterestUpdate = OnAvatarInterestUpdate;
9777 if (handlerAvatarInterestUpdate != null)
9778 handlerAvatarInterestUpdate(this,
9779 avatarInterestUpdate.PropertiesData.WantToMask,
9780 Utils.BytesToString(avatarInterestUpdate.PropertiesData.WantToText),
9781 avatarInterestUpdate.PropertiesData.SkillsMask,
9782 Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText),
9783 Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
9784 return true;
9785 }
9786 private bool HandleGrantUserRights(IClientAPI sender, Packet Pack)
9787 {
9788 GrantUserRightsPacket GrantUserRights =
9789 (GrantUserRightsPacket)Pack;
9790 #region Packet Session and User Check
9791 if (m_checkPackets)
9792 {
9793 if (GrantUserRights.AgentData.SessionID != SessionId ||
9794 GrantUserRights.AgentData.AgentID != AgentId)
9795 return true;
9796 }
9797 #endregion
9798 GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights;
9799 if (GrantUserRightsHandler != null)
9800 GrantUserRightsHandler(this,
9801 GrantUserRights.AgentData.AgentID,
9802 GrantUserRights.Rights[0].AgentRelated,
9803 GrantUserRights.Rights[0].RelatedRights);
9804 return true;
9805 }
9806 private bool HandlePlacesQuery(IClientAPI sender, Packet Pack)
9807 {
9808 PlacesQueryPacket placesQueryPacket =
9809 (PlacesQueryPacket)Pack;
9810
9811 PlacesQuery handlerPlacesQuery = OnPlacesQuery;
9812
9813 if (handlerPlacesQuery != null)
9814 handlerPlacesQuery(placesQueryPacket.AgentData.QueryID,
9815 placesQueryPacket.TransactionData.TransactionID,
9816 Utils.BytesToString(
9817 placesQueryPacket.QueryData.QueryText),
9818 placesQueryPacket.QueryData.QueryFlags,
9819 (byte)placesQueryPacket.QueryData.Category,
9820 Utils.BytesToString(
9821 placesQueryPacket.QueryData.SimName),
9822 this);
9823 return true;
9824 }
5246 9825
5247 #endregion Packet Handlers 9826 #endregion Packet Handlers
5248 9827
@@ -5732,15 +10311,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5732 10311
5733 if (ProcessPacketMethod(Pack)) 10312 if (ProcessPacketMethod(Pack))
5734 { 10313 {
10314 PacketPool.Instance.ReturnPacket(Pack);
5735 return; 10315 return;
5736 } 10316 }
5737 10317
5738 // Main packet processing conditional 10318 // Main packet processing conditional
5739 switch (Pack.Type) 10319 switch (Pack.Type)
5740 { 10320 {
5741 #region Scene/Avatar
5742 #region CommentedOut 10321 #region CommentedOut
5743 /* 10322 /*
10323 #region Scene/Avatar
10324
10325
5744 case PacketType.AvatarPropertiesRequest: 10326 case PacketType.AvatarPropertiesRequest:
5745 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 10327 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
5746 10328
@@ -6402,8 +10984,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6402 10984
6403 } 10985 }
6404 break; 10986 break;
6405 */ 10987
6406 #endregion
6407 case PacketType.AvatarPickerRequest: 10988 case PacketType.AvatarPickerRequest:
6408 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; 10989 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
6409 10990
@@ -6427,7 +11008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6427 Utils.BytesToString(querydata.Name)); 11008 Utils.BytesToString(querydata.Name));
6428 } 11009 }
6429 break; 11010 break;
6430 11011
6431 case PacketType.AgentDataUpdateRequest: 11012 case PacketType.AgentDataUpdateRequest:
6432 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; 11013 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
6433 11014
@@ -6547,7 +11128,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6547 11128
6548 #endregion 11129 #endregion
6549 11130
6550 #region Objects/m_sceneObjects 11131
11132 //#region Objects/m_sceneObjects
6551 11133
6552 case PacketType.ObjectLink: 11134 case PacketType.ObjectLink:
6553 ObjectLinkPacket link = (ObjectLinkPacket)Pack; 11135 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
@@ -6706,6 +11288,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6706 } 11288 }
6707 } 11289 }
6708 break; 11290 break;
11291
6709 case PacketType.ObjectDuplicate: 11292 case PacketType.ObjectDuplicate:
6710 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; 11293 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
6711 11294
@@ -6758,6 +11341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6758 } 11341 }
6759 } 11342 }
6760 break; 11343 break;
11344
6761 case PacketType.ObjectSelect: 11345 case PacketType.ObjectSelect:
6762 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 11346 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
6763 11347
@@ -6781,6 +11365,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6781 } 11365 }
6782 } 11366 }
6783 break; 11367 break;
11368
6784 case PacketType.ObjectDeselect: 11369 case PacketType.ObjectDeselect:
6785 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; 11370 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
6786 11371
@@ -6804,6 +11389,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6804 } 11389 }
6805 } 11390 }
6806 break; 11391 break;
11392
6807 case PacketType.ObjectPosition: 11393 case PacketType.ObjectPosition:
6808 // DEPRECATED: but till libsecondlife removes it, people will use it 11394 // DEPRECATED: but till libsecondlife removes it, people will use it
6809 ObjectPositionPacket position = (ObjectPositionPacket)Pack; 11395 ObjectPositionPacket position = (ObjectPositionPacket)Pack;
@@ -6826,6 +11412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6826 } 11412 }
6827 11413
6828 break; 11414 break;
11415
6829 case PacketType.ObjectScale: 11416 case PacketType.ObjectScale:
6830 // DEPRECATED: but till libsecondlife removes it, people will use it 11417 // DEPRECATED: but till libsecondlife removes it, people will use it
6831 ObjectScalePacket scale = (ObjectScalePacket)Pack; 11418 ObjectScalePacket scale = (ObjectScalePacket)Pack;
@@ -6847,6 +11434,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6847 } 11434 }
6848 11435
6849 break; 11436 break;
11437
6850 case PacketType.ObjectRotation: 11438 case PacketType.ObjectRotation:
6851 // DEPRECATED: but till libsecondlife removes it, people will use it 11439 // DEPRECATED: but till libsecondlife removes it, people will use it
6852 ObjectRotationPacket rotation = (ObjectRotationPacket)Pack; 11440 ObjectRotationPacket rotation = (ObjectRotationPacket)Pack;
@@ -6868,6 +11456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6868 } 11456 }
6869 11457
6870 break; 11458 break;
11459
6871 case PacketType.ObjectFlagUpdate: 11460 case PacketType.ObjectFlagUpdate:
6872 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 11461 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
6873 11462
@@ -6908,6 +11497,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6908 } 11497 }
6909 } 11498 }
6910 break; 11499 break;
11500
6911 case PacketType.ObjectGrab: 11501 case PacketType.ObjectGrab:
6912 ObjectGrabPacket grab = (ObjectGrabPacket)Pack; 11502 ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
6913 11503
@@ -6942,6 +11532,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6942 handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs); 11532 handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs);
6943 } 11533 }
6944 break; 11534 break;
11535
6945 case PacketType.ObjectGrabUpdate: 11536 case PacketType.ObjectGrabUpdate:
6946 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; 11537 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack;
6947 11538
@@ -6977,6 +11568,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6977 grabUpdate.ObjectData.GrabPosition, this, touchArgs); 11568 grabUpdate.ObjectData.GrabPosition, this, touchArgs);
6978 } 11569 }
6979 break; 11570 break;
11571
6980 case PacketType.ObjectDeGrab: 11572 case PacketType.ObjectDeGrab:
6981 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; 11573 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack;
6982 11574
@@ -7010,6 +11602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7010 handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs); 11602 handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs);
7011 } 11603 }
7012 break; 11604 break;
11605
7013 case PacketType.ObjectSpinStart: 11606 case PacketType.ObjectSpinStart:
7014 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet"); 11607 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet");
7015 ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack; 11608 ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack;
@@ -7053,6 +11646,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7053 handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this); 11646 handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this);
7054 } 11647 }
7055 break; 11648 break;
11649
11650
7056 case PacketType.ObjectSpinStop: 11651 case PacketType.ObjectSpinStop:
7057 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); 11652 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet");
7058 ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack; 11653 ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack;
@@ -7097,6 +11692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7097 } 11692 }
7098 } 11693 }
7099 break; 11694 break;
11695
7100 case PacketType.ObjectName: 11696 case PacketType.ObjectName:
7101 ObjectNamePacket objName = (ObjectNamePacket)Pack; 11697 ObjectNamePacket objName = (ObjectNamePacket)Pack;
7102 11698
@@ -7120,6 +11716,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7120 } 11716 }
7121 } 11717 }
7122 break; 11718 break;
11719
7123 case PacketType.ObjectPermissions: 11720 case PacketType.ObjectPermissions:
7124 if (OnObjectPermissions != null) 11721 if (OnObjectPermissions != null)
7125 { 11722 {
@@ -7195,6 +11792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7195 } 11792 }
7196 } 11793 }
7197 break; 11794 break;
11795
7198 case PacketType.ObjectDuplicateOnRay: 11796 case PacketType.ObjectDuplicateOnRay:
7199 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; 11797 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack;
7200 11798
@@ -7222,6 +11820,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7222 } 11820 }
7223 11821
7224 break; 11822 break;
11823
7225 case PacketType.RequestObjectPropertiesFamily: 11824 case PacketType.RequestObjectPropertiesFamily:
7226 //This powers the little tooltip that appears when you move your mouse over an object 11825 //This powers the little tooltip that appears when you move your mouse over an object
7227 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; 11826 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
@@ -7246,6 +11845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7246 } 11845 }
7247 11846
7248 break; 11847 break;
11848
7249 case PacketType.ObjectIncludeInSearch: 11849 case PacketType.ObjectIncludeInSearch:
7250 //This lets us set objects to appear in search (stuff like DataSnapshot, etc) 11850 //This lets us set objects to appear in search (stuff like DataSnapshot, etc)
7251 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; 11851 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack;
@@ -7341,9 +11941,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7341 } 11941 }
7342 break; 11942 break;
7343 11943
7344 #endregion 11944 //#endregion
7345 11945
7346 #region Inventory/Asset/Other related packets 11946 //#region Inventory/Asset/Other related packets
7347 11947
7348 case PacketType.RequestImage: 11948 case PacketType.RequestImage:
7349 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 11949 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
@@ -7477,12 +12077,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7477 12077
7478 MakeAssetRequest(transfer, taskID); 12078 MakeAssetRequest(transfer, taskID);
7479 12079
7480 /* RequestAsset = OnRequestAsset; 12080 // RequestAsset = OnRequestAsset;
7481 if (RequestAsset != null) 12081 // if (RequestAsset != null)
7482 { 12082 // {
7483 RequestAsset(this, transfer); 12083 // RequestAsset(this, transfer);
7484 }*/ 12084 // }
12085
7485 break; 12086 break;
12087
7486 case PacketType.AssetUploadRequest: 12088 case PacketType.AssetUploadRequest:
7487 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 12089 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
7488 12090
@@ -7501,6 +12103,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7501 request.AssetBlock.Tempfile); 12103 request.AssetBlock.Tempfile);
7502 } 12104 }
7503 break; 12105 break;
12106
7504 case PacketType.RequestXfer: 12107 case PacketType.RequestXfer:
7505 RequestXferPacket xferReq = (RequestXferPacket)Pack; 12108 RequestXferPacket xferReq = (RequestXferPacket)Pack;
7506 12109
@@ -7511,6 +12114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7511 handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); 12114 handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
7512 } 12115 }
7513 break; 12116 break;
12117
7514 case PacketType.SendXferPacket: 12118 case PacketType.SendXferPacket:
7515 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; 12119 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
7516 12120
@@ -7520,6 +12124,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7520 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); 12124 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
7521 } 12125 }
7522 break; 12126 break;
12127
7523 case PacketType.ConfirmXferPacket: 12128 case PacketType.ConfirmXferPacket:
7524 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; 12129 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack;
7525 12130
@@ -7529,6 +12134,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7529 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); 12134 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
7530 } 12135 }
7531 break; 12136 break;
12137
7532 case PacketType.AbortXfer: 12138 case PacketType.AbortXfer:
7533 AbortXferPacket abortXfer = (AbortXferPacket)Pack; 12139 AbortXferPacket abortXfer = (AbortXferPacket)Pack;
7534 AbortXfer handlerAbortXfer = OnAbortXfer; 12140 AbortXfer handlerAbortXfer = OnAbortXfer;
@@ -7538,6 +12144,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7538 } 12144 }
7539 12145
7540 break; 12146 break;
12147
7541 case PacketType.CreateInventoryFolder: 12148 case PacketType.CreateInventoryFolder:
7542 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 12149 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
7543 12150
@@ -7559,6 +12166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7559 invFolder.FolderData.ParentID); 12166 invFolder.FolderData.ParentID);
7560 } 12167 }
7561 break; 12168 break;
12169
7562 case PacketType.UpdateInventoryFolder: 12170 case PacketType.UpdateInventoryFolder:
7563 if (OnUpdateInventoryFolder != null) 12171 if (OnUpdateInventoryFolder != null)
7564 { 12172 {
@@ -7588,6 +12196,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7588 } 12196 }
7589 } 12197 }
7590 break; 12198 break;
12199
7591 case PacketType.MoveInventoryFolder: 12200 case PacketType.MoveInventoryFolder:
7592 if (OnMoveInventoryFolder != null) 12201 if (OnMoveInventoryFolder != null)
7593 { 12202 {
@@ -7615,6 +12224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7615 } 12224 }
7616 } 12225 }
7617 break; 12226 break;
12227
7618 case PacketType.CreateInventoryItem: 12228 case PacketType.CreateInventoryItem:
7619 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; 12229 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
7620 12230
@@ -7642,6 +12252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7642 Util.UnixTimeSinceEpoch()); 12252 Util.UnixTimeSinceEpoch());
7643 } 12253 }
7644 break; 12254 break;
12255
7645 case PacketType.FetchInventory: 12256 case PacketType.FetchInventory:
7646 if (OnFetchInventory != null) 12257 if (OnFetchInventory != null)
7647 { 12258 {
@@ -7670,6 +12281,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7670 } 12281 }
7671 } 12282 }
7672 break; 12283 break;
12284
7673 case PacketType.FetchInventoryDescendents: 12285 case PacketType.FetchInventoryDescendents:
7674 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 12286 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
7675 12287
@@ -7690,6 +12302,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7690 Fetch.InventoryData.SortOrder); 12302 Fetch.InventoryData.SortOrder);
7691 } 12303 }
7692 break; 12304 break;
12305
7693 case PacketType.PurgeInventoryDescendents: 12306 case PacketType.PurgeInventoryDescendents:
7694 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack; 12307 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack;
7695 12308
@@ -7708,6 +12321,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7708 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID); 12321 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
7709 } 12322 }
7710 break; 12323 break;
12324
7711 case PacketType.UpdateInventoryItem: 12325 case PacketType.UpdateInventoryItem:
7712 UpdateInventoryItemPacket inventoryItemUpdate = (UpdateInventoryItemPacket)Pack; 12326 UpdateInventoryItemPacket inventoryItemUpdate = (UpdateInventoryItemPacket)Pack;
7713 12327
@@ -7752,6 +12366,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7752 } 12366 }
7753 } 12367 }
7754 break; 12368 break;
12369
7755 case PacketType.CopyInventoryItem: 12370 case PacketType.CopyInventoryItem:
7756 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack; 12371 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack;
7757 12372
@@ -7779,6 +12394,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7779 } 12394 }
7780 } 12395 }
7781 break; 12396 break;
12397
7782 case PacketType.MoveInventoryItem: 12398 case PacketType.MoveInventoryItem:
7783 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack; 12399 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
7784 12400
@@ -7812,6 +12428,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7812 } 12428 }
7813 } 12429 }
7814 break; 12430 break;
12431
7815 case PacketType.RemoveInventoryItem: 12432 case PacketType.RemoveInventoryItem:
7816 RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack; 12433 RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack;
7817 12434
@@ -7840,6 +12457,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7840 12457
7841 } 12458 }
7842 break; 12459 break;
12460
7843 case PacketType.RemoveInventoryFolder: 12461 case PacketType.RemoveInventoryFolder:
7844 RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack; 12462 RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack;
7845 12463
@@ -7867,6 +12485,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7867 } 12485 }
7868 } 12486 }
7869 break; 12487 break;
12488
7870 case PacketType.RemoveInventoryObjects: 12489 case PacketType.RemoveInventoryObjects:
7871 RemoveInventoryObjectsPacket removeObject = (RemoveInventoryObjectsPacket)Pack; 12490 RemoveInventoryObjectsPacket removeObject = (RemoveInventoryObjectsPacket)Pack;
7872 #region Packet Session and User Check 12491 #region Packet Session and User Check
@@ -7907,6 +12526,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7907 } 12526 }
7908 } 12527 }
7909 break; 12528 break;
12529
7910 case PacketType.RequestTaskInventory: 12530 case PacketType.RequestTaskInventory:
7911 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 12531 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
7912 12532
@@ -7925,6 +12545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7925 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID); 12545 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID);
7926 } 12546 }
7927 break; 12547 break;
12548
7928 case PacketType.UpdateTaskInventory: 12549 case PacketType.UpdateTaskInventory:
7929 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 12550 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
7930 12551
@@ -8102,6 +12723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8102 handlerMapNameRequest(this, mapName); 12723 handlerMapNameRequest(this, mapName);
8103 } 12724 }
8104 break; 12725 break;
12726
8105 case PacketType.TeleportLandmarkRequest: 12727 case PacketType.TeleportLandmarkRequest:
8106 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 12728 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
8107 12729
@@ -8172,7 +12794,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8172 12794
8173 } 12795 }
8174 break; 12796 break;
8175 12797
8176 case PacketType.TeleportLocationRequest: 12798 case PacketType.TeleportLocationRequest:
8177 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 12799 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
8178 // m_log.Debug(tpLocReq.ToString()); 12800 // m_log.Debug(tpLocReq.ToString());
@@ -8202,7 +12824,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8202 } 12824 }
8203 break; 12825 break;
8204 12826
8205 #endregion 12827 //#endregion
8206 12828
8207 case PacketType.UUIDNameRequest: 12829 case PacketType.UUIDNameRequest:
8208 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; 12830 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
@@ -8217,7 +12839,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8217 } 12839 }
8218 break; 12840 break;
8219 12841
8220 #region Parcel related packets 12842 //#region Parcel related packets
12843
8221 12844
8222 case PacketType.RegionHandleRequest: 12845 case PacketType.RegionHandleRequest:
8223 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 12846 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
@@ -8300,6 +12923,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8300 updatePacket.Data.LocalID, entries, this); 12923 updatePacket.Data.LocalID, entries, this);
8301 } 12924 }
8302 break; 12925 break;
12926
8303 case PacketType.ParcelPropertiesRequest: 12927 case PacketType.ParcelPropertiesRequest:
8304 12928
8305 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; 12929 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
@@ -8324,6 +12948,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8324 propertiesRequest.ParcelData.SnapSelection, this); 12948 propertiesRequest.ParcelData.SnapSelection, this);
8325 } 12949 }
8326 break; 12950 break;
12951
8327 case PacketType.ParcelDivide: 12952 case PacketType.ParcelDivide:
8328 ParcelDividePacket landDivide = (ParcelDividePacket)Pack; 12953 ParcelDividePacket landDivide = (ParcelDividePacket)Pack;
8329 12954
@@ -8345,6 +12970,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8345 (int)Math.Round(landDivide.ParcelData.North), this); 12970 (int)Math.Round(landDivide.ParcelData.North), this);
8346 } 12971 }
8347 break; 12972 break;
12973
8348 case PacketType.ParcelJoin: 12974 case PacketType.ParcelJoin:
8349 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; 12975 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack;
8350 12976
@@ -8367,6 +12993,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8367 (int)Math.Round(landJoin.ParcelData.North), this); 12993 (int)Math.Round(landJoin.ParcelData.North), this);
8368 } 12994 }
8369 break; 12995 break;
12996
8370 case PacketType.ParcelPropertiesUpdate: 12997 case PacketType.ParcelPropertiesUpdate:
8371 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack; 12998 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack;
8372 12999
@@ -8405,6 +13032,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8405 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this); 13032 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this);
8406 } 13033 }
8407 break; 13034 break;
13035
8408 case PacketType.ParcelSelectObjects: 13036 case PacketType.ParcelSelectObjects:
8409 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; 13037 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
8410 13038
@@ -8433,6 +13061,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8433 Convert.ToInt32(selectPacket.ParcelData.ReturnType), returnIDs, this); 13061 Convert.ToInt32(selectPacket.ParcelData.ReturnType), returnIDs, this);
8434 } 13062 }
8435 break; 13063 break;
13064
8436 case PacketType.ParcelObjectOwnersRequest: 13065 case PacketType.ParcelObjectOwnersRequest:
8437 //m_log.Debug(Pack.ToString()); 13066 //m_log.Debug(Pack.ToString());
8438 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; 13067 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
@@ -8453,6 +13082,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8453 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 13082 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
8454 } 13083 }
8455 break; 13084 break;
13085
8456 case PacketType.ParcelGodForceOwner: 13086 case PacketType.ParcelGodForceOwner:
8457 ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack; 13087 ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack;
8458 13088
@@ -8471,6 +13101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8471 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this); 13101 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this);
8472 } 13102 }
8473 break; 13103 break;
13104
8474 case PacketType.ParcelRelease: 13105 case PacketType.ParcelRelease:
8475 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack; 13106 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack;
8476 13107
@@ -8489,6 +13120,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8489 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this); 13120 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
8490 } 13121 }
8491 break; 13122 break;
13123
8492 case PacketType.ParcelReclaim: 13124 case PacketType.ParcelReclaim:
8493 ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack; 13125 ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack;
8494 13126
@@ -8507,6 +13139,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8507 handlerParcelReclaim(reclaimPacket.Data.LocalID, this); 13139 handlerParcelReclaim(reclaimPacket.Data.LocalID, this);
8508 } 13140 }
8509 break; 13141 break;
13142
8510 case PacketType.ParcelReturnObjects: 13143 case PacketType.ParcelReturnObjects:
8511 13144
8512 13145
@@ -8598,9 +13231,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8598 } 13231 }
8599 break; 13232 break;
8600 13233
8601 #endregion 13234 //#endregion
8602 13235
8603 #region Estate Packets 13236 //#region Estate Packets
8604 13237
8605 case PacketType.EstateOwnerMessage: 13238 case PacketType.EstateOwnerMessage:
8606 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 13239 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
@@ -8918,6 +13551,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8918 handlerRegionInfoRequest(this); 13551 handlerRegionInfoRequest(this);
8919 } 13552 }
8920 break; 13553 break;
13554
8921 case PacketType.EstateCovenantRequest: 13555 case PacketType.EstateCovenantRequest:
8922 13556
8923 //EstateCovenantRequestPacket.AgentDataBlock epack = 13557 //EstateCovenantRequestPacket.AgentDataBlock epack =
@@ -8930,9 +13564,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8930 } 13564 }
8931 break; 13565 break;
8932 13566
8933 #endregion 13567 //#endregion
8934 13568
8935 #region GodPackets 13569 //#region GodPackets
8936 13570
8937 case PacketType.RequestGodlikePowers: 13571 case PacketType.RequestGodlikePowers:
8938 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; 13572 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
@@ -8949,6 +13583,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8949 } 13583 }
8950 13584
8951 break; 13585 break;
13586
8952 case PacketType.GodKickUser: 13587 case PacketType.GodKickUser:
8953 GodKickUserPacket gkupack = (GodKickUserPacket)Pack; 13588 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
8954 13589
@@ -8978,9 +13613,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8978 //OutPacket(kupack, ThrottleOutPacketType.Task); 13613 //OutPacket(kupack, ThrottleOutPacketType.Task);
8979 break; 13614 break;
8980 13615
8981 #endregion 13616 //#endregion
8982 13617
8983 #region Economy/Transaction Packets 13618 //#region Economy/Transaction Packets
8984 13619
8985 case PacketType.MoneyBalanceRequest: 13620 case PacketType.MoneyBalanceRequest:
8986 MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack; 13621 MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack;
@@ -9002,6 +13637,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9002 } 13637 }
9003 13638
9004 break; 13639 break;
13640
9005 case PacketType.EconomyDataRequest: 13641 case PacketType.EconomyDataRequest:
9006 13642
9007 13643
@@ -9011,6 +13647,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9011 handlerEconomoyDataRequest(AgentId); 13647 handlerEconomoyDataRequest(AgentId);
9012 } 13648 }
9013 break; 13649 break;
13650
9014 case PacketType.RequestPayPrice: 13651 case PacketType.RequestPayPrice:
9015 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; 13652 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack;
9016 13653
@@ -9080,9 +13717,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9080 } 13717 }
9081 break; 13718 break;
9082 13719
9083 #endregion 13720 //#endregion
9084 13721
9085 #region Script Packets 13722 //#region Script Packets
9086 13723
9087 case PacketType.GetScriptRunning: 13724 case PacketType.GetScriptRunning:
9088 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack; 13725 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack;
@@ -9132,9 +13769,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9132 } 13769 }
9133 break; 13770 break;
9134 13771
9135 #endregion 13772 //#endregion
9136 13773
9137 #region Gesture Managment 13774 //#region Gesture Managment
9138 13775
9139 case PacketType.ActivateGestures: 13776 case PacketType.ActivateGestures:
9140 ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack; 13777 ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack;
@@ -9201,7 +13838,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9201 } 13838 }
9202 break; 13839 break;
9203 13840
9204 #endregion 13841 //#endregion
9205 13842
9206 case PacketType.AgentFOV: 13843 case PacketType.AgentFOV:
9207 AgentFOVPacket fovPacket = (AgentFOVPacket)Pack; 13844 AgentFOVPacket fovPacket = (AgentFOVPacket)Pack;
@@ -9217,7 +13854,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9217 } 13854 }
9218 break; 13855 break;
9219 13856
9220 #region unimplemented handlers 13857 //#region unimplemented handlers
9221 13858
9222 case PacketType.ViewerStats: 13859 case PacketType.ViewerStats:
9223 // TODO: handle this packet 13860 // TODO: handle this packet
@@ -9251,6 +13888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9251 // TODO: handle this packet 13888 // TODO: handle this packet
9252 //m_log.Warn("[CLIENT]: unhandled TransferAbort packet"); 13889 //m_log.Warn("[CLIENT]: unhandled TransferAbort packet");
9253 break; 13890 break;
13891
9254 case PacketType.MuteListRequest: 13892 case PacketType.MuteListRequest:
9255 MuteListRequestPacket muteListRequest = 13893 MuteListRequestPacket muteListRequest =
9256 (MuteListRequestPacket)Pack; 13894 (MuteListRequestPacket)Pack;
@@ -9274,6 +13912,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9274 SendUseCachedMuteList(); 13912 SendUseCachedMuteList();
9275 } 13913 }
9276 break; 13914 break;
13915
9277 case PacketType.UseCircuitCode: 13916 case PacketType.UseCircuitCode:
9278 // Don't display this one, we handle it at a lower level 13917 // Don't display this one, we handle it at a lower level
9279 break; 13918 break;
@@ -9288,6 +13927,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9288 //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); 13927 //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
9289 13928
9290 break; 13929 break;
13930
9291 case PacketType.DirPlacesQuery: 13931 case PacketType.DirPlacesQuery:
9292 DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; 13932 DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack;
9293 //m_log.Debug(dirPlacesQueryPacket.ToString()); 13933 //m_log.Debug(dirPlacesQueryPacket.ToString());
@@ -9315,6 +13955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9315 dirPlacesQueryPacket.QueryData.QueryStart); 13955 dirPlacesQueryPacket.QueryData.QueryStart);
9316 } 13956 }
9317 break; 13957 break;
13958
9318 case PacketType.DirFindQuery: 13959 case PacketType.DirFindQuery:
9319 DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack; 13960 DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack;
9320 13961
@@ -9338,6 +13979,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9338 dirFindQueryPacket.QueryData.QueryStart); 13979 dirFindQueryPacket.QueryData.QueryStart);
9339 } 13980 }
9340 break; 13981 break;
13982
9341 case PacketType.DirLandQuery: 13983 case PacketType.DirLandQuery:
9342 DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack; 13984 DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack;
9343 13985
@@ -9362,6 +14004,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9362 dirLandQueryPacket.QueryData.QueryStart); 14004 dirLandQueryPacket.QueryData.QueryStart);
9363 } 14005 }
9364 break; 14006 break;
14007
9365 case PacketType.DirPopularQuery: 14008 case PacketType.DirPopularQuery:
9366 DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack; 14009 DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack;
9367 14010
@@ -9382,6 +14025,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9382 dirPopularQueryPacket.QueryData.QueryFlags); 14025 dirPopularQueryPacket.QueryData.QueryFlags);
9383 } 14026 }
9384 break; 14027 break;
14028
9385 case PacketType.DirClassifiedQuery: 14029 case PacketType.DirClassifiedQuery:
9386 DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack; 14030 DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack;
9387 14031
@@ -9406,6 +14050,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9406 dirClassifiedQueryPacket.QueryData.QueryStart); 14050 dirClassifiedQueryPacket.QueryData.QueryStart);
9407 } 14051 }
9408 break; 14052 break;
14053
9409 case PacketType.EventInfoRequest: 14054 case PacketType.EventInfoRequest:
9410 EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack; 14055 EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack;
9411 14056
@@ -9424,7 +14069,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9424 } 14069 }
9425 break; 14070 break;
9426 14071
9427 #region Calling Card 14072 //#region Calling Card
9428 14073
9429 case PacketType.OfferCallingCard: 14074 case PacketType.OfferCallingCard:
9430 OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack; 14075 OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack;
@@ -9486,9 +14131,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9486 declineCallingCardPacket.TransactionBlock.TransactionID); 14131 declineCallingCardPacket.TransactionBlock.TransactionID);
9487 } 14132 }
9488 break; 14133 break;
9489 #endregion 14134 //#endregion
9490 14135
9491 #region Groups 14136 //#region Groups
9492 case PacketType.ActivateGroup: 14137 case PacketType.ActivateGroup:
9493 ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack; 14138 ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack;
9494 14139
@@ -9508,6 +14153,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9508 } 14153 }
9509 break; 14154 break;
9510 14155
14156
9511 case PacketType.GroupTitlesRequest: 14157 case PacketType.GroupTitlesRequest:
9512 GroupTitlesRequestPacket groupTitlesRequest = 14158 GroupTitlesRequestPacket groupTitlesRequest =
9513 (GroupTitlesRequestPacket)Pack; 14159 (GroupTitlesRequestPacket)Pack;
@@ -9969,8 +14615,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9969 14615
9970 OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task); 14616 OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task);
9971 } 14617 }
9972 14618
9973 break; 14619 break;
14620
9974 case PacketType.GroupNoticeRequest: 14621 case PacketType.GroupNoticeRequest:
9975 GroupNoticeRequestPacket groupNoticeRequest = 14622 GroupNoticeRequestPacket groupNoticeRequest =
9976 (GroupNoticeRequestPacket)Pack; 14623 (GroupNoticeRequestPacket)Pack;
@@ -10141,7 +14788,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10141 } 14788 }
10142 break; 14789 break;
10143 14790
10144 #endregion 14791 //#endregion
14792
10145 case PacketType.StartLure: 14793 case PacketType.StartLure:
10146 StartLurePacket startLureRequest = (StartLurePacket)Pack; 14794 StartLurePacket startLureRequest = (StartLurePacket)Pack;
10147 14795
@@ -10373,6 +15021,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10373 if (handlerPickDelete != null) 15021 if (handlerPickDelete != null)
10374 handlerPickDelete(this, pickDelete.Data.PickID); 15022 handlerPickDelete(this, pickDelete.Data.PickID);
10375 break; 15023 break;
15024
10376 case PacketType.PickGodDelete: 15025 case PacketType.PickGodDelete:
10377 PickGodDeletePacket pickGodDelete = 15026 PickGodDeletePacket pickGodDelete =
10378 (PickGodDeletePacket)Pack; 15027 (PickGodDeletePacket)Pack;
@@ -10393,6 +15042,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10393 pickGodDelete.Data.PickID, 15042 pickGodDelete.Data.PickID,
10394 pickGodDelete.Data.QueryID); 15043 pickGodDelete.Data.QueryID);
10395 break; 15044 break;
15045
10396 case PacketType.PickInfoUpdate: 15046 case PacketType.PickInfoUpdate:
10397 PickInfoUpdatePacket pickInfoUpdate = 15047 PickInfoUpdatePacket pickInfoUpdate =
10398 (PickInfoUpdatePacket)Pack; 15048 (PickInfoUpdatePacket)Pack;
@@ -10418,6 +15068,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10418 pickInfoUpdate.Data.SortOrder, 15068 pickInfoUpdate.Data.SortOrder,
10419 pickInfoUpdate.Data.Enabled); 15069 pickInfoUpdate.Data.Enabled);
10420 break; 15070 break;
15071
10421 case PacketType.AvatarNotesUpdate: 15072 case PacketType.AvatarNotesUpdate:
10422 AvatarNotesUpdatePacket avatarNotesUpdate = 15073 AvatarNotesUpdatePacket avatarNotesUpdate =
10423 (AvatarNotesUpdatePacket)Pack; 15074 (AvatarNotesUpdatePacket)Pack;
@@ -10450,7 +15101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10450 break; 15101 break;
10451 } 15102 }
10452 #endregion 15103 #endregion
10453 15104
10454 AvatarInterestUpdate handlerAvatarInterestUpdate = OnAvatarInterestUpdate; 15105 AvatarInterestUpdate handlerAvatarInterestUpdate = OnAvatarInterestUpdate;
10455 if (handlerAvatarInterestUpdate != null) 15106 if (handlerAvatarInterestUpdate != null)
10456 handlerAvatarInterestUpdate(this, 15107 handlerAvatarInterestUpdate(this,
@@ -10497,11 +15148,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10497 placesQueryPacket.QueryData.SimName), 15148 placesQueryPacket.QueryData.SimName),
10498 this); 15149 this);
10499 break; 15150 break;
15151 */
15152 #endregion
10500 default: 15153 default:
10501 m_log.Warn("[CLIENT]: unhandled packet " + Pack); 15154 m_log.Warn("[CLIENT]: unhandled packet " + Pack);
10502 break; 15155 break;
10503
10504 #endregion
10505 } 15156 }
10506 15157
10507 PacketPool.Instance.ReturnPacket(Pack); 15158 PacketPool.Instance.ReturnPacket(Pack);
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index cd59bdb..e3e8718 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
49 private int m_shoutdistance = 100; 49 private int m_shoutdistance = 100;
50 private int m_whisperdistance = 10; 50 private int m_whisperdistance = 10;
51 private List<Scene> m_scenes = new List<Scene>(); 51 private List<Scene> m_scenes = new List<Scene>();
52 52 private string m_adminPrefix = "";
53 internal object m_syncy = new object(); 53 internal object m_syncy = new object();
54 54
55 internal IConfig m_config; 55 internal IConfig m_config;
@@ -57,25 +57,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
57 #region ISharedRegionModule Members 57 #region ISharedRegionModule Members
58 public virtual void Initialise(IConfigSource config) 58 public virtual void Initialise(IConfigSource config)
59 { 59 {
60
61 m_config = config.Configs["Chat"]; 60 m_config = config.Configs["Chat"];
62 61
63 if (null == m_config) 62 if (null == m_config)
64 { 63 {
65 m_log.Info("[CHAT]: no config found, plugin disabled"); 64 m_log.Info("[CHAT]: no config found, plugin disabled");
65 m_enabled = false;
66 return; 66 return;
67 } 67 }
68 68
69 if (!m_config.GetBoolean("enabled", false)) 69 if (!m_config.GetBoolean("enabled", true))
70 { 70 {
71 m_log.Info("[CHAT]: plugin disabled by configuration"); 71 m_log.Info("[CHAT]: plugin disabled by configuration");
72 m_enabled = false;
72 return; 73 return;
73 } 74 }
74 m_enabled = true;
75 75
76 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); 76 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
77 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); 77 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
78 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); 78 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
79 m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", "");
79 } 80 }
80 81
81 public virtual void AddRegion(Scene scene) 82 public virtual void AddRegion(Scene scene)
@@ -185,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
185 protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) 186 protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
186 { 187 {
187 string fromName = c.From; 188 string fromName = c.From;
189 string fromNamePrefix = "";
188 UUID fromID = UUID.Zero; 190 UUID fromID = UUID.Zero;
189 string message = c.Message; 191 string message = c.Message;
190 IScene scene = c.Scene; 192 IScene scene = c.Scene;
@@ -207,7 +209,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
207 fromPos = avatar.AbsolutePosition; 209 fromPos = avatar.AbsolutePosition;
208 fromName = avatar.Name; 210 fromName = avatar.Name;
209 fromID = c.Sender.AgentId; 211 fromID = c.Sender.AgentId;
210 212 if (avatar.GodLevel > 200)
213 {
214 fromNamePrefix = m_adminPrefix;
215 }
211 break; 216 break;
212 217
213 case ChatSourceType.Object: 218 case ChatSourceType.Object:
@@ -227,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
227 s.ForEachScenePresence( 232 s.ForEachScenePresence(
228 delegate(ScenePresence presence) 233 delegate(ScenePresence presence)
229 { 234 {
230 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); 235 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType);
231 } 236 }
232 ); 237 );
233 } 238 }
@@ -266,25 +271,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
266 } 271 }
267 272
268 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 273 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
269 274 if (c.Scene != null)
270 ((Scene)c.Scene).ForEachScenePresence( 275 {
271 delegate(ScenePresence presence) 276 ((Scene)c.Scene).ForEachScenePresence
272 { 277 (
273 // ignore chat from child agents 278 delegate(ScenePresence presence)
274 if (presence.IsChildAgent) return; 279 {
275 280 // ignore chat from child agents
276 IClientAPI client = presence.ControllingClient; 281 if (presence.IsChildAgent) return;
277 282
278 // don't forward SayOwner chat from objects to 283 IClientAPI client = presence.ControllingClient;
279 // non-owner agents 284
280 if ((c.Type == ChatTypeEnum.Owner) && 285 // don't forward SayOwner chat from objects to
281 (null != c.SenderObject) && 286 // non-owner agents
282 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 287 if ((c.Type == ChatTypeEnum.Owner) &&
283 return; 288 (null != c.SenderObject) &&
284 289 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
285 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 290 return;
286 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 291
287 }); 292 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
293 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
294 }
295 );
296 }
288 } 297 }
289 298
290 299
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 9e76d79..b778389 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -121,45 +121,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
121 121
122 byte[] data; 122 byte[] data;
123 TarArchiveReader.TarEntryType entryType; 123 TarArchiveReader.TarEntryType entryType;
124 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
125 {
126 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
127 {
128 if (LoadAsset(filePath, data))
129 successfulAssetRestores++;
130 else
131 failedAssetRestores++;
132 124
133 if ((successfulAssetRestores) % 50 == 0) 125 try
134 m_log.DebugFormat( 126 {
135 "[INVENTORY ARCHIVER]: Loaded {0} assets...", 127 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
136 successfulAssetRestores);
137 }
138 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
139 { 128 {
140 InventoryFolderBase foundFolder 129 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
141 = ReplicateArchivePathToUserInventory(
142 filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
143 rootDestinationFolder, foldersCreated, nodesLoaded);
144
145 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
146 { 130 {
147 InventoryItemBase item = LoadItem(data, foundFolder); 131 if (LoadAsset(filePath, data))
148 132 successfulAssetRestores++;
149 if (item != null) 133 else
134 failedAssetRestores++;
135
136 if ((successfulAssetRestores) % 50 == 0)
137 m_log.DebugFormat(
138 "[INVENTORY ARCHIVER]: Loaded {0} assets...",
139 successfulAssetRestores);
140 }
141 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
142 {
143 InventoryFolderBase foundFolder
144 = ReplicateArchivePathToUserInventory(
145 filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
146 rootDestinationFolder, foldersCreated, nodesLoaded);
147
148 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
150 { 149 {
151 successfulItemRestores++; 150 InventoryItemBase item = LoadItem(data, foundFolder);
152 151
153 // If we're loading an item directly into the given destination folder then we need to record 152 if (item != null)
154 // it separately from any loaded root folders 153 {
155 if (rootDestinationFolder == foundFolder) 154 successfulItemRestores++;
156 nodesLoaded.Add(item); 155
156 // If we're loading an item directly into the given destination folder then we need to record
157 // it separately from any loaded root folders
158 if (rootDestinationFolder == foundFolder)
159 nodesLoaded.Add(item);
160 }
157 } 161 }
158 } 162 }
159 } 163 }
160 } 164 }
161 165 finally
162 archive.Close(); 166 {
167 archive.Close();
168 }
163 169
164 m_log.DebugFormat( 170 m_log.DebugFormat(
165 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", 171 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
@@ -342,9 +348,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
342 348
343 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); 349 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
344 if (UUID.Zero != ospResolvedId) 350 if (UUID.Zero != ospResolvedId)
351 {
345 item.CreatorIdAsUuid = ospResolvedId; 352 item.CreatorIdAsUuid = ospResolvedId;
353
354 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
355 // database). Instead, replace with the UUID that we found.
356 item.CreatorId = ospResolvedId.ToString();
357 }
346 else 358 else
359 {
347 item.CreatorIdAsUuid = m_userInfo.UserProfile.ID; 360 item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
361 }
348 362
349 item.Owner = m_userInfo.UserProfile.ID; 363 item.Owner = m_userInfo.UserProfile.ID;
350 364
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 6e11f36..c85d974 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -117,19 +117,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
117 } 117 }
118 118
119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
120 { 120 {
121 // We're almost done. Just need to write out the control file now
122 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
123 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
124
125 Exception reportedException = null; 121 Exception reportedException = null;
126 bool succeeded = true; 122 bool succeeded = true;
127 123
128 try 124 try
129 { 125 {
126 // We're almost done. Just need to write out the control file now
127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
129
130 m_archiveWriter.Close(); 130 m_archiveWriter.Close();
131 } 131 }
132 catch (IOException e) 132 catch (Exception e)
133 { 133 {
134 m_saveStream.Close(); 134 m_saveStream.Close();
135 reportedException = e; 135 reportedException = e;
@@ -261,39 +261,47 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
261 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); 261 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
262 } 262 }
263 263
264 m_archiveWriter = new TarArchiveWriter(m_saveStream); 264 if (null == inventoryFolder && null == inventoryItem)
265
266 if (inventoryFolder != null)
267 {
268 m_log.DebugFormat(
269 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
270 inventoryFolder.Name, inventoryFolder.ID, m_invPath);
271
272 //recurse through all dirs getting dirs and files
273 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar);
274 }
275 else if (inventoryItem != null)
276 {
277 m_log.DebugFormat(
278 "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
279 inventoryItem.Name, inventoryItem.ID, m_invPath);
280
281 SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH);
282 }
283 else
284 { 265 {
285 // We couldn't find the path indicated 266 // We couldn't find the path indicated
286 m_saveStream.Close();
287 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 267 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
288 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); 268 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage);
289 m_module.TriggerInventoryArchiveSaved( 269 m_module.TriggerInventoryArchiveSaved(
290 m_id, false, m_userInfo, m_invPath, m_saveStream, 270 m_id, false, m_userInfo, m_invPath, m_saveStream,
291 new Exception(errorMessage)); 271 new Exception(errorMessage));
292 return; 272 return;
293 } 273 }
274
275 m_archiveWriter = new TarArchiveWriter(m_saveStream);
294 276
295 // Don't put all this profile information into the archive right now. 277 try
296 //SaveUsers(); 278 {
279 if (inventoryFolder != null)
280 {
281 m_log.DebugFormat(
282 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
283 inventoryFolder.Name, inventoryFolder.ID, m_invPath);
284
285 //recurse through all dirs getting dirs and files
286 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar);
287 }
288 else if (inventoryItem != null)
289 {
290 m_log.DebugFormat(
291 "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
292 inventoryItem.Name, inventoryItem.ID, m_invPath);
293
294 SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH);
295 }
296
297 // Don't put all this profile information into the archive right now.
298 //SaveUsers();
299 }
300 catch (Exception)
301 {
302 m_archiveWriter.Close();
303 throw;
304 }
297 305
298 new AssetsRequest( 306 new AssetsRequest(
299 new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, 307 new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 1228eb1..ecd60bd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -92,12 +92,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
92 scene.AddCommand( 92 scene.AddCommand(
93 this, "load iar", 93 this, "load iar",
94 "load iar <first> <last> <inventory path> <password> [<archive path>]", 94 "load iar <first> <last> <inventory path> <password> [<archive path>]",
95 "Load user inventory archive. EXPERIMENTAL", HandleLoadInvConsoleCommand); 95 "Load user inventory archive.", HandleLoadInvConsoleCommand);
96 96
97 scene.AddCommand( 97 scene.AddCommand(
98 this, "save iar", 98 this, "save iar",
99 "save iar <first> <last> <inventory path> <password> [<archive path>]", 99 "save iar <first> <last> <inventory path> <password> [<archive path>]",
100 "Save user inventory archive. EXPERIMENTAL", HandleSaveInvConsoleCommand); 100 "Save user inventory archive.", HandleSaveInvConsoleCommand);
101 101
102 m_aScene = scene; 102 m_aScene = scene;
103 } 103 }
@@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
280 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); 280 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
281 281
282 m_log.InfoFormat( 282 m_log.InfoFormat(
283 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", 283 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
284 savePath, invPath, firstName, lastName); 284 savePath, invPath, firstName, lastName);
285 285
286 Guid id = Guid.NewGuid(); 286 Guid id = Guid.NewGuid();
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 7927352..e4dad18 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -259,9 +259,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
259 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name); 259 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name);
260 260
261 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 261 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
262
263// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
264// UUID, not the OSPA itself.
265// Assert.That(
266// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
267// "Loaded item non-uuid creator doesn't match original");
262 Assert.That( 268 Assert.That(
263 foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), 269 foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()),
264 "Loaded item non-uuid creator doesn't match original"); 270 "Loaded item non-uuid creator doesn't match original");
271
265 Assert.That( 272 Assert.That(
266 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), 273 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
267 "Loaded item uuid creator doesn't match original"); 274 "Loaded item uuid creator doesn't match original");
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index d9a021f..b60b32b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -389,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
389 { 389 {
390 // Check if this is ours to handle 390 // Check if this is ours to handle
391 // 391 //
392 m_log.Info("OnFridInstantMessage"); 392 //m_log.Info("OnFridInstantMessage");
393 if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered) 393 if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered)
394 return; 394 return;
395 395
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
index ee809bd..d9f6e33 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
@@ -263,8 +263,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
263 { 263 {
264 // We need to make a local copy of the object 264 // We need to make a local copy of the object
265 ISceneObject sogClone = sog.CloneForNewScene(); 265 ISceneObject sogClone = sog.CloneForNewScene();
266 sogClone.SetState(sog.GetStateSnapshot(), 266 sogClone.SetState(sog.GetStateSnapshot(), s);
267 s.RegionInfo.RegionID);
268 return s.IncomingCreateObject(sogClone); 267 return s.IncomingCreateObject(sogClone);
269 } 268 }
270 else 269 else
@@ -294,15 +293,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
294 293
295 #region Misc 294 #region Misc
296 295
297 public UUID GetRegionID(ulong regionhandle) 296 public Scene GetScene(ulong regionhandle)
298 { 297 {
299 foreach (Scene s in m_sceneList) 298 foreach (Scene s in m_sceneList)
300 { 299 {
301 if (s.RegionInfo.RegionHandle == regionhandle) 300 if (s.RegionInfo.RegionHandle == regionhandle)
302 return s.RegionInfo.RegionID; 301 return s;
303 } 302 }
304 // ? weird. should not happen 303 // ? weird. should not happen
305 return m_sceneList[0].RegionInfo.RegionID; 304 return m_sceneList[0];
306 } 305 }
307 306
308 public bool IsLocalRegion(ulong regionhandle) 307 public bool IsLocalRegion(ulong regionhandle)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 696225c..710e3ca 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
641 if (args["extra"] != null) 641 if (args["extra"] != null)
642 extraStr = args["extra"].AsString(); 642 extraStr = args["extra"].AsString();
643 643
644 UUID regionID = m_localBackend.GetRegionID(regionhandle); 644 IScene s = m_localBackend.GetScene(regionhandle);
645 SceneObjectGroup sog = null; 645 SceneObjectGroup sog = null;
646 try 646 try
647 { 647 {
@@ -663,7 +663,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
663 { 663 {
664 try 664 try
665 { 665 {
666 sog.SetState(stateXmlStr, regionID); 666 sog.SetState(stateXmlStr, s);
667 } 667 }
668 catch (Exception ex) 668 catch (Exception ex)
669 { 669 {
@@ -695,8 +695,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
695 if (args["itemid"] != null) 695 if (args["itemid"] != null)
696 itemID = args["itemid"].AsUUID(); 696 itemID = args["itemid"].AsUUID();
697 697
698 //UUID regionID = m_localBackend.GetRegionID(regionhandle);
699
700 // This is the meaning of PUT object 698 // This is the meaning of PUT object
701 bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID); 699 bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);
702 700
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 70a225e..114dd13 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -103,14 +103,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
103 List<string> serialisedSceneObjects = new List<string>(); 103 List<string> serialisedSceneObjects = new List<string>();
104 List<string> serialisedParcels = new List<string>(); 104 List<string> serialisedParcels = new List<string>();
105 string filePath = "NONE"; 105 string filePath = "NONE";
106
107 TarArchiveReader archive = new TarArchiveReader(m_loadStream);
108 byte[] data;
109 TarArchiveReader.TarEntryType entryType;
106 110
107 try 111 try
108 { 112 {
109 TarArchiveReader archive = new TarArchiveReader(m_loadStream);
110
111 byte[] data;
112 TarArchiveReader.TarEntryType entryType;
113
114 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 113 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
115 { 114 {
116 //m_log.DebugFormat( 115 //m_log.DebugFormat(
@@ -152,8 +151,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
152 } 151 }
153 152
154 //m_log.Debug("[ARCHIVER]: Reached end of archive"); 153 //m_log.Debug("[ARCHIVER]: Reached end of archive");
155
156 archive.Close();
157 } 154 }
158 catch (Exception e) 155 catch (Exception e)
159 { 156 {
@@ -163,6 +160,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
163 m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); 160 m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
164 return; 161 return;
165 } 162 }
163 finally
164 {
165 archive.Close();
166 }
166 167
167 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); 168 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
168 169
@@ -246,21 +247,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
246 // Fix ownership/creator of inventory items 247 // Fix ownership/creator of inventory items
247 // Not doing so results in inventory items 248 // Not doing so results in inventory items
248 // being no copy/no mod for everyone 249 // being no copy/no mod for everyone
249 lock (part.TaskInventory) 250 part.TaskInventory.LockItemsForRead(true);
251 TaskInventoryDictionary inv = part.TaskInventory;
252 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
250 { 253 {
251 TaskInventoryDictionary inv = part.TaskInventory; 254 if (!ResolveUserUuid(kvp.Value.OwnerID))
252 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 255 {
256 kvp.Value.OwnerID = masterAvatarId;
257 }
258 if (!ResolveUserUuid(kvp.Value.CreatorID))
253 { 259 {
254 if (!ResolveUserUuid(kvp.Value.OwnerID)) 260 kvp.Value.CreatorID = masterAvatarId;
255 {
256 kvp.Value.OwnerID = masterAvatarId;
257 }
258 if (!ResolveUserUuid(kvp.Value.CreatorID))
259 {
260 kvp.Value.CreatorID = masterAvatarId;
261 }
262 } 261 }
263 } 262 }
263 part.TaskInventory.LockItemsForRead(false);
264 } 264 }
265 265
266 if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) 266 if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index f039be8..75c4557 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -80,6 +80,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
80 protected internal void ReceivedAllAssets( 80 protected internal void ReceivedAllAssets(
81 ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 81 ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
82 { 82 {
83 try
84 {
85 Save(assetsFoundUuids, assetsNotFoundUuids);
86 }
87 finally
88 {
89 m_archiveWriter.Close();
90 }
91
92 m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName);
93
94 m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
95 }
96
97 protected internal void Save(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
98 {
83 foreach (UUID uuid in assetsNotFoundUuids) 99 foreach (UUID uuid in assetsNotFoundUuids)
84 { 100 {
85 m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); 101 m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
@@ -143,12 +159,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
143 } 159 }
144 160
145 m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); 161 m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
146
147 m_archiveWriter.Close();
148
149 m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName);
150
151 m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
152 } 162 }
153 163
154 /// <summary> 164 /// <summary>
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 9e4fbbe..71bfe57 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -56,6 +56,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
56 /// <summary> 56 /// <summary>
57 /// Constructor 57 /// Constructor
58 /// </summary> 58 /// </summary>
59 /// <param name="scene"></param>
60 /// <param name="savePath">The path to which to save data.</param>
61 /// <param name="requestId">The id associated with this request</param>
62 /// <exception cref="System.IO.IOException">
63 /// If there was a problem opening a stream for the file specified by the savePath
64 /// </exception>
59 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) 65 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId)
60 { 66 {
61 m_scene = scene; 67 m_scene = scene;
@@ -87,6 +93,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
87 List<EntityBase> entities = m_scene.GetEntities(); 93 List<EntityBase> entities = m_scene.GetEntities();
88 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 94 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
89 95
96 /*
97 foreach (ILandObject lo in m_scene.LandChannel.AllParcels())
98 {
99 if (name == lo.LandData.Name)
100 {
101 // This is the parcel we want
102 }
103 }
104 */
105
90 // Filter entities so that we only have scene objects. 106 // Filter entities so that we only have scene objects.
91 // FIXME: Would be nicer to have this as a proper list in SceneGraph, since lots of methods 107 // FIXME: Would be nicer to have this as a proper list in SceneGraph, since lots of methods
92 // end up having to do this 108 // end up having to do this
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 8d4f91b..27763bb 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -26,9 +26,11 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
33using NDesk.Options;
32using Nini.Config; 34using Nini.Config;
33using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
@@ -45,6 +47,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
45 47
46 private Scene m_scene; 48 private Scene m_scene;
47 49
50 /// <value>
51 /// The file used to load and save an opensimulator archive if no filename has been specified
52 /// </value>
53 protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar";
54
48 public string Name 55 public string Name
49 { 56 {
50 get { return "RegionArchiverModule"; } 57 get { return "RegionArchiverModule"; }
@@ -80,6 +87,48 @@ namespace OpenSim.Region.CoreModules.World.Archiver
80 { 87 {
81 } 88 }
82 89
90 /// <summary>
91 /// Load a whole region from an opensimulator archive.
92 /// </summary>
93 /// <param name="cmdparams"></param>
94 public void HandleLoadOarConsoleCommand(string module, string[] cmdparams)
95 {
96 bool mergeOar = false;
97
98 OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; });
99 List<string> mainParams = options.Parse(cmdparams);
100
101// m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar);
102//
103// foreach (string param in mainParams)
104// m_log.DebugFormat("GOT PARAM [{0}]", param);
105
106 if (mainParams.Count > 2)
107 {
108 DearchiveRegion(mainParams[2], mergeOar, Guid.Empty);
109 }
110 else
111 {
112 DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, Guid.Empty);
113 }
114 }
115
116 /// <summary>
117 /// Save a region to a file, including all the assets needed to restore it.
118 /// </summary>
119 /// <param name="cmdparams"></param>
120 public void HandleSaveOarConsoleCommand(string module, string[] cmdparams)
121 {
122 if (cmdparams.Length > 2)
123 {
124 ArchiveRegion(cmdparams[2]);
125 }
126 else
127 {
128 ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME);
129 }
130 }
131
83 public void ArchiveRegion(string savePath) 132 public void ArchiveRegion(string savePath)
84 { 133 {
85 ArchiveRegion(savePath, Guid.Empty); 134 ArchiveRegion(savePath, Guid.Empty);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 4ed23bb..81024db 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.Land
105 ILandObject obj = new LandObject(UUID.Zero, false, m_scene); 105 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
106 obj.LandData.Name = "NO LAND"; 106 obj.LandData.Name = "NO LAND";
107 return obj; 107 return obj;
108 } 108 }
109 109
110 public List<ILandObject> AllParcels() 110 public List<ILandObject> AllParcels()
111 { 111 {
@@ -154,6 +154,7 @@ namespace OpenSim.Region.CoreModules.World.Land
154 m_landManagementModule.UpdateLandObject(localID, data); 154 m_landManagementModule.UpdateLandObject(localID, data);
155 } 155 }
156 } 156 }
157
157 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 158 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
158 { 159 {
159 if (m_landManagementModule != null) 160 if (m_landManagementModule != null)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 968f46a..9a2ef50 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -67,7 +67,14 @@ namespace OpenSim.Region.CoreModules.World.Land
67 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; 67 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
68 #pragma warning restore 0429 68 #pragma warning restore 0429
69 69
70 /// <value>
71 /// Local land ids at specified region co-ordinates (region size / 4)
72 /// </value>
70 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; 73 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
74
75 /// <value>
76 /// Land objects keyed by local id
77 /// </value>
71 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 78 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
72 79
73 private bool m_landPrimCountTainted; 80 private bool m_landPrimCountTainted;
@@ -570,6 +577,7 @@ namespace OpenSim.Region.CoreModules.World.Land
570 577
571 if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) 578 if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0)
572 return null; 579 return null;
580
573 try 581 try
574 { 582 {
575 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); 583 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
@@ -584,6 +592,7 @@ namespace OpenSim.Region.CoreModules.World.Land
584 { 592 {
585 return null; 593 return null;
586 } 594 }
595
587 lock (m_landList) 596 lock (m_landList)
588 { 597 {
589 // Corner case. If an autoreturn happens during sim startup 598 // Corner case. If an autoreturn happens during sim startup
@@ -603,6 +612,7 @@ namespace OpenSim.Region.CoreModules.World.Land
603 // they happen every time at border crossings 612 // they happen every time at border crossings
604 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 613 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
605 } 614 }
615
606 lock (m_landIDList) 616 lock (m_landIDList)
607 { 617 {
608 try 618 try
@@ -617,7 +627,7 @@ namespace OpenSim.Region.CoreModules.World.Land
617 return null; 627 return null;
618 } 628 }
619 } 629 }
620 } 630 }
621 631
622 #endregion 632 #endregion
623 633
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 2c906a2..89a45da 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -185,19 +185,11 @@ namespace OpenSim.Region.Framework.Interfaces
185 List<UUID> GetInventoryList(); 185 List<UUID> GetInventoryList();
186 186
187 /// <summary> 187 /// <summary>
188 /// Get the names of the assemblies associated with scripts in this inventory.
189 /// </summary>
190 /// <returns></returns>
191 string[] GetScriptAssemblies();
192
193 /// <summary>
194 /// Get the xml representing the saved states of scripts in this inventory. 188 /// Get the xml representing the saved states of scripts in this inventory.
195 /// </summary> 189 /// </summary>
196 /// <returns> 190 /// <returns>
197 /// A <see cref="Dictionary`2"/> 191 /// A <see cref="Dictionary`2"/>
198 /// </returns> 192 /// </returns>
199 Dictionary<UUID, string> GetScriptStates(); 193 Dictionary<UUID, string> GetScriptStates();
200
201 bool CanBeDeleted();
202 } 194 }
203} 195}
diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs
index 74f404f..6fe6118 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs
@@ -33,26 +33,41 @@ namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public interface ILandChannel 34 public interface ILandChannel
35 { 35 {
36 List<ILandObject> ParcelsNearPoint(Vector3 position); 36 /// <summary>
37 /// Get all parcels
38 /// </summary>
39 /// <returns></returns>
37 List<ILandObject> AllParcels(); 40 List<ILandObject> AllParcels();
38 41
39 /// <summary> 42 /// <summary>
40 /// Get the land object at the specified point 43 /// Get the parcel at the specified point
41 /// </summary> 44 /// </summary>
42 /// <param name="x">Value between 0 - 256 on the x axis of the point</param> 45 /// <param name="x">Value between 0 - 256 on the x axis of the point</param>
43 /// <param name="y">Value between 0 - 256 on the y axis of the point</param> 46 /// <param name="y">Value between 0 - 256 on the y axis of the point</param>
44 /// <returns>Land object at the point supplied</returns> 47 /// <returns>Land object at the point supplied</returns>
45 ILandObject GetLandObject(int x, int y); 48 ILandObject GetLandObject(int x, int y);
46 49
47 ILandObject GetLandObject(int localID);
48
49 /// <summary> 50 /// <summary>
50 /// Get the land object at the specified point 51 /// Get the parcel at the specified point
51 /// </summary> 52 /// </summary>
52 /// <param name="x">Value between 0 - 256 on the x axis of the point</param> 53 /// <param name="x">Value between 0 - 256 on the x axis of the point</param>
53 /// <param name="y">Value between 0 - 256 on the y axis of the point</param> 54 /// <param name="y">Value between 0 - 256 on the y axis of the point</param>
54 /// <returns>Land object at the point supplied</returns> 55 /// <returns>Land object at the point supplied</returns>
55 ILandObject GetLandObject(float x, float y); 56 ILandObject GetLandObject(float x, float y);
57
58 /// <summary>
59 /// Get the parcels near the specified point
60 /// </summary>
61 /// <param name="position"></param>
62 /// <returns></returns>
63 List<ILandObject> ParcelsNearPoint(Vector3 position);
64
65 /// <summary>
66 /// Get the parcel given the land's local id.
67 /// </summary>
68 /// <param name="localID"></param>
69 /// <returns></returns>
70 ILandObject GetLandObject(int localID);
56 71
57 bool IsLandPrimCountTainted(); 72 bool IsLandPrimCountTainted();
58 bool IsForcefulBansAllowed(); 73 bool IsForcefulBansAllowed();
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
index 9ad2036..1a8babc 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
@@ -34,7 +34,10 @@ namespace OpenSim.Region.Framework.Interfaces
34 /// Interface to region archive functionality 34 /// Interface to region archive functionality
35 /// </summary> 35 /// </summary>
36 public interface IRegionArchiverModule 36 public interface IRegionArchiverModule
37 { 37 {
38 void HandleLoadOarConsoleCommand(string module, string[] cmdparams);
39 void HandleSaveOarConsoleCommand(string module, string[] cmdparams);
40
38 /// <summary> 41 /// <summary>
39 /// Archive the region to the given path 42 /// Archive the region to the given path
40 /// </summary> 43 /// </summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 10835b9..f11e571 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -34,9 +34,8 @@ namespace OpenSim.Region.Framework.Interfaces
34 { 34 {
35 string ScriptEngineName { get; } 35 string ScriptEngineName { get; }
36 36
37 string GetAssemblyName(UUID itemID);
38 string GetXMLState(UUID itemID); 37 string GetXMLState(UUID itemID);
39 bool CanBeDeleted(UUID itemID); 38 void SetXMLState(UUID itemID, string xml);
40 39
41 bool PostScriptEvent(UUID itemID, string name, Object[] args); 40 bool PostScriptEvent(UUID itemID, string name, Object[] args);
42 bool PostObjectEvent(UUID itemID, string name, Object[] args); 41 bool PostObjectEvent(UUID itemID, string name, Object[] args);
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 2d41342..b031f61 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -163,8 +163,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
163 // Check control flags 163 // Check control flags
164 bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS); 164 bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS);
165 bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); 165 bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG);
166 bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS; 166 bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS);
167 bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG; 167 bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG);
168 //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; 168 //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT;
169 //bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; 169 //bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT;
170 bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS; 170 bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
@@ -252,8 +252,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
252 else if (m_movementAnimation == "LAND") 252 else if (m_movementAnimation == "LAND")
253 { 253 {
254 float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f; 254 float landElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
255 255 if ((m_animTickFall != 0) && (landElapsed <= FALL_DELAY))
256 if (landElapsed <= FALL_DELAY)
257 return "LAND"; 256 return "LAND";
258 } 257 }
259 258
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5b571c7..9a7863b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
131 if (left > 0) 131 if (left > 0)
132 { 132 {
133 x = m_inventoryDeletes.Dequeue(); 133 x = m_inventoryDeletes.Dequeue();
134 if (!x.objectGroup.CanBeDeleted())
135 {
136 m_inventoryDeletes.Enqueue(x);
137 return true;
138 }
139 134
140 m_log.DebugFormat( 135 m_log.DebugFormat(
141 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 136 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 66fb918..83208e9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -840,8 +840,12 @@ namespace OpenSim.Region.Framework.Scenes
840 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) 840 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
841 { 841 {
842 SceneObjectPart part = GetSceneObjectPart(localID); 842 SceneObjectPart part = GetSceneObjectPart(localID);
843 SceneObjectGroup group = part.ParentGroup; 843 SceneObjectGroup group = null;
844 if (group != null) 844 if (part != null)
845 {
846 group = part.ParentGroup;
847 }
848 if (part != null && group != null)
845 { 849 {
846 TaskInventoryItem item = group.GetInventoryItem(localID, itemID); 850 TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
847 if (item == null) 851 if (item == null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4ffa1a2..3034f9a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -387,6 +387,11 @@ namespace OpenSim.Region.Framework.Scenes
387 { 387 {
388 get { return StatsReporter.getLastReportedSimFPS(); } 388 get { return StatsReporter.getLastReportedSimFPS(); }
389 } 389 }
390
391 public float[] SimulatorStats
392 {
393 get { return StatsReporter.getLastReportedSimStats(); }
394 }
390 395
391 public string DefaultScriptEngine 396 public string DefaultScriptEngine
392 { 397 {
@@ -618,7 +623,7 @@ namespace OpenSim.Region.Framework.Scenes
618 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); 623 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
619 m_persistAfter *= 10000000; 624 m_persistAfter *= 10000000;
620 625
621 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); 626 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
622 627
623 IConfig packetConfig = m_config.Configs["PacketPool"]; 628 IConfig packetConfig = m_config.Configs["PacketPool"];
624 if (packetConfig != null) 629 if (packetConfig != null)
@@ -873,6 +878,15 @@ namespace OpenSim.Region.Framework.Scenes
873 /// <param name="seconds">float indicating duration before restart.</param> 878 /// <param name="seconds">float indicating duration before restart.</param>
874 public virtual void Restart(float seconds) 879 public virtual void Restart(float seconds)
875 { 880 {
881 Restart(seconds, true);
882 }
883
884 /// <summary>
885 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
886 /// </summary>
887 /// <param name="seconds">float indicating duration before restart.</param>
888 public virtual void Restart(float seconds, bool showDialog)
889 {
876 // notifications are done in 15 second increments 890 // notifications are done in 15 second increments
877 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request 891 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
878 // It's a 'Cancel restart' request. 892 // It's a 'Cancel restart' request.
@@ -893,8 +907,11 @@ namespace OpenSim.Region.Framework.Scenes
893 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 907 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
894 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); 908 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
895 m_restartTimer.Start(); 909 m_restartTimer.Start();
896 m_dialogModule.SendNotificationToUsersInRegion( 910 if (showDialog)
897 UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); 911 {
912 m_dialogModule.SendNotificationToUsersInRegion(
913 UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + (seconds / 60).ToString() + " Minutes");
914 }
898 } 915 }
899 } 916 }
900 917
@@ -2381,103 +2398,6 @@ namespace OpenSim.Region.Framework.Scenes
2381 return successYN; 2398 return successYN;
2382 } 2399 }
2383 2400
2384 /// <summary>
2385 /// Handle a scene object that is crossing into this region from another.
2386 /// NOTE: Unused as of 2009-02-09. Soon to be deleted.
2387 /// </summary>
2388 /// <param name="regionHandle"></param>
2389 /// <param name="primID"></param>
2390 /// <param name="objXMLData"></param>
2391 /// <param name="XMLMethod"></param>
2392 /// <returns></returns>
2393 public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
2394 {
2395 if (XMLMethod == 0)
2396 {
2397 m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
2398 SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
2399 if (sceneObject.IsAttachment)
2400 sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom;
2401
2402 return AddSceneObject(sceneObject);
2403 }
2404 else if ((XMLMethod == 100) && m_allowScriptCrossings)
2405 {
2406 m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor");
2407
2408 XmlDocument doc = new XmlDocument();
2409 doc.LoadXml(objXMLData);
2410
2411 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
2412 if (rootL.Count == 1)
2413 {
2414 XmlNode rootNode = rootL[0];
2415 if (rootNode != null)
2416 {
2417 XmlNodeList partL = rootNode.ChildNodes;
2418
2419 foreach (XmlNode part in partL)
2420 {
2421 XmlNodeList nodeL = part.ChildNodes;
2422
2423 switch (part.Name)
2424 {
2425 case "Assemblies":
2426 foreach (XmlNode asm in nodeL)
2427 {
2428 string fn = asm.Attributes.GetNamedItem("Filename").Value;
2429
2430 Byte[] filedata = Convert.FromBase64String(asm.InnerText);
2431 string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
2432 path = Path.Combine(path, fn);
2433
2434 if (!File.Exists(path))
2435 {
2436 FileStream fs = File.Create(path);
2437 fs.Write(filedata, 0, filedata.Length);
2438 fs.Close();
2439 }
2440 }
2441 break;
2442 case "ScriptStates":
2443 foreach (XmlNode st in nodeL)
2444 {
2445 string id = st.Attributes.GetNamedItem("UUID").Value;
2446 UUID uuid = new UUID(id);
2447 XmlNode state = st.ChildNodes[0];
2448
2449 XmlDocument sdoc = new XmlDocument();
2450 XmlNode sxmlnode = sdoc.CreateNode(
2451 XmlNodeType.XmlDeclaration,
2452 "", "");
2453 sdoc.AppendChild(sxmlnode);
2454
2455 XmlNode newnode = sdoc.ImportNode(state, true);
2456 sdoc.AppendChild(newnode);
2457
2458 string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
2459 spath = Path.Combine(spath, uuid.ToString());
2460 FileStream sfs = File.Create(spath + ".state");
2461 ASCIIEncoding enc = new ASCIIEncoding();
2462 Byte[] buf = enc.GetBytes(sdoc.InnerXml);
2463 sfs.Write(buf, 0, buf.Length);
2464 sfs.Close();
2465 }
2466 break;
2467 }
2468 }
2469 }
2470 }
2471
2472 SceneObjectPart RootPrim = GetSceneObjectPart(primID);
2473 RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
2474
2475 return true;
2476 }
2477
2478 return true;
2479 }
2480
2481 public bool IncomingCreateObject(ISceneObject sog) 2401 public bool IncomingCreateObject(ISceneObject sog)
2482 { 2402 {
2483 //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2403 //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
@@ -3350,7 +3270,6 @@ namespace OpenSim.Region.Framework.Scenes
3350 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; 3270 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
3351 //m_eventManager.OnRegionUp += OtherRegionUp; 3271 //m_eventManager.OnRegionUp += OtherRegionUp;
3352 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 3272 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3353 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
3354 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 3273 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
3355 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; 3274 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
3356 m_sceneGridService.KiPrimitive += SendKillObject; 3275 m_sceneGridService.KiPrimitive += SendKillObject;
@@ -3374,7 +3293,6 @@ namespace OpenSim.Region.Framework.Scenes
3374 m_sceneGridService.KiPrimitive -= SendKillObject; 3293 m_sceneGridService.KiPrimitive -= SendKillObject;
3375 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; 3294 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
3376 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 3295 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
3377 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
3378 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3296 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3379 //m_eventManager.OnRegionUp -= OtherRegionUp; 3297 //m_eventManager.OnRegionUp -= OtherRegionUp;
3380 m_sceneGridService.OnExpectUser -= HandleNewUserConnection; 3298 m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 76c6cab..3892769 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes
85 /// <summary> 85 /// <summary>
86 /// A Prim will arrive shortly 86 /// A Prim will arrive shortly
87 /// </summary> 87 /// </summary>
88 public event ExpectPrimDelegate OnExpectPrim;
89 public event CloseAgentConnection OnCloseAgentConnection; 88 public event CloseAgentConnection OnCloseAgentConnection;
90 89
91 /// <summary> 90 /// <summary>
@@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
116 115
117 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; 116 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
118 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; 117 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
119 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
120 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; 118 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
121 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 119 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
122 //private RegionUp handlerRegionUp = null; // OnRegionUp; 120 //private RegionUp handlerRegionUp = null; // OnRegionUp;
@@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
147 /// <exception cref="System.Exception">Thrown if region registration fails.</exception> 145 /// <exception cref="System.Exception">Thrown if region registration fails.</exception>
148 public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos) 146 public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
149 { 147 {
150 //m_interregionCommsOut = comms_out;
151
152 //m_regionInfo = regionInfos;
153 //m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
154 //regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
155
156 //if (regionCommsHost != null)
157 //{
158 // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
159
160 // regionCommsHost.debugRegionName = regionInfos.RegionName;
161 // regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
162 // regionCommsHost.OnExpectUser += NewUserConnection;
163 // regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
164 // regionCommsHost.OnCloseAgentConnection += CloseConnection;
165 // regionCommsHost.OnRegionUp += newRegionUp;
166 // regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
167 // regionCommsHost.OnLogOffUser += GridLogOffUser;
168 // regionCommsHost.OnGetLandData += FetchLandData;
169 //}
170 //else
171 //{
172 // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
173 //}
174 } 148 }
175 149
176 /// <summary> 150 /// <summary>
@@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes
179 /// </summary> 153 /// </summary>
180 public void Close() 154 public void Close()
181 { 155 {
182
183 //if (regionCommsHost != null)
184 //{
185 // regionCommsHost.OnLogOffUser -= GridLogOffUser;
186 // regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
187 // regionCommsHost.OnRegionUp -= newRegionUp;
188 // regionCommsHost.OnExpectUser -= NewUserConnection;
189 // regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
190 // regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
191 // regionCommsHost.OnCloseAgentConnection -= CloseConnection;
192 // regionCommsHost.OnGetLandData -= FetchLandData;
193
194 // try
195 // {
196 // m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
197 // }
198 // catch (Exception e)
199 // {
200 // m_log.ErrorFormat(
201 // "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
202 // m_regionInfo.RegionName, e);
203 // }
204
205 // regionCommsHost = null;
206 //}
207 } 156 }
208 157
209 #region CommsManager Event handlers 158 #region CommsManager Event handlers
@@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
263 } 212 }
264 } 213 }
265 214
266 /// <summary>
267 /// We have a new prim from a neighbor
268 /// </summary>
269 /// <param name="primID">unique ID for the primative</param>
270 /// <param name="objXMLData">XML2 encoded data of the primative</param>
271 /// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param>
272 /// <returns>True if the prim was accepted, false if it was not</returns>
273 protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
274 {
275 handlerExpectPrim = OnExpectPrim;
276 if (handlerExpectPrim != null)
277 {
278 return handlerExpectPrim(primID, objXMLData, XMLMethod);
279 }
280 else
281 {
282 return false;
283 }
284
285 }
286
287 protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical) 215 protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
288 { 216 {
289 handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; 217 handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index dfaa7ea..c2e3370 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -241,24 +241,24 @@ namespace OpenSim.Region.Framework.Scenes
241 /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets 241 /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets
242 /// as well as the details of the prims themselves. 242 /// as well as the details of the prims themselves.
243 /// </summary> 243 /// </summary>
244 /// <param name="filename"></param> 244 /// <param name="cmdparams"></param>
245 public void SaveCurrentSceneToArchive(string filename) 245 public void SaveCurrentSceneToArchive(string[] cmdparams)
246 { 246 {
247 IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); 247 IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
248 if (archiver != null) 248 if (archiver != null)
249 archiver.ArchiveRegion(filename); 249 archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams);
250 } 250 }
251 251
252 /// <summary> 252 /// <summary>
253 /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload 253 /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload
254 /// their assets to the asset service. 254 /// their assets to the asset service.
255 /// </summary> 255 /// </summary>
256 /// <param name="filename"></param> 256 /// <param name="cmdparams"></param>
257 public void LoadArchiveToCurrentScene(string filename) 257 public void LoadArchiveToCurrentScene(string[] cmdparams)
258 { 258 {
259 IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); 259 IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
260 if (archiver != null) 260 if (archiver != null)
261 archiver.DearchiveRegion(filename); 261 archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams);
262 } 262 }
263 263
264 public string SaveCurrentSceneMapToXmlString() 264 public string SaveCurrentSceneMapToXmlString()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 3cec77f..5a06bdb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes
309 309
310 public string GetStateSnapshot() 310 public string GetStateSnapshot()
311 { 311 {
312 //m_log.Debug(" >>> GetStateSnapshot <<<");
313
314 List<string> assemblies = new List<string>();
315 Dictionary<UUID, string> states = new Dictionary<UUID, string>(); 312 Dictionary<UUID, string> states = new Dictionary<UUID, string>();
316 313
317 foreach (SceneObjectPart part in m_parts.Values) 314 foreach (SceneObjectPart part in m_parts.Values)
318 { 315 {
319 foreach (string a in part.Inventory.GetScriptAssemblies())
320 {
321 if (a != "" && !assemblies.Contains(a))
322 assemblies.Add(a);
323 }
324
325 foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) 316 foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
326 {
327 states[s.Key] = s.Value; 317 states[s.Key] = s.Value;
328 }
329 } 318 }
330 319
331 if (states.Count < 1 || assemblies.Count < 1) 320 if (states.Count < 1)
332 return ""; 321 return "";
333 322
334 XmlDocument xmldoc = new XmlDocument(); 323 XmlDocument xmldoc = new XmlDocument();
@@ -342,104 +331,49 @@ namespace OpenSim.Region.Framework.Scenes
342 331
343 xmldoc.AppendChild(rootElement); 332 xmldoc.AppendChild(rootElement);
344 333
345 XmlElement wrapper = xmldoc.CreateElement("", "Assemblies",
346 "");
347 334
348 rootElement.AppendChild(wrapper); 335 XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
349
350 foreach (string assembly in assemblies)
351 {
352 string fn = Path.GetFileName(assembly);
353 if (fn == String.Empty)
354 continue;
355
356 String filedata = String.Empty;
357
358 if (File.Exists(assembly+".text"))
359 {
360 FileInfo tfi = new FileInfo(assembly+".text");
361
362 if (tfi == null)
363 continue;
364
365 Byte[] tdata = new Byte[tfi.Length];
366
367 try
368 {
369 FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
370 tfs.Read(tdata, 0, tdata.Length);
371 tfs.Close();
372 }
373 catch (Exception e)
374 {
375 m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
376 }
377
378 filedata = new System.Text.ASCIIEncoding().GetString(tdata);
379 }
380 else
381 {
382 FileInfo fi = new FileInfo(assembly);
383
384 if (fi == null)
385 continue;
386
387 Byte[] data = new Byte[fi.Length];
388
389 try
390 {
391 FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
392 fs.Read(data, 0, data.Length);
393 fs.Close();
394 }
395 catch (Exception e)
396 {
397 m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
398 }
399
400 filedata = System.Convert.ToBase64String(data);
401 }
402 XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
403 XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
404 assemblyName.Value = fn;
405 assemblyData.Attributes.Append(assemblyName);
406
407 assemblyData.InnerText = filedata;
408
409 wrapper.AppendChild(assemblyData);
410 }
411
412 wrapper = xmldoc.CreateElement("", "ScriptStates",
413 ""); 336 "");
414 337
415 rootElement.AppendChild(wrapper); 338 rootElement.AppendChild(wrapper);
416 339
417 foreach (KeyValuePair<UUID, string> state in states) 340 foreach (KeyValuePair<UUID, string> state in states)
418 { 341 {
419 XmlElement stateData = xmldoc.CreateElement("", "State", "");
420
421 XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", "");
422 stateID.Value = state.Key.ToString();
423 stateData.Attributes.Append(stateID);
424
425 XmlDocument sdoc = new XmlDocument(); 342 XmlDocument sdoc = new XmlDocument();
426 sdoc.LoadXml(state.Value); 343 sdoc.LoadXml(state.Value);
427 XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); 344 XmlNodeList rootL = sdoc.GetElementsByTagName("State");
428 XmlNode rootNode = rootL[0]; 345 XmlNode rootNode = rootL[0];
429 346
430 XmlNode newNode = xmldoc.ImportNode(rootNode, true); 347 XmlNode newNode = xmldoc.ImportNode(rootNode, true);
431 stateData.AppendChild(newNode); 348 wrapper.AppendChild(newNode);
432 wrapper.AppendChild(stateData);
433 } 349 }
434 350
435 return xmldoc.InnerXml; 351 return xmldoc.InnerXml;
436 } 352 }
437 353
438 public void SetState(string objXMLData, UUID RegionID) 354 public void SetState(string objXMLData, IScene ins)
439 { 355 {
356 if (!(ins is Scene))
357 return;
358
359 Scene s = (Scene)ins;
360
440 if (objXMLData == String.Empty) 361 if (objXMLData == String.Empty)
441 return; 362 return;
442 363
364 IScriptModule scriptModule = null;
365
366 foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
367 {
368 if (sm.ScriptEngineName == s.DefaultScriptEngine)
369 scriptModule = sm;
370 else if (scriptModule == null)
371 scriptModule = sm;
372 }
373
374 if (scriptModule == null)
375 return;
376
443 XmlDocument doc = new XmlDocument(); 377 XmlDocument doc = new XmlDocument();
444 try 378 try
445 { 379 {
@@ -457,69 +391,23 @@ namespace OpenSim.Region.Framework.Scenes
457 } 391 }
458 392
459 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); 393 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
460 if (rootL.Count == 1) 394 if (rootL.Count != 1)
395 return;
396
397 XmlElement rootE = (XmlElement)rootL[0];
398
399 XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
400 if (dataL.Count != 1)
401 return;
402
403 XmlElement dataE = (XmlElement)dataL[0];
404
405 foreach (XmlNode n in dataE.ChildNodes)
461 { 406 {
462 XmlNode rootNode = rootL[0]; 407 XmlElement stateE = (XmlElement)n;
463 if (rootNode != null) 408 UUID itemID = new UUID(stateE.GetAttribute("UUID"));
464 { 409
465 XmlNodeList partL = rootNode.ChildNodes; 410 scriptModule.SetXMLState(itemID, n.OuterXml);
466
467 foreach (XmlNode part in partL)
468 {
469 XmlNodeList nodeL = part.ChildNodes;
470
471 switch (part.Name)
472 {
473 case "Assemblies":
474 foreach (XmlNode asm in nodeL)
475 {
476 string fn = asm.Attributes.GetNamedItem("Filename").Value;
477
478 Byte[] filedata = Convert.FromBase64String(asm.InnerText);
479 string path = Path.Combine("ScriptEngines", RegionID.ToString());
480 path = Path.Combine(path, fn);
481
482 if (!File.Exists(path))
483 {
484 FileStream fs = File.Create(path);
485 fs.Write(filedata, 0, filedata.Length);
486 fs.Close();
487
488 Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
489 fs = File.Create(path+".text");
490 fs.Write(textbytes, 0, textbytes.Length);
491 fs.Close();
492 }
493 }
494 break;
495 case "ScriptStates":
496 foreach (XmlNode st in nodeL)
497 {
498 string id = st.Attributes.GetNamedItem("UUID").Value;
499 UUID uuid = new UUID(id);
500 XmlNode state = st.ChildNodes[0];
501
502 XmlDocument sdoc = new XmlDocument();
503 XmlNode sxmlnode = sdoc.CreateNode(
504 XmlNodeType.XmlDeclaration,
505 "", "");
506 sdoc.AppendChild(sxmlnode);
507
508 XmlNode newnode = sdoc.ImportNode(state, true);
509 sdoc.AppendChild(newnode);
510
511 string spath = Path.Combine("ScriptEngines", RegionID.ToString());
512 spath = Path.Combine(spath, uuid.ToString());
513 FileStream sfs = File.Create(spath + ".state");
514 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
515 Byte[] buf = enc.GetBytes(sdoc.InnerXml);
516 sfs.Write(buf, 0, buf.Length);
517 sfs.Close();
518 }
519 break;
520 }
521 }
522 }
523 } 411 }
524 } 412 }
525 } 413 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ea4f2c7..f36ff1d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3380,17 +3380,6 @@ namespace OpenSim.Region.Framework.Scenes
3380 } 3380 }
3381 #endregion 3381 #endregion
3382 3382
3383 public bool CanBeDeleted()
3384 {
3385 foreach (SceneObjectPart part in Children.Values)
3386 {
3387 if (!part.CanBeDeleted())
3388 return false;
3389 }
3390
3391 return true;
3392 }
3393
3394 public double GetUpdatePriority(IClientAPI client) 3383 public double GetUpdatePriority(IClientAPI client)
3395 { 3384 {
3396 switch (Scene.UpdatePrioritizationScheme) 3385 switch (Scene.UpdatePrioritizationScheme)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cdec135..19e3023 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -389,12 +389,16 @@ namespace OpenSim.Region.Framework.Scenes
389 } 389 }
390 390
391 /// <value> 391 /// <value>
392 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 392 /// Get the inventory list
393 /// </value> 393 /// </value>
394 public TaskInventoryDictionary TaskInventory 394 public TaskInventoryDictionary TaskInventory
395 { 395 {
396 get { return m_inventory.Items; } 396 get {
397 set { m_inventory.Items = value; } 397 return m_inventory.Items;
398 }
399 set {
400 m_inventory.Items = value;
401 }
398 } 402 }
399 403
400 public uint ObjectFlags 404 public uint ObjectFlags
@@ -2101,17 +2105,18 @@ namespace OpenSim.Region.Framework.Scenes
2101 //Trys to fetch sound id from prim's inventory. 2105 //Trys to fetch sound id from prim's inventory.
2102 //Prim's inventory doesn't support non script items yet 2106 //Prim's inventory doesn't support non script items yet
2103 2107
2104 lock (TaskInventory) 2108 TaskInventory.LockItemsForRead(true);
2109
2110 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2105 { 2111 {
2106 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2112 if (item.Value.Name == sound)
2107 { 2113 {
2108 if (item.Value.Name == sound) 2114 soundID = item.Value.ItemID;
2109 { 2115 break;
2110 soundID = item.Value.ItemID;
2111 break;
2112 }
2113 } 2116 }
2114 } 2117 }
2118
2119 TaskInventory.LockItemsForRead(false);
2115 } 2120 }
2116 2121
2117 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2122 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2457,17 +2462,16 @@ namespace OpenSim.Region.Framework.Scenes
2457 if (!UUID.TryParse(sound, out soundID)) 2462 if (!UUID.TryParse(sound, out soundID))
2458 { 2463 {
2459 // search sound file from inventory 2464 // search sound file from inventory
2460 lock (TaskInventory) 2465 TaskInventory.LockItemsForRead(true);
2466 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2461 { 2467 {
2462 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2468 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2463 { 2469 {
2464 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2470 soundID = item.Value.ItemID;
2465 { 2471 break;
2466 soundID = item.Value.ItemID;
2467 break;
2468 }
2469 } 2472 }
2470 } 2473 }
2474 TaskInventory.LockItemsForRead(false);
2471 } 2475 }
2472 2476
2473 if (soundID == UUID.Zero) 2477 if (soundID == UUID.Zero)
@@ -3803,10 +3807,5 @@ namespace OpenSim.Region.Framework.Scenes
3803 3807
3804 Inventory.ApplyNextOwnerPermissions(); 3808 Inventory.ApplyNextOwnerPermissions();
3805 } 3809 }
3806
3807 public bool CanBeDeleted()
3808 {
3809 return Inventory.CanBeDeleted();
3810 }
3811 } 3810 }
3812} 3811}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f4ca877..eca8588 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -80,7 +80,9 @@ namespace OpenSim.Region.Framework.Scenes
80 /// </value> 80 /// </value>
81 protected internal TaskInventoryDictionary Items 81 protected internal TaskInventoryDictionary Items
82 { 82 {
83 get { return m_items; } 83 get {
84 return m_items;
85 }
84 set 86 set
85 { 87 {
86 m_items = value; 88 m_items = value;
@@ -116,22 +118,25 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="linkNum">Link number for the part</param> 118 /// <param name="linkNum">Link number for the part</param>
117 public void ResetInventoryIDs() 119 public void ResetInventoryIDs()
118 { 120 {
119 lock (Items) 121 m_items.LockItemsForWrite(true);
122
123 if (0 == Items.Count)
120 { 124 {
121 if (0 == Items.Count) 125 m_items.LockItemsForWrite(false);
122 return; 126 return;
127 }
123 128
124 HasInventoryChanged = true; 129 HasInventoryChanged = true;
125 m_part.ParentGroup.HasGroupChanged = true; 130 m_part.ParentGroup.HasGroupChanged = true;
126 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 131 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
127 Items.Clear(); 132 Items.Clear();
128 133
129 foreach (TaskInventoryItem item in items) 134 foreach (TaskInventoryItem item in items)
130 { 135 {
131 item.ResetIDs(m_part.UUID); 136 item.ResetIDs(m_part.UUID);
132 Items.Add(item.ItemID, item); 137 Items.Add(item.ItemID, item);
133 }
134 } 138 }
139 m_items.LockItemsForWrite(false);
135 } 140 }
136 141
137 /// <summary> 142 /// <summary>
@@ -140,25 +145,25 @@ namespace OpenSim.Region.Framework.Scenes
140 /// <param name="ownerId"></param> 145 /// <param name="ownerId"></param>
141 public void ChangeInventoryOwner(UUID ownerId) 146 public void ChangeInventoryOwner(UUID ownerId)
142 { 147 {
143 lock (Items) 148 m_items.LockItemsForWrite(true);
149 if (0 == Items.Count)
144 { 150 {
145 if (0 == Items.Count) 151 m_items.LockItemsForWrite(false);
146 { 152 return;
147 return; 153 }
148 }
149 154
150 HasInventoryChanged = true; 155 HasInventoryChanged = true;
151 m_part.ParentGroup.HasGroupChanged = true; 156 m_part.ParentGroup.HasGroupChanged = true;
152 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 157 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
153 foreach (TaskInventoryItem item in items) 158 foreach (TaskInventoryItem item in items)
159 {
160 if (ownerId != item.OwnerID)
154 { 161 {
155 if (ownerId != item.OwnerID) 162 item.LastOwnerID = item.OwnerID;
156 { 163 item.OwnerID = ownerId;
157 item.LastOwnerID = item.OwnerID;
158 item.OwnerID = ownerId;
159 }
160 } 164 }
161 } 165 }
166 m_items.LockItemsForWrite(false);
162 } 167 }
163 168
164 /// <summary> 169 /// <summary>
@@ -167,24 +172,24 @@ namespace OpenSim.Region.Framework.Scenes
167 /// <param name="groupID"></param> 172 /// <param name="groupID"></param>
168 public void ChangeInventoryGroup(UUID groupID) 173 public void ChangeInventoryGroup(UUID groupID)
169 { 174 {
170 lock (Items) 175 m_items.LockItemsForWrite(true);
176 if (0 == Items.Count)
171 { 177 {
172 if (0 == Items.Count) 178 m_items.LockItemsForWrite(false);
173 { 179 return;
174 return; 180 }
175 }
176 181
177 HasInventoryChanged = true; 182 HasInventoryChanged = true;
178 m_part.ParentGroup.HasGroupChanged = true; 183 m_part.ParentGroup.HasGroupChanged = true;
179 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 184 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
180 foreach (TaskInventoryItem item in items) 185 foreach (TaskInventoryItem item in items)
186 {
187 if (groupID != item.GroupID)
181 { 188 {
182 if (groupID != item.GroupID) 189 item.GroupID = groupID;
183 {
184 item.GroupID = groupID;
185 }
186 } 190 }
187 } 191 }
192 m_items.LockItemsForWrite(false);
188 } 193 }
189 194
190 /// <summary> 195 /// <summary>
@@ -192,14 +197,14 @@ namespace OpenSim.Region.Framework.Scenes
192 /// </summary> 197 /// </summary>
193 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 198 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
194 { 199 {
195 lock (m_items) 200 Items.LockItemsForRead(true);
201 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
202 Items.LockItemsForRead(false);
203 foreach (TaskInventoryItem item in items)
196 { 204 {
197 foreach (TaskInventoryItem item in Items.Values) 205 if ((int)InventoryType.LSL == item.InvType)
198 { 206 {
199 if ((int)InventoryType.LSL == item.InvType) 207 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
200 {
201 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
202 }
203 } 208 }
204 } 209 }
205 } 210 }
@@ -209,17 +214,20 @@ namespace OpenSim.Region.Framework.Scenes
209 /// </summary> 214 /// </summary>
210 public void RemoveScriptInstances() 215 public void RemoveScriptInstances()
211 { 216 {
212 lock (Items) 217 Items.LockItemsForRead(true);
218 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
219 Items.LockItemsForRead(false);
220
221 foreach (TaskInventoryItem item in items)
213 { 222 {
214 foreach (TaskInventoryItem item in Items.Values) 223 if ((int)InventoryType.LSL == item.InvType)
215 { 224 {
216 if ((int)InventoryType.LSL == item.InvType) 225 RemoveScriptInstance(item.ItemID);
217 { 226 m_part.RemoveScriptEvents(item.ItemID);
218 RemoveScriptInstance(item.ItemID);
219 m_part.RemoveScriptEvents(item.ItemID);
220 }
221 } 227 }
222 } 228 }
229
230
223 } 231 }
224 232
225 /// <summary> 233 /// <summary>
@@ -244,8 +252,10 @@ namespace OpenSim.Region.Framework.Scenes
244 if (stateSource == 1 && // Prim crossing 252 if (stateSource == 1 && // Prim crossing
245 m_part.ParentGroup.Scene.m_trustBinaries) 253 m_part.ParentGroup.Scene.m_trustBinaries)
246 { 254 {
255 m_items.LockItemsForWrite(true);
247 m_items[item.ItemID].PermsMask = 0; 256 m_items[item.ItemID].PermsMask = 0;
248 m_items[item.ItemID].PermsGranter = UUID.Zero; 257 m_items[item.ItemID].PermsGranter = UUID.Zero;
258 m_items.LockItemsForWrite(false);
249 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 259 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
250 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); 260 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
251 m_part.ParentGroup.AddActiveScriptCount(1); 261 m_part.ParentGroup.AddActiveScriptCount(1);
@@ -266,8 +276,10 @@ namespace OpenSim.Region.Framework.Scenes
266 { 276 {
267 if (m_part.ParentGroup.m_savedScriptState != null) 277 if (m_part.ParentGroup.m_savedScriptState != null)
268 RestoreSavedScriptState(item.OldItemID, item.ItemID); 278 RestoreSavedScriptState(item.OldItemID, item.ItemID);
279 m_items.LockItemsForWrite(true);
269 m_items[item.ItemID].PermsMask = 0; 280 m_items[item.ItemID].PermsMask = 0;
270 m_items[item.ItemID].PermsGranter = UUID.Zero; 281 m_items[item.ItemID].PermsGranter = UUID.Zero;
282 m_items.LockItemsForWrite(false);
271 string script = Utils.BytesToString(asset.Data); 283 string script = Utils.BytesToString(asset.Data);
272 m_part.ParentGroup.Scene.EventManager.TriggerRezScript( 284 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
273 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); 285 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
@@ -302,20 +314,22 @@ namespace OpenSim.Region.Framework.Scenes
302 /// </param> 314 /// </param>
303 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 315 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
304 { 316 {
305 lock (m_items) 317 m_items.LockItemsForRead(true);
318 if (m_items.ContainsKey(itemId))
306 { 319 {
307 if (m_items.ContainsKey(itemId)) 320 TaskInventoryItem item = m_items[itemId];
308 { 321 m_items.LockItemsForRead(false);
309 CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); 322 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
310 } 323 }
311 else 324 else
312 { 325 {
313 m_log.ErrorFormat( 326 m_items.LockItemsForRead(false);
314 "[PRIM INVENTORY]: " + 327 m_log.ErrorFormat(
315 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", 328 "[PRIM INVENTORY]: " +
316 itemId, m_part.Name, m_part.UUID); 329 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}",
317 } 330 itemId, m_part.Name, m_part.UUID);
318 } 331 }
332
319 } 333 }
320 334
321 /// <summary> 335 /// <summary>
@@ -346,11 +360,16 @@ namespace OpenSim.Region.Framework.Scenes
346 /// <returns></returns> 360 /// <returns></returns>
347 private bool InventoryContainsName(string name) 361 private bool InventoryContainsName(string name)
348 { 362 {
349 foreach (TaskInventoryItem item in Items.Values) 363 m_items.LockItemsForRead(true);
364 foreach (TaskInventoryItem item in m_items.Values)
350 { 365 {
351 if (item.Name == name) 366 if (item.Name == name)
367 {
368 m_items.LockItemsForRead(false);
352 return true; 369 return true;
370 }
353 } 371 }
372 m_items.LockItemsForRead(false);
354 return false; 373 return false;
355 } 374 }
356 375
@@ -392,7 +411,9 @@ namespace OpenSim.Region.Framework.Scenes
392 /// <param name="item"></param> 411 /// <param name="item"></param>
393 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) 412 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
394 { 413 {
414 m_items.LockItemsForRead(true);
395 List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values); 415 List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values);
416 m_items.LockItemsForRead(false);
396 foreach (TaskInventoryItem i in il) 417 foreach (TaskInventoryItem i in il)
397 { 418 {
398 if (i.Name == item.Name) 419 if (i.Name == item.Name)
@@ -429,15 +450,14 @@ namespace OpenSim.Region.Framework.Scenes
429 item.ParentPartID = m_part.UUID; 450 item.ParentPartID = m_part.UUID;
430 item.Name = name; 451 item.Name = name;
431 452
432 lock (m_items) 453 m_items.LockItemsForWrite(true);
433 { 454 m_items.Add(item.ItemID, item);
434 m_items.Add(item.ItemID, item); 455 m_items.LockItemsForWrite(false);
435
436 if (allowedDrop) 456 if (allowedDrop)
437 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); 457 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
438 else 458 else
439 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 459 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
440 } 460
441 461
442 m_inventorySerial++; 462 m_inventorySerial++;
443 //m_inventorySerial += 2; 463 //m_inventorySerial += 2;
@@ -454,14 +474,13 @@ namespace OpenSim.Region.Framework.Scenes
454 /// <param name="items"></param> 474 /// <param name="items"></param>
455 public void RestoreInventoryItems(ICollection<TaskInventoryItem> items) 475 public void RestoreInventoryItems(ICollection<TaskInventoryItem> items)
456 { 476 {
457 lock (m_items) 477 m_items.LockItemsForWrite(true);
478 foreach (TaskInventoryItem item in items)
458 { 479 {
459 foreach (TaskInventoryItem item in items) 480 m_items.Add(item.ItemID, item);
460 { 481 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
461 m_items.Add(item.ItemID, item);
462 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
463 }
464 } 482 }
483 m_items.LockItemsForWrite(false);
465 484
466 m_inventorySerial++; 485 m_inventorySerial++;
467 } 486 }
@@ -474,8 +493,9 @@ namespace OpenSim.Region.Framework.Scenes
474 public TaskInventoryItem GetInventoryItem(UUID itemId) 493 public TaskInventoryItem GetInventoryItem(UUID itemId)
475 { 494 {
476 TaskInventoryItem item; 495 TaskInventoryItem item;
496 m_items.LockItemsForRead(true);
477 m_items.TryGetValue(itemId, out item); 497 m_items.TryGetValue(itemId, out item);
478 498 m_items.LockItemsForRead(false);
479 return item; 499 return item;
480 } 500 }
481 501
@@ -487,45 +507,45 @@ namespace OpenSim.Region.Framework.Scenes
487 /// <returns>false if the item did not exist, true if the update occurred successfully</returns> 507 /// <returns>false if the item did not exist, true if the update occurred successfully</returns>
488 public bool UpdateInventoryItem(TaskInventoryItem item) 508 public bool UpdateInventoryItem(TaskInventoryItem item)
489 { 509 {
490 lock (m_items) 510 m_items.LockItemsForWrite(true);
511
512 if (m_items.ContainsKey(item.ItemID))
491 { 513 {
492 if (m_items.ContainsKey(item.ItemID)) 514 item.ParentID = m_part.UUID;
515 item.ParentPartID = m_part.UUID;
516 item.Flags = m_items[item.ItemID].Flags;
517 if (item.AssetID == UUID.Zero)
493 { 518 {
494 item.ParentID = m_part.UUID; 519 item.AssetID = m_items[item.ItemID].AssetID;
495 item.ParentPartID = m_part.UUID; 520 }
496 item.Flags = m_items[item.ItemID].Flags; 521 else if ((InventoryType)item.Type == InventoryType.Notecard)
497 if (item.AssetID == UUID.Zero) 522 {
498 { 523 ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
499 item.AssetID = m_items[item.ItemID].AssetID;
500 }
501 else if ((InventoryType)item.Type == InventoryType.Notecard)
502 {
503 ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
504 524
505 if (presence != null) 525 if (presence != null)
506 { 526 {
507 presence.ControllingClient.SendAgentAlertMessage( 527 presence.ControllingClient.SendAgentAlertMessage(
508 "Notecard saved", false); 528 "Notecard saved", false);
509 }
510 } 529 }
530 }
511 531
512 m_items[item.ItemID] = item; 532 m_items[item.ItemID] = item;
513 m_inventorySerial++; 533 m_inventorySerial++;
514 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 534 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
515
516 HasInventoryChanged = true;
517 m_part.ParentGroup.HasGroupChanged = true;
518 535
519 return true; 536 HasInventoryChanged = true;
520 } 537 m_part.ParentGroup.HasGroupChanged = true;
521 else 538 m_items.LockItemsForWrite(false);
522 { 539 return true;
523 m_log.ErrorFormat( 540 }
524 "[PRIM INVENTORY]: " + 541 else
525 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", 542 {
526 item.ItemID, m_part.Name, m_part.UUID); 543 m_log.ErrorFormat(
527 } 544 "[PRIM INVENTORY]: " +
545 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
546 item.ItemID, m_part.Name, m_part.UUID);
528 } 547 }
548 m_items.LockItemsForWrite(false);
529 549
530 return false; 550 return false;
531 } 551 }
@@ -538,51 +558,54 @@ namespace OpenSim.Region.Framework.Scenes
538 /// in this prim's inventory.</returns> 558 /// in this prim's inventory.</returns>
539 public int RemoveInventoryItem(UUID itemID) 559 public int RemoveInventoryItem(UUID itemID)
540 { 560 {
541 lock (m_items) 561 m_items.LockItemsForRead(true);
562
563 if (m_items.ContainsKey(itemID))
542 { 564 {
543 if (m_items.ContainsKey(itemID)) 565 int type = m_items[itemID].InvType;
566 m_items.LockItemsForRead(false);
567 if (type == 10) // Script
544 { 568 {
545 int type = m_items[itemID].InvType; 569 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
546 if (type == 10) // Script 570 }
547 { 571 m_items.LockItemsForWrite(true);
548 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); 572 m_items.Remove(itemID);
549 } 573 m_items.LockItemsForWrite(false);
550 m_items.Remove(itemID); 574 m_inventorySerial++;
551 m_inventorySerial++; 575 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
552 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
553
554 HasInventoryChanged = true;
555 m_part.ParentGroup.HasGroupChanged = true;
556 576
557 int scriptcount = 0; 577 HasInventoryChanged = true;
558 lock (m_items) 578 m_part.ParentGroup.HasGroupChanged = true;
559 {
560 foreach (TaskInventoryItem item in m_items.Values)
561 {
562 if (item.Type == 10)
563 {
564 scriptcount++;
565 }
566 }
567 }
568 579
569 if (scriptcount <= 0) 580 int scriptcount = 0;
581 m_items.LockItemsForRead(true);
582 foreach (TaskInventoryItem item in m_items.Values)
583 {
584 if (item.Type == 10)
570 { 585 {
571 m_part.RemFlag(PrimFlags.Scripted); 586 scriptcount++;
572 } 587 }
573
574 m_part.ScheduleFullUpdate();
575
576 return type;
577 } 588 }
578 else 589 m_items.LockItemsForRead(false);
590
591
592 if (scriptcount <= 0)
579 { 593 {
580 m_log.ErrorFormat( 594 m_part.RemFlag(PrimFlags.Scripted);
581 "[PRIM INVENTORY]: " +
582 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
583 itemID, m_part.Name, m_part.UUID);
584 } 595 }
596
597 m_part.ScheduleFullUpdate();
598
599 return type;
585 } 600 }
601 else
602 {
603 m_log.ErrorFormat(
604 "[PRIM INVENTORY]: " +
605 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
606 itemID, m_part.Name, m_part.UUID);
607 }
608 m_items.LockItemsForWrite(false);
586 609
587 return -1; 610 return -1;
588 } 611 }
@@ -635,52 +658,53 @@ namespace OpenSim.Region.Framework.Scenes
635 // isn't available (such as drag from prim inventory to agent inventory) 658 // isn't available (such as drag from prim inventory to agent inventory)
636 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); 659 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
637 660
638 lock (m_items) 661 m_items.LockItemsForRead(true);
662
663 foreach (TaskInventoryItem item in m_items.Values)
639 { 664 {
640 foreach (TaskInventoryItem item in m_items.Values) 665 UUID ownerID = item.OwnerID;
641 { 666 uint everyoneMask = 0;
642 UUID ownerID = item.OwnerID; 667 uint baseMask = item.BasePermissions;
643 uint everyoneMask = 0; 668 uint ownerMask = item.CurrentPermissions;
644 uint baseMask = item.BasePermissions;
645 uint ownerMask = item.CurrentPermissions;
646 669
647 invString.AddItemStart(); 670 invString.AddItemStart();
648 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 671 invString.AddNameValueLine("item_id", item.ItemID.ToString());
649 invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); 672 invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
650 673
651 invString.AddPermissionsStart(); 674 invString.AddPermissionsStart();
652 675
653 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); 676 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
654 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); 677 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
655 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0)); 678 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0));
656 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); 679 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
657 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); 680 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
658 681
659 invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); 682 invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
660 invString.AddNameValueLine("owner_id", ownerID.ToString()); 683 invString.AddNameValueLine("owner_id", ownerID.ToString());
661 684
662 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); 685 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
663 686
664 invString.AddNameValueLine("group_id", item.GroupID.ToString()); 687 invString.AddNameValueLine("group_id", item.GroupID.ToString());
665 invString.AddSectionEnd(); 688 invString.AddSectionEnd();
666 689
667 invString.AddNameValueLine("asset_id", item.AssetID.ToString()); 690 invString.AddNameValueLine("asset_id", item.AssetID.ToString());
668 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); 691 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
669 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); 692 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
670 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); 693 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
671 694
672 invString.AddSaleStart(); 695 invString.AddSaleStart();
673 invString.AddNameValueLine("sale_type", "not"); 696 invString.AddNameValueLine("sale_type", "not");
674 invString.AddNameValueLine("sale_price", "0"); 697 invString.AddNameValueLine("sale_price", "0");
675 invString.AddSectionEnd(); 698 invString.AddSectionEnd();
676 699
677 invString.AddNameValueLine("name", item.Name + "|"); 700 invString.AddNameValueLine("name", item.Name + "|");
678 invString.AddNameValueLine("desc", item.Description + "|"); 701 invString.AddNameValueLine("desc", item.Description + "|");
679 702
680 invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); 703 invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
681 invString.AddSectionEnd(); 704 invString.AddSectionEnd();
682 }
683 } 705 }
706 int count = m_items.Count;
707 m_items.LockItemsForRead(false);
684 708
685 fileData = Utils.StringToBytes(invString.BuildString); 709 fileData = Utils.StringToBytes(invString.BuildString);
686 710
@@ -701,10 +725,9 @@ namespace OpenSim.Region.Framework.Scenes
701 { 725 {
702 if (HasInventoryChanged) 726 if (HasInventoryChanged)
703 { 727 {
704 lock (Items) 728 Items.LockItemsForRead(true);
705 { 729 datastore.StorePrimInventory(m_part.UUID, Items.Values);
706 datastore.StorePrimInventory(m_part.UUID, Items.Values); 730 Items.LockItemsForRead(false);
707 }
708 731
709 HasInventoryChanged = false; 732 HasInventoryChanged = false;
710 } 733 }
@@ -857,36 +880,6 @@ namespace OpenSim.Region.Framework.Scenes
857 return ret; 880 return ret;
858 } 881 }
859 882
860 public string[] GetScriptAssemblies()
861 {
862 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
863
864 List<string> ret = new List<string>();
865 if (engines == null) // No engine at all
866 return new string[0];
867
868 foreach (TaskInventoryItem item in m_items.Values)
869 {
870 if (item.InvType == (int)InventoryType.LSL)
871 {
872 foreach (IScriptModule e in engines)
873 {
874 if (e != null)
875 {
876 string n = e.GetAssemblyName(item.ItemID);
877 if (n != String.Empty)
878 {
879 if (!ret.Contains(n))
880 ret.Add(n);
881 break;
882 }
883 }
884 }
885 }
886 }
887 return ret.ToArray();
888 }
889
890 public Dictionary<UUID, string> GetScriptStates() 883 public Dictionary<UUID, string> GetScriptStates()
891 { 884 {
892 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 885 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
@@ -916,30 +909,5 @@ namespace OpenSim.Region.Framework.Scenes
916 } 909 }
917 return ret; 910 return ret;
918 } 911 }
919
920 public bool CanBeDeleted()
921 {
922 if (!ContainsScripts())
923 return true;
924
925 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
926
927 if (engines == null) // No engine at all
928 return true;
929
930 foreach (TaskInventoryItem item in m_items.Values)
931 {
932 if (item.InvType == (int)InventoryType.LSL)
933 {
934 foreach (IScriptModule e in engines)
935 {
936 if (!e.CanBeDeleted(item.ItemID))
937 return false;
938 }
939 }
940 }
941
942 return true;
943 }
944 } 912 }
945} 913}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e677cfd..cebd108 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes
171 protected RegionInfo m_regionInfo; 171 protected RegionInfo m_regionInfo;
172 protected ulong crossingFromRegion; 172 protected ulong crossingFromRegion;
173 173
174 private readonly Vector3[] Dir_Vectors = new Vector3[9]; 174 private readonly Vector3[] Dir_Vectors = new Vector3[11];
175 private bool m_isNudging = false; 175 private bool m_isNudging = false;
176 176
177 // Position of agent's camera in world (region cordinates) 177 // Position of agent's camera in world (region cordinates)
@@ -241,6 +241,8 @@ namespace OpenSim.Region.Framework.Scenes
241 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, 241 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
242 DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, 242 DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
243 DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, 243 DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
244 DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS,
245 DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG,
244 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG 246 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
245 } 247 }
246 248
@@ -725,12 +727,14 @@ namespace OpenSim.Region.Framework.Scenes
725 Dir_Vectors[5] = -Vector3.UnitZ; //DOWN 727 Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
726 Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE 728 Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
727 Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE 729 Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
728 Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge 730 Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
731 Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
732 Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
729 } 733 }
730 734
731 private Vector3[] GetWalkDirectionVectors() 735 private Vector3[] GetWalkDirectionVectors()
732 { 736 {
733 Vector3[] vector = new Vector3[9]; 737 Vector3[] vector = new Vector3[11];
734 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD 738 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
735 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK 739 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
736 vector[2] = Vector3.UnitY; //LEFT 740 vector[2] = Vector3.UnitY; //LEFT
@@ -739,13 +743,15 @@ namespace OpenSim.Region.Framework.Scenes
739 vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN 743 vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
740 vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE 744 vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
741 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE 745 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
742 vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge 746 vector[8] = Vector3.UnitY; //LEFT_NUDGE
747 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
748 vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE
743 return vector; 749 return vector;
744 } 750 }
745 751
746 private bool[] GetDirectionIsNudge() 752 private bool[] GetDirectionIsNudge()
747 { 753 {
748 bool[] isNudge = new bool[9]; 754 bool[] isNudge = new bool[11];
749 isNudge[0] = false; //FORWARD 755 isNudge[0] = false; //FORWARD
750 isNudge[1] = false; //BACK 756 isNudge[1] = false; //BACK
751 isNudge[2] = false; //LEFT 757 isNudge[2] = false; //LEFT
@@ -754,7 +760,9 @@ namespace OpenSim.Region.Framework.Scenes
754 isNudge[5] = false; //DOWN 760 isNudge[5] = false; //DOWN
755 isNudge[6] = true; //FORWARD_NUDGE 761 isNudge[6] = true; //FORWARD_NUDGE
756 isNudge[7] = true; //BACK_NUDGE 762 isNudge[7] = true; //BACK_NUDGE
757 isNudge[8] = true; //DOWN_Nudge 763 isNudge[8] = true; //LEFT_NUDGE
764 isNudge[9] = true; //RIGHT_NUDGE
765 isNudge[10] = true; //DOWN_Nudge
758 return isNudge; 766 return isNudge;
759 } 767 }
760 768
@@ -1618,21 +1626,19 @@ namespace OpenSim.Region.Framework.Scenes
1618 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); 1626 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
1619 if (part != null) 1627 if (part != null)
1620 { 1628 {
1629 part.TaskInventory.LockItemsForRead(true);
1621 TaskInventoryDictionary taskIDict = part.TaskInventory; 1630 TaskInventoryDictionary taskIDict = part.TaskInventory;
1622 if (taskIDict != null) 1631 if (taskIDict != null)
1623 { 1632 {
1624 lock (taskIDict) 1633 foreach (UUID taskID in taskIDict.Keys)
1625 { 1634 {
1626 foreach (UUID taskID in taskIDict.Keys) 1635 UnRegisterControlEventsToScript(LocalId, taskID);
1627 { 1636 taskIDict[taskID].PermsMask &= ~(
1628 UnRegisterControlEventsToScript(LocalId, taskID); 1637 2048 | //PERMISSION_CONTROL_CAMERA
1629 taskIDict[taskID].PermsMask &= ~( 1638 4); // PERMISSION_TAKE_CONTROLS
1630 2048 | //PERMISSION_CONTROL_CAMERA
1631 4); // PERMISSION_TAKE_CONTROLS
1632 }
1633 } 1639 }
1634
1635 } 1640 }
1641 part.TaskInventory.LockItemsForRead(false);
1636 // Reset sit target. 1642 // Reset sit target.
1637 if (part.GetAvatarOnSitTarget() == UUID) 1643 if (part.GetAvatarOnSitTarget() == UUID)
1638 part.SetAvatarOnSitTarget(UUID.Zero); 1644 part.SetAvatarOnSitTarget(UUID.Zero);
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index ee288b3..56c6ed6 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
82 private int m_fps = 0; 82 private int m_fps = 0;
83 // saved last reported value so there is something available for llGetRegionFPS 83 // saved last reported value so there is something available for llGetRegionFPS
84 private float lastReportedSimFPS = 0; 84 private float lastReportedSimFPS = 0;
85 private float[] lastReportedSimStats = new float[21];
85 private float m_pfps = 0; 86 private float m_pfps = 0;
86 private int m_agentUpdates = 0; 87 private int m_agentUpdates = 0;
87 88
@@ -259,6 +260,11 @@ namespace OpenSim.Region.Framework.Scenes
259 260
260 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; 261 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
261 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; 262 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
263
264 for (int i = 0; i < 21; i++)
265 {
266 lastReportedSimStats[i] = sb[i].StatValue;
267 }
262 268
263 SimStats simStats 269 SimStats simStats
264 = new SimStats( 270 = new SimStats(
@@ -438,6 +444,11 @@ namespace OpenSim.Region.Framework.Scenes
438 { 444 {
439 return lastReportedSimFPS; 445 return lastReportedSimFPS;
440 } 446 }
447
448 public float[] getLastReportedSimStats()
449 {
450 return lastReportedSimStats;
451 }
441 452
442 public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) 453 public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
443 { 454 {
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 91c25a6..c653e98 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
62 62
63 public void Initialise(IConfigSource config) 63 public void Initialise(IConfigSource config)
64 { 64 {
65 m_log.Info("[RegionReady] Initialising"); 65 //m_log.Info("[RegionReady] Initialising");
66 66
67 m_config = config.Configs["RegionReady"]; 67 m_config = config.Configs["RegionReady"];
68 if (m_config != null) 68 if (m_config != null)
@@ -74,8 +74,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
74 } 74 }
75 } 75 }
76 76
77 if (!m_enabled) 77// if (!m_enabled)
78 m_log.Info("[RegionReady] disabled."); 78// m_log.Info("[RegionReady] disabled.");
79 } 79 }
80 80
81 public void AddRegion(Scene scene) 81 public void AddRegion(Scene scene)
@@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
92 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; 92 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
93 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; 93 m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
94 94
95 m_log.InfoFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); 95 m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
96 } 96 }
97 97
98 public void RemoveRegion(Scene scene) 98 public void RemoveRegion(Scene scene)
@@ -120,7 +120,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
120 } 120 }
121 121
122 #endregion 122 #endregion
123
124 123
125 void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) 124 void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
126 { 125 {
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index e6b31ca..a0aba2a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -835,7 +835,7 @@ namespace OpenSim.Region.Physics.OdePlugin
835 // allows us to have different settings 835 // allows us to have different settings
836 836
837 // We only need to test p2 for 'jump crouch purposes' 837 // We only need to test p2 for 'jump crouch purposes'
838 if (p2 is OdeCharacter) 838 if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim)
839 { 839 {
840 // Testing if the collision is at the feet of the avatar 840 // Testing if the collision is at the feet of the avatar
841 841
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index 146ec66..9da818a 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
@@ -118,6 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
118 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); 118 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
119 } 119 }
120 } 120 }
121
121 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); 122 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
122 obj.LandData.Name = "NO LAND"; 123 obj.LandData.Name = "NO LAND";
123 return obj; 124 return obj;
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index f49aea8..ae148a9 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
96 UUID GetDetectID(int idx); 96 UUID GetDetectID(int idx);
97 void SaveState(string assembly); 97 void SaveState(string assembly);
98 void DestroyScriptInstance(); 98 void DestroyScriptInstance();
99 bool CanBeDeleted();
100 99
101 IScriptApi GetApi(string name); 100 IScriptApi GetApi(string name);
102 101
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 50b2fb5..8274fbf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; //for [DebuggerNonUserCode]
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using System.Text; 33using System.Text;
33using System.Threading; 34using System.Threading;
@@ -151,6 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
151 get { return m_ScriptEngine.World; } 152 get { return m_ScriptEngine.World; }
152 } 153 }
153 154
155 [DebuggerNonUserCode]
154 public void state(string newState) 156 public void state(string newState)
155 { 157 {
156 m_ScriptEngine.SetState(m_itemID, newState); 158 m_ScriptEngine.SetState(m_itemID, newState);
@@ -160,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
160 /// Reset the named script. The script must be present 162 /// Reset the named script. The script must be present
161 /// in the same prim. 163 /// in the same prim.
162 /// </summary> 164 /// </summary>
165 [DebuggerNonUserCode]
163 public void llResetScript() 166 public void llResetScript()
164 { 167 {
165 m_host.AddScriptLPS(1); 168 m_host.AddScriptLPS(1);
@@ -272,40 +275,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
272 protected UUID InventorySelf() 275 protected UUID InventorySelf()
273 { 276 {
274 UUID invItemID = new UUID(); 277 UUID invItemID = new UUID();
275 278 bool unlock = false;
276 lock (m_host.TaskInventory) 279 if (!m_host.TaskInventory.IsReadLockedByMe())
280 {
281 m_host.TaskInventory.LockItemsForRead(true);
282 unlock = true;
283 }
284 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
277 { 285 {
278 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 286 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
279 { 287 {
280 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) 288 invItemID = inv.Key;
281 { 289 break;
282 invItemID = inv.Key;
283 break;
284 }
285 } 290 }
286 } 291 }
287 292 if (unlock)
293 {
294 m_host.TaskInventory.LockItemsForRead(false);
295 }
288 return invItemID; 296 return invItemID;
289 } 297 }
290 298
291 protected UUID InventoryKey(string name, int type) 299 protected UUID InventoryKey(string name, int type)
292 { 300 {
293 m_host.AddScriptLPS(1); 301 m_host.AddScriptLPS(1);
294 302 m_host.TaskInventory.LockItemsForRead(true);
295 lock (m_host.TaskInventory) 303
304 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
296 { 305 {
297 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 306 if (inv.Value.Name == name)
298 { 307 {
299 if (inv.Value.Name == name) 308 m_host.TaskInventory.LockItemsForRead(false);
309
310 if (inv.Value.Type != type)
300 { 311 {
301 if (inv.Value.Type != type) 312 return UUID.Zero;
302 return UUID.Zero;
303
304 return inv.Value.AssetID;
305 } 313 }
314
315 return inv.Value.AssetID;
306 } 316 }
307 } 317 }
308 318
319 m_host.TaskInventory.LockItemsForRead(false);
309 return UUID.Zero; 320 return UUID.Zero;
310 } 321 }
311 322
@@ -313,17 +324,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
313 { 324 {
314 m_host.AddScriptLPS(1); 325 m_host.AddScriptLPS(1);
315 326
316 lock (m_host.TaskInventory) 327
328 m_host.TaskInventory.LockItemsForRead(true);
329
330 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
317 { 331 {
318 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 332 if (inv.Value.Name == name)
319 { 333 {
320 if (inv.Value.Name == name) 334 m_host.TaskInventory.LockItemsForRead(false);
321 { 335 return inv.Value.AssetID;
322 return inv.Value.AssetID;
323 }
324 } 336 }
325 } 337 }
326 338
339 m_host.TaskInventory.LockItemsForRead(false);
340
341
327 return UUID.Zero; 342 return UUID.Zero;
328 } 343 }
329 344
@@ -1987,6 +2002,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1987 2002
1988//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type 2003//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
1989// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; 2004// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
2005
2006 // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
2007 // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
2008 // It's perfectly okay when the object is not an active physical body though.
2009 // So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against
2010 // but only if the object is not physial and active. This is important for rotating doors.
2011 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
2012 // scene
2013 if (part.PhysActor != null && !part.PhysActor.IsPhysical)
2014 {
2015 part.ParentGroup.ResetChildPrimPhysicsPositions();
2016 }
1990 } 2017 }
1991 2018
1992 /// <summary> 2019 /// <summary>
@@ -2534,12 +2561,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2534 2561
2535 m_host.AddScriptLPS(1); 2562 m_host.AddScriptLPS(1);
2536 2563
2564 m_host.TaskInventory.LockItemsForRead(true);
2537 TaskInventoryItem item = m_host.TaskInventory[invItemID]; 2565 TaskInventoryItem item = m_host.TaskInventory[invItemID];
2538 2566 m_host.TaskInventory.LockItemsForRead(false);
2539 lock (m_host.TaskInventory)
2540 {
2541 item = m_host.TaskInventory[invItemID];
2542 }
2543 2567
2544 if (item.PermsGranter == UUID.Zero) 2568 if (item.PermsGranter == UUID.Zero)
2545 return 0; 2569 return 0;
@@ -2614,6 +2638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2614 if (dist > m_ScriptDistanceFactor * 10.0f) 2638 if (dist > m_ScriptDistanceFactor * 10.0f)
2615 return; 2639 return;
2616 2640
2641 //Clone is thread-safe
2617 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 2642 TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
2618 2643
2619 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) 2644 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
@@ -2747,13 +2772,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2747 { 2772 {
2748 TaskInventoryItem item; 2773 TaskInventoryItem item;
2749 2774
2750 lock (m_host.TaskInventory) 2775 m_host.TaskInventory.LockItemsForRead(true);
2776 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2751 { 2777 {
2752 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2778 m_host.TaskInventory.LockItemsForRead(false);
2753 return; 2779 return;
2754 else
2755 item = m_host.TaskInventory[InventorySelf()];
2756 } 2780 }
2781 else
2782 {
2783 item = m_host.TaskInventory[InventorySelf()];
2784 }
2785 m_host.TaskInventory.LockItemsForRead(false);
2757 2786
2758 if (item.PermsGranter != UUID.Zero) 2787 if (item.PermsGranter != UUID.Zero)
2759 { 2788 {
@@ -2775,13 +2804,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2775 { 2804 {
2776 TaskInventoryItem item; 2805 TaskInventoryItem item;
2777 2806
2807 m_host.TaskInventory.LockItemsForRead(true);
2778 lock (m_host.TaskInventory) 2808 lock (m_host.TaskInventory)
2779 { 2809 {
2810
2780 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2811 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2812 {
2813 m_host.TaskInventory.LockItemsForRead(false);
2781 return; 2814 return;
2815 }
2782 else 2816 else
2817 {
2783 item = m_host.TaskInventory[InventorySelf()]; 2818 item = m_host.TaskInventory[InventorySelf()];
2819 }
2784 } 2820 }
2821 m_host.TaskInventory.LockItemsForRead(false);
2785 2822
2786 m_host.AddScriptLPS(1); 2823 m_host.AddScriptLPS(1);
2787 2824
@@ -2818,14 +2855,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2818 2855
2819 TaskInventoryItem item; 2856 TaskInventoryItem item;
2820 2857
2821 lock (m_host.TaskInventory) 2858 m_host.TaskInventory.LockItemsForRead(true);
2859
2860 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2822 { 2861 {
2823 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2862 m_host.TaskInventory.LockItemsForRead(false);
2824 return; 2863 return;
2825 else 2864 }
2826 item = m_host.TaskInventory[InventorySelf()]; 2865 else
2866 {
2867 item = m_host.TaskInventory[InventorySelf()];
2827 } 2868 }
2828 2869
2870 m_host.TaskInventory.LockItemsForRead(false);
2871
2829 if (item.PermsGranter != m_host.OwnerID) 2872 if (item.PermsGranter != m_host.OwnerID)
2830 return; 2873 return;
2831 2874
@@ -2850,13 +2893,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2850 2893
2851 TaskInventoryItem item; 2894 TaskInventoryItem item;
2852 2895
2853 lock (m_host.TaskInventory) 2896 m_host.TaskInventory.LockItemsForRead(true);
2897
2898 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
2854 { 2899 {
2855 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 2900 m_host.TaskInventory.LockItemsForRead(false);
2856 return; 2901 return;
2857 else 2902 }
2858 item = m_host.TaskInventory[InventorySelf()]; 2903 else
2904 {
2905 item = m_host.TaskInventory[InventorySelf()];
2859 } 2906 }
2907 m_host.TaskInventory.LockItemsForRead(false);
2908
2860 2909
2861 if (item.PermsGranter != m_host.OwnerID) 2910 if (item.PermsGranter != m_host.OwnerID)
2862 return; 2911 return;
@@ -3080,14 +3129,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3080 3129
3081 TaskInventoryItem item; 3130 TaskInventoryItem item;
3082 3131
3083 lock (m_host.TaskInventory) 3132 m_host.TaskInventory.LockItemsForRead(true);
3133 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
3084 { 3134 {
3085 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 3135 m_host.TaskInventory.LockItemsForRead(false);
3086 return; 3136 return;
3087 else
3088 item = m_host.TaskInventory[InventorySelf()];
3089 } 3137 }
3090 3138 else
3139 {
3140 item = m_host.TaskInventory[InventorySelf()];
3141 }
3142 m_host.TaskInventory.LockItemsForRead(false);
3091 if (item.PermsGranter == UUID.Zero) 3143 if (item.PermsGranter == UUID.Zero)
3092 return; 3144 return;
3093 3145
@@ -3117,13 +3169,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3117 3169
3118 TaskInventoryItem item; 3170 TaskInventoryItem item;
3119 3171
3120 lock (m_host.TaskInventory) 3172 m_host.TaskInventory.LockItemsForRead(true);
3173 if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
3121 { 3174 {
3122 if (!m_host.TaskInventory.ContainsKey(InventorySelf())) 3175 m_host.TaskInventory.LockItemsForRead(false);
3123 return; 3176 return;
3124 else 3177 }
3125 item = m_host.TaskInventory[InventorySelf()]; 3178 else
3179 {
3180 item = m_host.TaskInventory[InventorySelf()];
3126 } 3181 }
3182 m_host.TaskInventory.LockItemsForRead(false);
3183
3127 3184
3128 if (item.PermsGranter == UUID.Zero) 3185 if (item.PermsGranter == UUID.Zero)
3129 return; 3186 return;
@@ -3196,10 +3253,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3196 3253
3197 TaskInventoryItem item; 3254 TaskInventoryItem item;
3198 3255
3199 lock (m_host.TaskInventory) 3256
3257 m_host.TaskInventory.LockItemsForRead(true);
3258 if (!m_host.TaskInventory.ContainsKey(invItemID))
3259 {
3260 m_host.TaskInventory.LockItemsForRead(false);
3261 return;
3262 }
3263 else
3200 { 3264 {
3201 item = m_host.TaskInventory[invItemID]; 3265 item = m_host.TaskInventory[invItemID];
3202 } 3266 }
3267 m_host.TaskInventory.LockItemsForRead(false);
3203 3268
3204 if (agentID == UUID.Zero || perm == 0) // Releasing permissions 3269 if (agentID == UUID.Zero || perm == 0) // Releasing permissions
3205 { 3270 {
@@ -3231,11 +3296,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3231 3296
3232 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 3297 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
3233 { 3298 {
3234 lock (m_host.TaskInventory) 3299 m_host.TaskInventory.LockItemsForWrite(true);
3235 { 3300 m_host.TaskInventory[invItemID].PermsGranter = agentID;
3236 m_host.TaskInventory[invItemID].PermsGranter = agentID; 3301 m_host.TaskInventory[invItemID].PermsMask = perm;
3237 m_host.TaskInventory[invItemID].PermsMask = perm; 3302 m_host.TaskInventory.LockItemsForWrite(false);
3238 }
3239 3303
3240 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 3304 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
3241 "run_time_permissions", new Object[] { 3305 "run_time_permissions", new Object[] {
@@ -3255,11 +3319,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3255 3319
3256 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 3320 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
3257 { 3321 {
3258 lock (m_host.TaskInventory) 3322 m_host.TaskInventory.LockItemsForWrite(true);
3259 { 3323 m_host.TaskInventory[invItemID].PermsGranter = agentID;
3260 m_host.TaskInventory[invItemID].PermsGranter = agentID; 3324 m_host.TaskInventory[invItemID].PermsMask = perm;
3261 m_host.TaskInventory[invItemID].PermsMask = perm; 3325 m_host.TaskInventory.LockItemsForWrite(false);
3262 }
3263 3326
3264 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 3327 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
3265 "run_time_permissions", new Object[] { 3328 "run_time_permissions", new Object[] {
@@ -3280,11 +3343,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3280 3343
3281 if (!m_waitingForScriptAnswer) 3344 if (!m_waitingForScriptAnswer)
3282 { 3345 {
3283 lock (m_host.TaskInventory) 3346 m_host.TaskInventory.LockItemsForWrite(true);
3284 { 3347 m_host.TaskInventory[invItemID].PermsGranter = agentID;
3285 m_host.TaskInventory[invItemID].PermsGranter = agentID; 3348 m_host.TaskInventory[invItemID].PermsMask = 0;
3286 m_host.TaskInventory[invItemID].PermsMask = 0; 3349 m_host.TaskInventory.LockItemsForWrite(false);
3287 }
3288 3350
3289 presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; 3351 presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
3290 m_waitingForScriptAnswer=true; 3352 m_waitingForScriptAnswer=true;
@@ -3319,10 +3381,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3319 if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) 3381 if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
3320 llReleaseControls(); 3382 llReleaseControls();
3321 3383
3322 lock (m_host.TaskInventory) 3384
3323 { 3385 m_host.TaskInventory.LockItemsForWrite(true);
3324 m_host.TaskInventory[invItemID].PermsMask = answer; 3386 m_host.TaskInventory[invItemID].PermsMask = answer;
3325 } 3387 m_host.TaskInventory.LockItemsForWrite(false);
3388
3326 3389
3327 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( 3390 m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
3328 "run_time_permissions", new Object[] { 3391 "run_time_permissions", new Object[] {
@@ -3334,16 +3397,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3334 { 3397 {
3335 m_host.AddScriptLPS(1); 3398 m_host.AddScriptLPS(1);
3336 3399
3337 lock (m_host.TaskInventory) 3400 m_host.TaskInventory.LockItemsForRead(true);
3401
3402 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3338 { 3403 {
3339 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3404 if (item.Type == 10 && item.ItemID == m_itemID)
3340 { 3405 {
3341 if (item.Type == 10 && item.ItemID == m_itemID) 3406 m_host.TaskInventory.LockItemsForRead(false);
3342 { 3407 return item.PermsGranter.ToString();
3343 return item.PermsGranter.ToString();
3344 }
3345 } 3408 }
3346 } 3409 }
3410 m_host.TaskInventory.LockItemsForRead(false);
3347 3411
3348 return UUID.Zero.ToString(); 3412 return UUID.Zero.ToString();
3349 } 3413 }
@@ -3352,19 +3416,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3352 { 3416 {
3353 m_host.AddScriptLPS(1); 3417 m_host.AddScriptLPS(1);
3354 3418
3355 lock (m_host.TaskInventory) 3419 m_host.TaskInventory.LockItemsForRead(true);
3420
3421 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3356 { 3422 {
3357 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3423 if (item.Type == 10 && item.ItemID == m_itemID)
3358 { 3424 {
3359 if (item.Type == 10 && item.ItemID == m_itemID) 3425 int perms = item.PermsMask;
3360 { 3426 if (m_automaticLinkPermission)
3361 int perms = item.PermsMask; 3427 perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
3362 if (m_automaticLinkPermission) 3428 m_host.TaskInventory.LockItemsForRead(false);
3363 perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 3429 return perms;
3364 return perms;
3365 }
3366 } 3430 }
3367 } 3431 }
3432 m_host.TaskInventory.LockItemsForRead(false);
3368 3433
3369 return 0; 3434 return 0;
3370 } 3435 }
@@ -3397,11 +3462,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3397 UUID invItemID = InventorySelf(); 3462 UUID invItemID = InventorySelf();
3398 3463
3399 TaskInventoryItem item; 3464 TaskInventoryItem item;
3400 lock (m_host.TaskInventory) 3465 m_host.TaskInventory.LockItemsForRead(true);
3401 { 3466 item = m_host.TaskInventory[invItemID];
3402 item = m_host.TaskInventory[invItemID]; 3467 m_host.TaskInventory.LockItemsForRead(false);
3403 } 3468
3404
3405 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3469 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3406 && !m_automaticLinkPermission) 3470 && !m_automaticLinkPermission)
3407 { 3471 {
@@ -3454,16 +3518,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3454 m_host.AddScriptLPS(1); 3518 m_host.AddScriptLPS(1);
3455 UUID invItemID = InventorySelf(); 3519 UUID invItemID = InventorySelf();
3456 3520
3457 lock (m_host.TaskInventory) 3521 m_host.TaskInventory.LockItemsForRead(true);
3458 {
3459 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3522 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3460 && !m_automaticLinkPermission) 3523 && !m_automaticLinkPermission)
3461 { 3524 {
3462 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3525 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
3526 m_host.TaskInventory.LockItemsForRead(false);
3463 return; 3527 return;
3464 } 3528 }
3465 } 3529 m_host.TaskInventory.LockItemsForRead(false);
3466 3530
3467 if (linknum < ScriptBaseClass.LINK_THIS) 3531 if (linknum < ScriptBaseClass.LINK_THIS)
3468 return; 3532 return;
3469 3533
@@ -3632,17 +3696,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3632 m_host.AddScriptLPS(1); 3696 m_host.AddScriptLPS(1);
3633 int count = 0; 3697 int count = 0;
3634 3698
3635 lock (m_host.TaskInventory) 3699 m_host.TaskInventory.LockItemsForRead(true);
3700 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3636 { 3701 {
3637 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3702 if (inv.Value.Type == type || type == -1)
3638 { 3703 {
3639 if (inv.Value.Type == type || type == -1) 3704 count = count + 1;
3640 {
3641 count = count + 1;
3642 }
3643 } 3705 }
3644 } 3706 }
3645 3707
3708 m_host.TaskInventory.LockItemsForRead(false);
3646 return count; 3709 return count;
3647 } 3710 }
3648 3711
@@ -3651,16 +3714,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3651 m_host.AddScriptLPS(1); 3714 m_host.AddScriptLPS(1);
3652 ArrayList keys = new ArrayList(); 3715 ArrayList keys = new ArrayList();
3653 3716
3654 lock (m_host.TaskInventory) 3717 m_host.TaskInventory.LockItemsForRead(true);
3718 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3655 { 3719 {
3656 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3720 if (inv.Value.Type == type || type == -1)
3657 { 3721 {
3658 if (inv.Value.Type == type || type == -1) 3722 keys.Add(inv.Value.Name);
3659 {
3660 keys.Add(inv.Value.Name);
3661 }
3662 } 3723 }
3663 } 3724 }
3725 m_host.TaskInventory.LockItemsForRead(false);
3664 3726
3665 if (keys.Count == 0) 3727 if (keys.Count == 0)
3666 { 3728 {
@@ -3697,20 +3759,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3697 } 3759 }
3698 3760
3699 // move the first object found with this inventory name 3761 // move the first object found with this inventory name
3700 lock (m_host.TaskInventory) 3762 m_host.TaskInventory.LockItemsForRead(true);
3763 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
3701 { 3764 {
3702 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 3765 if (inv.Value.Name == inventory)
3703 { 3766 {
3704 if (inv.Value.Name == inventory) 3767 found = true;
3705 { 3768 objId = inv.Key;
3706 found = true; 3769 assetType = inv.Value.Type;
3707 objId = inv.Key; 3770 objName = inv.Value.Name;
3708 assetType = inv.Value.Type; 3771 break;
3709 objName = inv.Value.Name;
3710 break;
3711 }
3712 } 3772 }
3713 } 3773 }
3774 m_host.TaskInventory.LockItemsForRead(false);
3714 3775
3715 if (!found) 3776 if (!found)
3716 { 3777 {
@@ -3755,24 +3816,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3755 ScriptSleep(3000); 3816 ScriptSleep(3000);
3756 } 3817 }
3757 3818
3819 [DebuggerNonUserCode]
3758 public void llRemoveInventory(string name) 3820 public void llRemoveInventory(string name)
3759 { 3821 {
3760 m_host.AddScriptLPS(1); 3822 m_host.AddScriptLPS(1);
3761 3823
3762 lock (m_host.TaskInventory) 3824 m_host.TaskInventory.LockItemsForRead(true);
3825 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3763 { 3826 {
3764 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3827 if (item.Name == name)
3765 { 3828 {
3766 if (item.Name == name) 3829 if (item.ItemID == m_itemID)
3767 { 3830 throw new ScriptDeleteException();
3768 if (item.ItemID == m_itemID) 3831 else
3769 throw new ScriptDeleteException(); 3832 m_host.Inventory.RemoveInventoryItem(item.ItemID);
3770 else 3833
3771 m_host.Inventory.RemoveInventoryItem(item.ItemID); 3834 m_host.TaskInventory.LockItemsForRead(false);
3772 return; 3835 return;
3773 }
3774 } 3836 }
3775 } 3837 }
3838 m_host.TaskInventory.LockItemsForRead(false);
3776 } 3839 }
3777 3840
3778 public void llSetText(string text, LSL_Vector color, double alpha) 3841 public void llSetText(string text, LSL_Vector color, double alpha)
@@ -3861,6 +3924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3861 { 3924 {
3862 m_host.AddScriptLPS(1); 3925 m_host.AddScriptLPS(1);
3863 3926
3927 //Clone is thread safe
3864 TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 3928 TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
3865 3929
3866 foreach (TaskInventoryItem item in itemDictionary.Values) 3930 foreach (TaskInventoryItem item in itemDictionary.Values)
@@ -3951,17 +4015,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3951 UUID soundId = UUID.Zero; 4015 UUID soundId = UUID.Zero;
3952 if (!UUID.TryParse(impact_sound, out soundId)) 4016 if (!UUID.TryParse(impact_sound, out soundId))
3953 { 4017 {
3954 lock (m_host.TaskInventory) 4018 m_host.TaskInventory.LockItemsForRead(true);
4019 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3955 { 4020 {
3956 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 4021 if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
3957 { 4022 {
3958 if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) 4023 soundId = item.AssetID;
3959 { 4024 break;
3960 soundId = item.AssetID;
3961 break;
3962 }
3963 } 4025 }
3964 } 4026 }
4027 m_host.TaskInventory.LockItemsForRead(false);
3965 } 4028 }
3966 m_host.CollisionSound = soundId; 4029 m_host.CollisionSound = soundId;
3967 m_host.CollisionSoundVolume = (float)impact_volume; 4030 m_host.CollisionSoundVolume = (float)impact_volume;
@@ -4007,6 +4070,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4007 UUID partItemID; 4070 UUID partItemID;
4008 foreach (SceneObjectPart part in parts) 4071 foreach (SceneObjectPart part in parts)
4009 { 4072 {
4073 //Clone is thread safe
4010 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); 4074 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
4011 4075
4012 foreach (TaskInventoryItem item in itemsDictionary.Values) 4076 foreach (TaskInventoryItem item in itemsDictionary.Values)
@@ -4214,17 +4278,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4214 4278
4215 m_host.AddScriptLPS(1); 4279 m_host.AddScriptLPS(1);
4216 4280
4217 lock (m_host.TaskInventory) 4281 m_host.TaskInventory.LockItemsForRead(true);
4282 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
4218 { 4283 {
4219 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 4284 if (item.Type == 10 && item.ItemID == m_itemID)
4220 { 4285 {
4221 if (item.Type == 10 && item.ItemID == m_itemID) 4286 result = item.Name!=null?item.Name:String.Empty;
4222 { 4287 break;
4223 result = item.Name!=null?item.Name:String.Empty;
4224 break;
4225 }
4226 } 4288 }
4227 } 4289 }
4290 m_host.TaskInventory.LockItemsForRead(false);
4228 4291
4229 return result; 4292 return result;
4230 } 4293 }
@@ -4482,23 +4545,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4482 { 4545 {
4483 m_host.AddScriptLPS(1); 4546 m_host.AddScriptLPS(1);
4484 4547
4485 lock (m_host.TaskInventory) 4548 m_host.TaskInventory.LockItemsForRead(true);
4549 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
4486 { 4550 {
4487 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 4551 if (inv.Value.Name == name)
4488 { 4552 {
4489 if (inv.Value.Name == name) 4553 if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
4490 { 4554 {
4491 if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) 4555 m_host.TaskInventory.LockItemsForRead(false);
4492 { 4556 return inv.Value.AssetID.ToString();
4493 return inv.Value.AssetID.ToString(); 4557 }
4494 } 4558 else
4495 else 4559 {
4496 { 4560 m_host.TaskInventory.LockItemsForRead(false);
4497 return UUID.Zero.ToString(); 4561 return UUID.Zero.ToString();
4498 }
4499 } 4562 }
4500 } 4563 }
4501 } 4564 }
4565 m_host.TaskInventory.LockItemsForRead(false);
4502 4566
4503 return UUID.Zero.ToString(); 4567 return UUID.Zero.ToString();
4504 } 4568 }
@@ -5776,6 +5840,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5776 m_host.AddScriptLPS(1); 5840 m_host.AddScriptLPS(1);
5777 return World.SimulatorFPS; 5841 return World.SimulatorFPS;
5778 } 5842 }
5843
5779 5844
5780 /* particle system rules should be coming into this routine as doubles, that is 5845 /* particle system rules should be coming into this routine as doubles, that is
5781 rule[0] should be an integer from this list and rule[1] should be the arg 5846 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -5993,14 +6058,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5993 6058
5994 protected UUID GetTaskInventoryItem(string name) 6059 protected UUID GetTaskInventoryItem(string name)
5995 { 6060 {
5996 lock (m_host.TaskInventory) 6061 m_host.TaskInventory.LockItemsForRead(true);
6062 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
5997 { 6063 {
5998 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 6064 if (inv.Value.Name == name)
5999 { 6065 {
6000 if (inv.Value.Name == name) 6066 m_host.TaskInventory.LockItemsForRead(false);
6001 return inv.Key; 6067 return inv.Key;
6002 } 6068 }
6003 } 6069 }
6070 m_host.TaskInventory.LockItemsForRead(false);
6004 6071
6005 return UUID.Zero; 6072 return UUID.Zero;
6006 } 6073 }
@@ -6311,22 +6378,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6311 } 6378 }
6312 6379
6313 // copy the first script found with this inventory name 6380 // copy the first script found with this inventory name
6314 lock (m_host.TaskInventory) 6381 m_host.TaskInventory.LockItemsForRead(true);
6382 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
6315 { 6383 {
6316 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 6384 if (inv.Value.Name == name)
6317 { 6385 {
6318 if (inv.Value.Name == name) 6386 // make sure the object is a script
6387 if (10 == inv.Value.Type)
6319 { 6388 {
6320 // make sure the object is a script 6389 found = true;
6321 if (10 == inv.Value.Type) 6390 srcId = inv.Key;
6322 { 6391 break;
6323 found = true;
6324 srcId = inv.Key;
6325 break;
6326 }
6327 } 6392 }
6328 } 6393 }
6329 } 6394 }
6395 m_host.TaskInventory.LockItemsForRead(false);
6330 6396
6331 if (!found) 6397 if (!found)
6332 { 6398 {
@@ -8129,28 +8195,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8129 { 8195 {
8130 m_host.AddScriptLPS(1); 8196 m_host.AddScriptLPS(1);
8131 8197
8132 lock (m_host.TaskInventory) 8198 m_host.TaskInventory.LockItemsForRead(true);
8199 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8133 { 8200 {
8134 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 8201 if (inv.Value.Name == item)
8135 { 8202 {
8136 if (inv.Value.Name == item) 8203 m_host.TaskInventory.LockItemsForRead(false);
8204 switch (mask)
8137 { 8205 {
8138 switch (mask) 8206 case 0:
8139 { 8207 return (int)inv.Value.BasePermissions;
8140 case 0: 8208 case 1:
8141 return (int)inv.Value.BasePermissions; 8209 return (int)inv.Value.CurrentPermissions;
8142 case 1: 8210 case 2:
8143 return (int)inv.Value.CurrentPermissions; 8211 return (int)inv.Value.GroupPermissions;
8144 case 2: 8212 case 3:
8145 return (int)inv.Value.GroupPermissions; 8213 return (int)inv.Value.EveryonePermissions;
8146 case 3: 8214 case 4:
8147 return (int)inv.Value.EveryonePermissions; 8215 return (int)inv.Value.NextPermissions;
8148 case 4:
8149 return (int)inv.Value.NextPermissions;
8150 }
8151 } 8216 }
8152 } 8217 }
8153 } 8218 }
8219 m_host.TaskInventory.LockItemsForRead(false);
8154 8220
8155 return -1; 8221 return -1;
8156 } 8222 }
@@ -8165,16 +8231,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8165 { 8231 {
8166 m_host.AddScriptLPS(1); 8232 m_host.AddScriptLPS(1);
8167 8233
8168 lock (m_host.TaskInventory) 8234 m_host.TaskInventory.LockItemsForRead(true);
8235 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8169 { 8236 {
8170 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 8237 if (inv.Value.Name == item)
8171 { 8238 {
8172 if (inv.Value.Name == item) 8239 m_host.TaskInventory.LockItemsForRead(false);
8173 { 8240 return inv.Value.CreatorID.ToString();
8174 return inv.Value.CreatorID.ToString();
8175 }
8176 } 8241 }
8177 } 8242 }
8243 m_host.TaskInventory.LockItemsForRead(false);
8178 8244
8179 llSay(0, "No item name '" + item + "'"); 8245 llSay(0, "No item name '" + item + "'");
8180 8246
@@ -8698,16 +8764,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8698 { 8764 {
8699 m_host.AddScriptLPS(1); 8765 m_host.AddScriptLPS(1);
8700 8766
8701 lock (m_host.TaskInventory) 8767 m_host.TaskInventory.LockItemsForRead(true);
8768 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8702 { 8769 {
8703 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 8770 if (inv.Value.Name == name)
8704 { 8771 {
8705 if (inv.Value.Name == name) 8772 m_host.TaskInventory.LockItemsForRead(false);
8706 { 8773 return inv.Value.Type;
8707 return inv.Value.Type;
8708 }
8709 } 8774 }
8710 } 8775 }
8776 m_host.TaskInventory.LockItemsForRead(false);
8711 8777
8712 return -1; 8778 return -1;
8713 } 8779 }
@@ -8738,17 +8804,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8738 if (invItemID == UUID.Zero) 8804 if (invItemID == UUID.Zero)
8739 return new LSL_Vector(); 8805 return new LSL_Vector();
8740 8806
8741 lock (m_host.TaskInventory) 8807 m_host.TaskInventory.LockItemsForRead(true);
8808 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
8742 { 8809 {
8743 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) 8810 m_host.TaskInventory.LockItemsForRead(false);
8744 return new LSL_Vector(); 8811 return new LSL_Vector();
8812 }
8745 8813
8746 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 8814 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
8747 { 8815 {
8748 ShoutError("No permissions to track the camera"); 8816 ShoutError("No permissions to track the camera");
8749 return new LSL_Vector(); 8817 m_host.TaskInventory.LockItemsForRead(false);
8750 } 8818 return new LSL_Vector();
8751 } 8819 }
8820 m_host.TaskInventory.LockItemsForRead(false);
8752 8821
8753 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 8822 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
8754 if (presence != null) 8823 if (presence != null)
@@ -8766,17 +8835,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8766 if (invItemID == UUID.Zero) 8835 if (invItemID == UUID.Zero)
8767 return new LSL_Rotation(); 8836 return new LSL_Rotation();
8768 8837
8769 lock (m_host.TaskInventory) 8838 m_host.TaskInventory.LockItemsForRead(true);
8839 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
8770 { 8840 {
8771 if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) 8841 m_host.TaskInventory.LockItemsForRead(false);
8772 return new LSL_Rotation(); 8842 return new LSL_Rotation();
8773 8843 }
8774 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 8844 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
8775 { 8845 {
8776 ShoutError("No permissions to track the camera"); 8846 ShoutError("No permissions to track the camera");
8777 return new LSL_Rotation(); 8847 m_host.TaskInventory.LockItemsForRead(false);
8778 } 8848 return new LSL_Rotation();
8779 } 8849 }
8850 m_host.TaskInventory.LockItemsForRead(false);
8780 8851
8781 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 8852 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
8782 if (presence != null) 8853 if (presence != null)
@@ -8926,14 +8997,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8926 if (objectID == UUID.Zero) return; 8997 if (objectID == UUID.Zero) return;
8927 8998
8928 UUID agentID; 8999 UUID agentID;
8929 lock (m_host.TaskInventory) 9000 m_host.TaskInventory.LockItemsForRead(true);
8930 { 9001 // we need the permission first, to know which avatar we want to set the camera for
8931 // we need the permission first, to know which avatar we want to set the camera for 9002 agentID = m_host.TaskInventory[invItemID].PermsGranter;
8932 agentID = m_host.TaskInventory[invItemID].PermsGranter;
8933 9003
8934 if (agentID == UUID.Zero) return; 9004 if (agentID == UUID.Zero)
8935 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; 9005 {
9006 m_host.TaskInventory.LockItemsForRead(false);
9007 return;
9008 }
9009 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
9010 {
9011 m_host.TaskInventory.LockItemsForRead(false);
9012 return;
8936 } 9013 }
9014 m_host.TaskInventory.LockItemsForRead(false);
8937 9015
8938 ScenePresence presence = World.GetScenePresence(agentID); 9016 ScenePresence presence = World.GetScenePresence(agentID);
8939 9017
@@ -8983,12 +9061,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8983 9061
8984 // we need the permission first, to know which avatar we want to clear the camera for 9062 // we need the permission first, to know which avatar we want to clear the camera for
8985 UUID agentID; 9063 UUID agentID;
8986 lock (m_host.TaskInventory) 9064 m_host.TaskInventory.LockItemsForRead(true);
9065 agentID = m_host.TaskInventory[invItemID].PermsGranter;
9066 if (agentID == UUID.Zero)
8987 { 9067 {
8988 agentID = m_host.TaskInventory[invItemID].PermsGranter; 9068 m_host.TaskInventory.LockItemsForRead(false);
8989 if (agentID == UUID.Zero) return; 9069 return;
8990 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
8991 } 9070 }
9071 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
9072 {
9073 m_host.TaskInventory.LockItemsForRead(false);
9074 return;
9075 }
9076 m_host.TaskInventory.LockItemsForRead(false);
8992 9077
8993 ScenePresence presence = World.GetScenePresence(agentID); 9078 ScenePresence presence = World.GetScenePresence(agentID);
8994 9079
@@ -9445,15 +9530,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9445 9530
9446 internal UUID ScriptByName(string name) 9531 internal UUID ScriptByName(string name)
9447 { 9532 {
9448 lock (m_host.TaskInventory) 9533 m_host.TaskInventory.LockItemsForRead(true);
9534
9535 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
9449 { 9536 {
9450 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 9537 if (item.Type == 10 && item.Name == name)
9451 { 9538 {
9452 if (item.Type == 10 && item.Name == name) 9539 m_host.TaskInventory.LockItemsForRead(false);
9453 return item.ItemID; 9540 return item.ItemID;
9454 } 9541 }
9455 } 9542 }
9456 9543
9544 m_host.TaskInventory.LockItemsForRead(false);
9545
9457 return UUID.Zero; 9546 return UUID.Zero;
9458 } 9547 }
9459 9548
@@ -9494,6 +9583,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9494 { 9583 {
9495 m_host.AddScriptLPS(1); 9584 m_host.AddScriptLPS(1);
9496 9585
9586 //Clone is thread safe
9497 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 9587 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
9498 9588
9499 UUID assetID = UUID.Zero; 9589 UUID assetID = UUID.Zero;
@@ -9556,6 +9646,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9556 { 9646 {
9557 m_host.AddScriptLPS(1); 9647 m_host.AddScriptLPS(1);
9558 9648
9649 //Clone is thread safe
9559 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); 9650 TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
9560 9651
9561 UUID assetID = UUID.Zero; 9652 UUID assetID = UUID.Zero;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7fdbac8..7f739b1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -636,13 +636,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
636 } 636 }
637 637
638 // Teleport functions 638 // Teleport functions
639 public void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 639 public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
640 { 640 {
641 // High because there is no security check. High griefer potential 641 // High because there is no security check. High griefer potential
642 // 642 //
643 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 643 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
644 644
645 ulong regionHandle = Util.UIntsToLong((regionX * (uint)Constants.RegionSize), (regionY * (uint)Constants.RegionSize)); 645 ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
646 646
647 m_host.AddScriptLPS(1); 647 m_host.AddScriptLPS(1);
648 UUID agentId = new UUID(); 648 UUID agentId = new UUID();
@@ -728,18 +728,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
728 if (target != null) 728 if (target != null)
729 { 729 {
730 UUID animID=UUID.Zero; 730 UUID animID=UUID.Zero;
731 lock (m_host.TaskInventory) 731 m_host.TaskInventory.LockItemsForRead(true);
732 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
732 { 733 {
733 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 734 if (inv.Value.Name == animation)
734 { 735 {
735 if (inv.Value.Name == animation) 736 if (inv.Value.Type == (int)AssetType.Animation)
736 { 737 animID = inv.Value.AssetID;
737 if (inv.Value.Type == (int)AssetType.Animation) 738 continue;
738 animID = inv.Value.AssetID;
739 continue;
740 }
741 } 739 }
742 } 740 }
741 m_host.TaskInventory.LockItemsForRead(false);
743 if (animID == UUID.Zero) 742 if (animID == UUID.Zero)
744 target.Animator.AddAnimation(animation, m_host.UUID); 743 target.Animator.AddAnimation(animation, m_host.UUID);
745 else 744 else
@@ -761,18 +760,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
761 if (target != null) 760 if (target != null)
762 { 761 {
763 UUID animID=UUID.Zero; 762 UUID animID=UUID.Zero;
764 lock (m_host.TaskInventory) 763 m_host.TaskInventory.LockItemsForRead(true);
764 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
765 { 765 {
766 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 766 if (inv.Value.Name == animation)
767 { 767 {
768 if (inv.Value.Name == animation) 768 if (inv.Value.Type == (int)AssetType.Animation)
769 { 769 animID = inv.Value.AssetID;
770 if (inv.Value.Type == (int)AssetType.Animation) 770 continue;
771 animID = inv.Value.AssetID;
772 continue;
773 }
774 } 771 }
775 } 772 }
773 m_host.TaskInventory.LockItemsForRead(false);
776 774
777 if (animID == UUID.Zero) 775 if (animID == UUID.Zero)
778 target.Animator.RemoveAnimation(animation); 776 target.Animator.RemoveAnimation(animation);
@@ -1541,6 +1539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1541 1539
1542 if (!UUID.TryParse(name, out assetID)) 1540 if (!UUID.TryParse(name, out assetID))
1543 { 1541 {
1542 m_host.TaskInventory.LockItemsForRead(true);
1544 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1543 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1545 { 1544 {
1546 if (item.Type == 7 && item.Name == name) 1545 if (item.Type == 7 && item.Name == name)
@@ -1548,6 +1547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1548 assetID = item.AssetID; 1547 assetID = item.AssetID;
1549 } 1548 }
1550 } 1549 }
1550 m_host.TaskInventory.LockItemsForRead(false);
1551 } 1551 }
1552 1552
1553 if (assetID == UUID.Zero) 1553 if (assetID == UUID.Zero)
@@ -1594,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1594 1594
1595 if (!UUID.TryParse(name, out assetID)) 1595 if (!UUID.TryParse(name, out assetID))
1596 { 1596 {
1597 m_host.TaskInventory.LockItemsForRead(true);
1597 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1598 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1598 { 1599 {
1599 if (item.Type == 7 && item.Name == name) 1600 if (item.Type == 7 && item.Name == name)
@@ -1601,6 +1602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1601 assetID = item.AssetID; 1602 assetID = item.AssetID;
1602 } 1603 }
1603 } 1604 }
1605 m_host.TaskInventory.LockItemsForRead(false);
1604 } 1606 }
1605 1607
1606 if (assetID == UUID.Zero) 1608 if (assetID == UUID.Zero)
@@ -1651,6 +1653,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1651 1653
1652 if (!UUID.TryParse(name, out assetID)) 1654 if (!UUID.TryParse(name, out assetID))
1653 { 1655 {
1656 m_host.TaskInventory.LockItemsForRead(true);
1654 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 1657 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
1655 { 1658 {
1656 if (item.Type == 7 && item.Name == name) 1659 if (item.Type == 7 && item.Name == name)
@@ -1658,6 +1661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1658 assetID = item.AssetID; 1661 assetID = item.AssetID;
1659 } 1662 }
1660 } 1663 }
1664 m_host.TaskInventory.LockItemsForRead(false);
1661 } 1665 }
1662 1666
1663 if (assetID == UUID.Zero) 1667 if (assetID == UUID.Zero)
@@ -1948,5 +1952,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1948 1952
1949 return key.ToString(); 1953 return key.ToString();
1950 } 1954 }
1955
1956 /// <summary>
1957 /// Return information regarding various simulator statistics (sim fps, physics fps, time
1958 /// dilation, total number of prims, total number of active scripts, script lps, various
1959 /// timing data, packets in/out, etc. Basically much the information that's shown in the
1960 /// client's Statistics Bar (Ctrl-Shift-1)
1961 /// </summary>
1962 /// <returns>List of floats</returns>
1963 public LSL_List osGetRegionStats()
1964 {
1965 CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats");
1966 m_host.AddScriptLPS(1);
1967 LSL_List ret = new LSL_List();
1968 float[] stats = World.SimulatorStats;
1969
1970 for (int i = 0; i < 21; i++)
1971 {
1972 ret.Add(new LSL_Float( stats[i] ));
1973 }
1974 return ret;
1975 }
1976
1951 } 1977 }
1952} 1978}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 2a403bf..0b0dc00 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
83 83
84 // Teleport commands 84 // Teleport commands
85 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 85 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
86 void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 86 void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
87 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 87 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
88 88
89 // Animation commands 89 // Animation commands
@@ -162,5 +162,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
162 162
163 key osGetMapTexture(); 163 key osGetMapTexture();
164 key osGetRegionMapTexture(string regionName); 164 key osGetRegionMapTexture(string regionName);
165 LSL_List osGetRegionStats();
165 } 166 }
166} 167}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
index 7f67599..15e0408 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; //for [DebuggerNonUserCode]
30using System.Reflection; 31using System.Reflection;
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using OpenSim.Region.ScriptEngine.Shared; 33using OpenSim.Region.ScriptEngine.Shared;
@@ -131,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
131 return (eventFlags); 132 return (eventFlags);
132 } 133 }
133 134
135 [DebuggerNonUserCode]
134 public void ExecuteEvent(string state, string FunctionName, object[] args) 136 public void ExecuteEvent(string state, string FunctionName, object[] args)
135 { 137 {
136 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. 138 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 753ca55..acff8fb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -515,6 +515,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
515 public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; 515 public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f";
516 public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; 516 public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
517 public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; 517 public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
518
519 // Constants for osGetRegionStats
520 public const int STATS_TIME_DILATION = 0;
521 public const int STATS_SIM_FPS = 1;
522 public const int STATS_PHYSICS_FPS = 2;
523 public const int STATS_AGENT_UPDATES = 3;
524 public const int STATS_ROOT_AGENTS = 4;
525 public const int STATS_CHILD_AGENTS = 5;
526 public const int STATS_TOTAL_PRIMS = 6;
527 public const int STATS_ACTIVE_PRIMS = 7;
528 public const int STATS_FRAME_MS = 8;
529 public const int STATS_NET_MS = 9;
530 public const int STATS_PHYSICS_MS = 10;
531 public const int STATS_IMAGE_MS = 11;
532 public const int STATS_OTHER_MS = 12;
533 public const int STATS_IN_PACKETS_PER_SECOND = 13;
534 public const int STATS_OUT_PACKETS_PER_SECOND = 14;
535 public const int STATS_UNACKED_BYTES = 15;
536 public const int STATS_AGENT_MS = 16;
537 public const int STATS_PENDING_DOWNLOADS = 17;
538 public const int STATS_PENDING_UPLOADS = 18;
539 public const int STATS_ACTIVE_SCRIPTS = 19;
540 public const int STATS_SCRIPT_LPS = 20;
518 541
519 } 542 }
520} 543}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 4928e90..519463e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -201,9 +201,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
201 m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); 201 m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
202 } 202 }
203 203
204 public void osTeleportAgent(string agent, long regionX, long regionY, vector position, vector lookat) 204 public void osTeleportAgent(string agent, int regionX, int regionY, vector position, vector lookat)
205 { 205 {
206 m_OSSL_Functions.osTeleportAgent(agent, (uint) regionX, (uint) regionY, position, lookat); 206 m_OSSL_Functions.osTeleportAgent(agent, regionX, regionY, position, lookat);
207 } 207 }
208 208
209 public void osTeleportAgent(string agent, vector position, vector lookat) 209 public void osTeleportAgent(string agent, vector position, vector lookat)
@@ -632,5 +632,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
632 { 632 {
633 return m_OSSL_Functions.osGetRegionMapTexture(regionName); 633 return m_OSSL_Functions.osGetRegionMapTexture(regionName);
634 } 634 }
635
636 public LSL_List osGetRegionStats()
637 {
638 return m_OSSL_Functions.osGetRegionStats();
639 }
635 } 640 }
636} 641}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
index 121159c..a44abb0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
@@ -33,6 +33,7 @@ using System.Threading;
33using System.Reflection; 33using System.Reflection;
34using System.Collections; 34using System.Collections;
35using System.Collections.Generic; 35using System.Collections.Generic;
36using System.Diagnostics; //for [DebuggerNonUserCode]
36using OpenSim.Region.ScriptEngine.Interfaces; 37using OpenSim.Region.ScriptEngine.Interfaces;
37using OpenSim.Region.ScriptEngine.Shared; 38using OpenSim.Region.ScriptEngine.Shared;
38using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; 39using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
90 return (int)m_Executor.GetStateEventFlags(state); 91 return (int)m_Executor.GetStateEventFlags(state);
91 } 92 }
92 93
94 [DebuggerNonUserCode]
93 public void ExecuteEvent(string state, string FunctionName, object[] args) 95 public void ExecuteEvent(string state, string FunctionName, object[] args)
94 { 96 {
95 m_Executor.ExecuteEvent(state, FunctionName, args); 97 m_Executor.ExecuteEvent(state, FunctionName, args);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 41b5d49..8333a27 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Diagnostics; //for [DebuggerNonUserCode]
30using System.Runtime.Remoting; 31using System.Runtime.Remoting;
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
32using System.Threading; 33using System.Threading;
@@ -237,13 +238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
237 238
238 if (part != null) 239 if (part != null)
239 { 240 {
240 lock (part.TaskInventory) 241 part.TaskInventory.LockItemsForRead(true);
242 if (part.TaskInventory.ContainsKey(m_ItemID))
241 { 243 {
242 if (part.TaskInventory.ContainsKey(m_ItemID)) 244 m_thisScriptTask = part.TaskInventory[m_ItemID];
243 {
244 m_thisScriptTask = part.TaskInventory[m_ItemID];
245 }
246 } 245 }
246 part.TaskInventory.LockItemsForRead(false);
247 } 247 }
248 248
249 ApiManager am = new ApiManager(); 249 ApiManager am = new ApiManager();
@@ -428,14 +428,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
428 { 428 {
429 int permsMask; 429 int permsMask;
430 UUID permsGranter; 430 UUID permsGranter;
431 lock (part.TaskInventory) 431 part.TaskInventory.LockItemsForRead(true);
432 if (!part.TaskInventory.ContainsKey(m_ItemID))
432 { 433 {
433 if (!part.TaskInventory.ContainsKey(m_ItemID)) 434 part.TaskInventory.LockItemsForRead(false);
434 return; 435 return;
435
436 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
437 permsMask = part.TaskInventory[m_ItemID].PermsMask;
438 } 436 }
437 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
438 permsMask = part.TaskInventory[m_ItemID].PermsMask;
439 part.TaskInventory.LockItemsForRead(false);
439 440
440 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 441 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
441 { 442 {
@@ -544,6 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
544 return true; 545 return true;
545 } 546 }
546 547
548 [DebuggerNonUserCode] //Prevents the debugger from farting in this function
547 public void SetState(string state) 549 public void SetState(string state)
548 { 550 {
549 if (state == State) 551 if (state == State)
@@ -555,7 +557,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
555 new DetectParams[0])); 557 new DetectParams[0]));
556 PostEvent(new EventParams("state_entry", new Object[0], 558 PostEvent(new EventParams("state_entry", new Object[0],
557 new DetectParams[0])); 559 new DetectParams[0]));
558 560
559 throw new EventAbortException(); 561 throw new EventAbortException();
560 } 562 }
561 563
@@ -638,154 +640,158 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
638 /// <returns></returns> 640 /// <returns></returns>
639 public object EventProcessor() 641 public object EventProcessor()
640 { 642 {
643
644 EventParams data = null;
645
646 lock (m_EventQueue)
647 {
641 lock (m_Script) 648 lock (m_Script)
642 { 649 {
643 EventParams data = null; 650 data = (EventParams) m_EventQueue.Dequeue();
644 651 if (data == null) // Shouldn't happen
645 lock (m_EventQueue)
646 { 652 {
647 data = (EventParams) m_EventQueue.Dequeue(); 653 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
648 if (data == null) // Shouldn't happen
649 { 654 {
650 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) 655 m_CurrentResult = m_Engine.QueueEventHandler(this);
651 {
652 m_CurrentResult = m_Engine.QueueEventHandler(this);
653 }
654 else
655 {
656 m_CurrentResult = null;
657 }
658 return 0;
659 } 656 }
660 657 else
661 if (data.EventName == "timer")
662 m_TimerQueued = false;
663 if (data.EventName == "control")
664 { 658 {
665 if (m_ControlEventsInQueue > 0) 659 m_CurrentResult = null;
666 m_ControlEventsInQueue--;
667 } 660 }
668 if (data.EventName == "collision") 661 return 0;
669 m_CollisionInQueue = false;
670 } 662 }
671
672 //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
673
674 m_DetectParams = data.DetectParams;
675 663
676 if (data.EventName == "state") // Hardcoded state change 664 if (data.EventName == "timer")
665 m_TimerQueued = false;
666 if (data.EventName == "control")
677 { 667 {
678 // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}", 668 if (m_ControlEventsInQueue > 0)
679 // m_PrimName, m_ScriptName, data.Params[0].ToString()); 669 m_ControlEventsInQueue--;
680 m_State=data.Params[0].ToString(); 670 }
681 AsyncCommandManager.RemoveScript(m_Engine, 671 if (data.EventName == "collision")
682 m_LocalID, m_ItemID); 672 m_CollisionInQueue = false;
673 }
674 }
675 lock(m_Script)
676 {
677
678 //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
683 679
684 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 680 m_DetectParams = data.DetectParams;
685 m_LocalID); 681
686 if (part != null) 682 if (data.EventName == "state") // Hardcoded state change
687 { 683 {
688 part.SetScriptEvents(m_ItemID, 684// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
689 (int)m_Script.GetStateEventFlags(State)); 685// m_PrimName, m_ScriptName, data.Params[0].ToString());
690 } 686 m_State=data.Params[0].ToString();
687 AsyncCommandManager.RemoveScript(m_Engine,
688 m_LocalID, m_ItemID);
689
690 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
691 m_LocalID);
692 if (part != null)
693 {
694 part.SetScriptEvents(m_ItemID,
695 (int)m_Script.GetStateEventFlags(State));
691 } 696 }
692 else 697 }
698 else
699 {
700 if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
701 data.EventName == "control") // Don't freeze avies!
693 { 702 {
694 if (m_Engine.World.PipeEventsForScript(m_LocalID) || 703 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
695 data.EventName == "control") // Don't freeze avies! 704 m_LocalID);
696 { 705 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
697 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 706 // m_PrimName, m_ScriptName, data.EventName, m_State);
698 m_LocalID);
699 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
700 // m_PrimName, m_ScriptName, data.EventName, m_State);
701 707
702 try 708 try
703 { 709 {
704 m_CurrentEvent = data.EventName; 710 m_CurrentEvent = data.EventName;
705 m_EventStart = DateTime.Now; 711 m_EventStart = DateTime.Now;
706 m_InEvent = true; 712 m_InEvent = true;
707 713
708 m_Script.ExecuteEvent(State, data.EventName, data.Params); 714 m_Script.ExecuteEvent(State, data.EventName, data.Params);
709 715
710 m_InEvent = false; 716 m_InEvent = false;
711 m_CurrentEvent = String.Empty; 717 m_CurrentEvent = String.Empty;
712 718
713 if (m_SaveState) 719 if (m_SaveState)
714 { 720 {
715 // This will be the very first event we deliver 721 // This will be the very first event we deliver
716 // (state_entry) in default state 722 // (state_entry) in default state
717 // 723 //
718 724
719 SaveState(m_Assembly); 725 SaveState(m_Assembly);
720 726
721 m_SaveState = false; 727 m_SaveState = false;
722 }
723 } 728 }
724 catch (Exception e) 729 }
725 { 730 catch (Exception e)
726 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); 731 {
727 m_InEvent = false; 732 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
728 m_CurrentEvent = String.Empty; 733 m_InEvent = false;
734 m_CurrentEvent = String.Empty;
729 735
730 if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException)) 736 if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
731 { 737 {
732 try 738 try
733 {
734 // DISPLAY ERROR INWORLD
735 string text = FormatException(e);
736
737 if (text.Length > 1000)
738 text = text.Substring(0, 1000);
739 m_Engine.World.SimChat(Utils.StringToBytes(text),
740 ChatTypeEnum.DebugChannel, 2147483647,
741 part.AbsolutePosition,
742 part.Name, part.UUID, false);
743 }
744 catch (Exception)
745 {
746 }
747 // catch (Exception e2) // LEGIT: User Scripting
748 // {
749 // m_log.Error("[SCRIPT]: "+
750 // "Error displaying error in-world: " +
751 // e2.ToString());
752 // m_log.Error("[SCRIPT]: " +
753 // "Errormessage: Error compiling script:\r\n" +
754 // e.ToString());
755 // }
756 }
757 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
758 { 739 {
759 m_InSelfDelete = true; 740 // DISPLAY ERROR INWORLD
760 if (part != null && part.ParentGroup != null) 741 string text = FormatException(e);
761 m_Engine.World.DeleteSceneObject(part.ParentGroup, false); 742
743 if (text.Length > 1000)
744 text = text.Substring(0, 1000);
745 m_Engine.World.SimChat(Utils.StringToBytes(text),
746 ChatTypeEnum.DebugChannel, 2147483647,
747 part.AbsolutePosition,
748 part.Name, part.UUID, false);
762 } 749 }
763 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) 750 catch (Exception)
764 { 751 {
765 m_InSelfDelete = true;
766 if (part != null && part.ParentGroup != null)
767 part.Inventory.RemoveInventoryItem(m_ItemID);
768 } 752 }
753 // catch (Exception e2) // LEGIT: User Scripting
754 // {
755 // m_log.Error("[SCRIPT]: "+
756 // "Error displaying error in-world: " +
757 // e2.ToString());
758 // m_log.Error("[SCRIPT]: " +
759 // "Errormessage: Error compiling script:\r\n" +
760 // e.ToString());
761 // }
762 }
763 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
764 {
765 m_InSelfDelete = true;
766 if (part != null && part.ParentGroup != null)
767 m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
768 }
769 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
770 {
771 m_InSelfDelete = true;
772 if (part != null && part.ParentGroup != null)
773 part.Inventory.RemoveInventoryItem(m_ItemID);
769 } 774 }
770 } 775 }
771 } 776 }
777 }
772 778
773 lock (m_EventQueue) 779 lock (m_EventQueue)
780 {
781 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
774 { 782 {
775 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) 783 m_CurrentResult = m_Engine.QueueEventHandler(this);
776 {
777 m_CurrentResult = m_Engine.QueueEventHandler(this);
778 }
779 else
780 {
781 m_CurrentResult = null;
782 }
783 } 784 }
785 else
786 {
787 m_CurrentResult = null;
788 }
789 }
784 790
785 m_DetectParams = null; 791 m_DetectParams = null;
786 792
787 return 0; 793 return 0;
788 } 794 }
789 } 795 }
790 796
791 public int EventTime() 797 public int EventTime()
@@ -824,6 +830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
824 new Object[0], new DetectParams[0])); 830 new Object[0], new DetectParams[0]));
825 } 831 }
826 832
833 [DebuggerNonUserCode] //Stops the VS debugger from farting in this function
827 public void ApiResetScript() 834 public void ApiResetScript()
828 { 835 {
829 // bool running = Running; 836 // bool running = Running;
@@ -1011,10 +1018,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1011 { 1018 {
1012 get { return m_RegionID; } 1019 get { return m_RegionID; }
1013 } 1020 }
1014
1015 public bool CanBeDeleted()
1016 {
1017 return true;
1018 }
1019 } 1021 }
1020} 1022}
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 3f38bb6..1fc31c5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -429,6 +429,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
429 } 429 }
430 } 430 }
431 431
432 public int Size
433 {
434 get { return 0; }
435 }
436
432 public object[] Data 437 public object[] Data
433 { 438 {
434 get { 439 get {
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a60c0ba..2fc2ea1 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Threading; 30using System.Threading;
31using System.Collections; 31using System.Collections;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Diagnostics; //for [DebuggerNonUserCode]
33using System.Security; 34using System.Security;
34using System.Security.Policy; 35using System.Security.Policy;
35using System.Reflection; 36using System.Reflection;
@@ -1119,6 +1120,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1119 return false; 1120 return false;
1120 } 1121 }
1121 1122
1123 [DebuggerNonUserCode]
1122 public void ApiResetScript(UUID itemID) 1124 public void ApiResetScript(UUID itemID)
1123 { 1125 {
1124 IScriptInstance instance = GetInstance(itemID); 1126 IScriptInstance instance = GetInstance(itemID);
@@ -1170,6 +1172,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1170 return UUID.Zero; 1172 return UUID.Zero;
1171 } 1173 }
1172 1174
1175 [DebuggerNonUserCode]
1173 public void SetState(UUID itemID, string newState) 1176 public void SetState(UUID itemID, string newState)
1174 { 1177 {
1175 IScriptInstance instance = GetInstance(itemID); 1178 IScriptInstance instance = GetInstance(itemID);
@@ -1245,34 +1248,219 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1245 } 1248 }
1246 } 1249 }
1247 1250
1248 public string GetAssemblyName(UUID itemID)
1249 {
1250 IScriptInstance instance = GetInstance(itemID);
1251 if (instance == null)
1252 return "";
1253 return instance.GetAssemblyName();
1254 }
1255
1256 public string GetXMLState(UUID itemID) 1251 public string GetXMLState(UUID itemID)
1257 { 1252 {
1258 IScriptInstance instance = GetInstance(itemID); 1253 IScriptInstance instance = GetInstance(itemID);
1259 if (instance == null) 1254 if (instance == null)
1260 return ""; 1255 return "";
1261 return instance.GetXMLState(); 1256 string xml = instance.GetXMLState();
1262 }
1263 1257
1264 public bool CanBeDeleted(UUID itemID) 1258 XmlDocument sdoc = new XmlDocument();
1265 { 1259 sdoc.LoadXml(xml);
1266 IScriptInstance instance = GetInstance(itemID); 1260 XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
1267 if (instance == null) 1261 XmlNode rootNode = rootL[0];
1268 return true; 1262
1263 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
1264 XmlDocument doc = new XmlDocument();
1265 XmlElement stateData = doc.CreateElement("", "State", "");
1266 XmlAttribute stateID = doc.CreateAttribute("", "UUID", "");
1267 stateID.Value = itemID.ToString();
1268 stateData.Attributes.Append(stateID);
1269 XmlAttribute assetID = doc.CreateAttribute("", "Asset", "");
1270 assetID.Value = instance.AssetID.ToString();
1271 stateData.Attributes.Append(assetID);
1272 doc.AppendChild(stateData);
1273
1274 // Add <ScriptState>...</ScriptState>
1275 XmlNode xmlstate = doc.ImportNode(rootNode, true);
1276 stateData.AppendChild(xmlstate);
1277
1278 string assemName = instance.GetAssemblyName();
1279
1280 string fn = Path.GetFileName(assemName);
1281
1282 string assem = String.Empty;
1283
1284 if (File.Exists(assemName + ".text"))
1285 {
1286 FileInfo tfi = new FileInfo(assemName + ".text");
1287
1288 if (tfi != null)
1289 {
1290 Byte[] tdata = new Byte[tfi.Length];
1291
1292 try
1293 {
1294 FileStream tfs = File.Open(assemName + ".text",
1295 FileMode.Open, FileAccess.Read);
1296 tfs.Read(tdata, 0, tdata.Length);
1297 tfs.Close();
1298
1299 assem = new System.Text.ASCIIEncoding().GetString(tdata);
1300 }
1301 catch (Exception e)
1302 {
1303 m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message);
1304 }
1305 }
1306 }
1307 else
1308 {
1309 FileInfo fi = new FileInfo(assemName);
1310
1311 if (fi != null)
1312 {
1313 Byte[] data = new Byte[fi.Length];
1314
1315 try
1316 {
1317 FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read);
1318 fs.Read(data, 0, data.Length);
1319 fs.Close();
1320
1321 assem = System.Convert.ToBase64String(data);
1322 }
1323 catch (Exception e)
1324 {
1325 m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
1326 }
1327
1328 }
1329 }
1330
1331 string map = String.Empty;
1332
1333 if (File.Exists(fn + ".map"))
1334 {
1335 FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
1336 StreamReader msr = new StreamReader(mfs);
1337
1338 map = msr.ReadToEnd();
1339
1340 msr.Close();
1341 mfs.Close();
1342 }
1343
1344 XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
1345 XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
1346
1347 assemblyName.Value = fn;
1348 assemblyData.Attributes.Append(assemblyName);
1349
1350 assemblyData.InnerText = assem;
1351
1352 stateData.AppendChild(assemblyData);
1269 1353
1270 return instance.CanBeDeleted(); 1354 XmlElement mapData = doc.CreateElement("", "LineMap", "");
1355 XmlAttribute mapName = doc.CreateAttribute("", "Filename", "");
1356
1357 mapName.Value = fn + ".map";
1358 mapData.Attributes.Append(mapName);
1359
1360 mapData.InnerText = map;
1361
1362 stateData.AppendChild(mapData);
1363 return doc.InnerXml;
1271 } 1364 }
1272 1365
1273 private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) 1366 private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
1274 { 1367 {
1275 return false; 1368 return false;
1276 } 1369 }
1370
1371 public void SetXMLState(UUID itemID, string xml)
1372 {
1373 if (xml == String.Empty)
1374 return;
1375
1376 XmlDocument doc = new XmlDocument();
1377
1378 try
1379 {
1380 doc.LoadXml(xml);
1381 }
1382 catch (Exception)
1383 {
1384 m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
1385 return;
1386 }
1387
1388 XmlNodeList rootL = doc.GetElementsByTagName("State");
1389 if (rootL.Count < 1)
1390 return;
1391
1392 XmlElement rootE = (XmlElement)rootL[0];
1393
1394 if (rootE.GetAttribute("UUID") != itemID.ToString())
1395 return;
1396
1397 string assetID = rootE.GetAttribute("Asset");
1398
1399 XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
1400
1401 if (stateL.Count != 1)
1402 return;
1403
1404 XmlElement stateE = (XmlElement)stateL[0];
1405
1406 if (World.m_trustBinaries)
1407 {
1408 XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
1409
1410 if (assemL.Count != 1)
1411 return;
1412
1413 XmlElement assemE = (XmlElement)assemL[0];
1414
1415 string fn = assemE.GetAttribute("Filename");
1416 string base64 = assemE.InnerText;
1417
1418 string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1419 path = Path.Combine(path, fn);
1420
1421 if (!File.Exists(path))
1422 {
1423 Byte[] filedata = Convert.FromBase64String(base64);
1424
1425 FileStream fs = File.Create(path);
1426 fs.Write(filedata, 0, filedata.Length);
1427 fs.Close();
1428
1429 fs = File.Create(path + ".text");
1430 StreamWriter sw = new StreamWriter(fs);
1431
1432 sw.Write(base64);
1433
1434 sw.Close();
1435 fs.Close();
1436 }
1437 }
1438
1439 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1440 statepath = Path.Combine(statepath, itemID.ToString() + ".state");
1441
1442 FileStream sfs = File.Create(statepath);
1443 StreamWriter ssw = new StreamWriter(sfs);
1444
1445 ssw.Write(stateE.OuterXml);
1446
1447 ssw.Close();
1448 sfs.Close();
1449
1450 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1451
1452 XmlElement mapE = (XmlElement)mapL[0];
1453
1454 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1455 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1456
1457 FileStream mfs = File.Create(mappath);
1458 StreamWriter msw = new StreamWriter(mfs);
1459
1460 msw.Write(mapE.InnerText);
1461
1462 msw.Close();
1463 mfs.Close();
1464 }
1277 } 1465 }
1278} 1466}
diff --git a/OpenSim/Tools/Compiler/Program.cs b/OpenSim/Tools/Compiler/Program.cs
index b18e029..249e18b 100644
--- a/OpenSim/Tools/Compiler/Program.cs
+++ b/OpenSim/Tools/Compiler/Program.cs
@@ -36,7 +36,8 @@ namespace OpenSim.Tools.LSL.Compiler
36{ 36{
37 class Program 37 class Program
38 { 38 {
39 private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; 39// Commented out because generated warning since m_positionMap could never be anything other than null
40// private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap;
40 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); 41 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
41 42
42 static void Main(string[] args) 43 static void Main(string[] args)
@@ -210,16 +211,16 @@ namespace OpenSim.Tools.LSL.Compiler
210 sfs.Close(); 211 sfs.Close();
211 212
212 string posmap = String.Empty; 213 string posmap = String.Empty;
213 if (m_positionMap != null) 214// if (m_positionMap != null)
214 { 215// {
215 foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in m_positionMap) 216// foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in m_positionMap)
216 { 217// {
217 KeyValuePair<int, int> k = kvp.Key; 218// KeyValuePair<int, int> k = kvp.Key;
218 KeyValuePair<int, int> v = kvp.Value; 219// KeyValuePair<int, int> v = kvp.Value;
219 posmap += String.Format("{0},{1},{2},{3}\n", 220// posmap += String.Format("{0},{1},{2},{3}\n",
220 k.Key, k.Value, v.Key, v.Value); 221// k.Key, k.Value, v.Key, v.Value);
221 } 222// }
222 } 223// }
223 224
224 buf = enc.GetBytes(posmap); 225 buf = enc.GetBytes(posmap);
225 226
@@ -253,7 +254,8 @@ namespace OpenSim.Tools.LSL.Compiler
253 254
254 private static KeyValuePair<int, int> FindErrorPosition(int line, int col) 255 private static KeyValuePair<int, int> FindErrorPosition(int line, int col)
255 { 256 {
256 return FindErrorPosition(line, col, m_positionMap); 257 //return FindErrorPosition(line, col, m_positionMap);
258 return FindErrorPosition(line, col, null);
257 } 259 }
258 260
259 private class kvpSorter : IComparer<KeyValuePair<int,int>> 261 private class kvpSorter : IComparer<KeyValuePair<int,int>>
diff --git a/bin/NDesk.Options.dll b/bin/NDesk.Options.dll
new file mode 100644
index 0000000..df45878
--- /dev/null
+++ b/bin/NDesk.Options.dll
Binary files differ
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 116a8fd..f9d9ca6 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -454,6 +454,9 @@
454 454
455 ; Distance in meters that shouts should travel. Default is 100m 455 ; Distance in meters that shouts should travel. Default is 100m
456 shout_distance = 100 456 shout_distance = 100
457
458 ; Append a prefix to the god avatar names appearing in chat whilst in god mode
459 ; admin_prefix = "@"
457 460
458 461
459[Messaging] 462[Messaging]
diff --git a/prebuild.xml b/prebuild.xml
index 047b66d..ad06938 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1596,6 +1596,7 @@
1596 <Reference name="System.Xml"/> 1596 <Reference name="System.Xml"/>
1597 <Reference name="System.Drawing"/> 1597 <Reference name="System.Drawing"/>
1598 <Reference name="System.Web"/> 1598 <Reference name="System.Web"/>
1599 <Reference name="NDesk.Options"/>
1599 <Reference name="OpenMetaverseTypes.dll"/> 1600 <Reference name="OpenMetaverseTypes.dll"/>
1600 <Reference name="OpenMetaverse.StructuredData.dll"/> 1601 <Reference name="OpenMetaverse.StructuredData.dll"/>
1601 <Reference name="OpenMetaverse.dll"/> 1602 <Reference name="OpenMetaverse.dll"/>
@@ -3414,7 +3415,7 @@
3414 </Files> 3415 </Files>
3415 </Project> 3416 </Project>
3416 3417
3417 <?include file="addon-modules/*/prebuild.xml" ?> 3418 <?include file="addon-modules/*/prebuild*.xml" ?>
3418 3419
3419 </Solution> 3420 </Solution>
3420 3421