aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-11-10 23:56:58 +0000
committerTeravus Ovares2008-11-10 23:56:58 +0000
commitd1457001150d7af6faf2a11e59b895320c6e3e9b (patch)
treee330afa46bdbafb24ec7bd8893a9c582c6718f68 /OpenSim/Region
parentfix README.txt to be 0.6 (diff)
downloadopensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.zip
opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.tar.gz
opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.tar.bz2
opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.tar.xz
* Commit allows downloading of the .raw terrain from the estate tools.
* Implements the SendInitiateDownload method in IClientAPI * Uses the ITerrainModule Interface to write a terrain file to disk then uses a FileStream to read the binary file from the disk and put it in a byte array. and save to the xFer list. * It then tells the client to download the file and the client initiates an Xfer request.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs38
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs1
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs26
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs6
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs5
5 files changed, 70 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 188ce4b..a835e43 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -205,6 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
205 private ParcelAbandonRequest handlerParcelAbandonRequest; 205 private ParcelAbandonRequest handlerParcelAbandonRequest;
206 private ParcelGodForceOwner handlerParcelGodForceOwner; 206 private ParcelGodForceOwner handlerParcelGodForceOwner;
207 private ParcelReclaim handlerParcelReclaim; 207 private ParcelReclaim handlerParcelReclaim;
208 private RequestTerrain handlerRequestTerrain;
208 private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest; 209 private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest;
209 private RegionInfoRequest handlerRegionInfoRequest; //OnRegionInfoRequest; 210 private RegionInfoRequest handlerRegionInfoRequest; //OnRegionInfoRequest;
210 private EstateCovenantRequest handlerEstateCovenantRequest; //OnEstateCovenantRequest; 211 private EstateCovenantRequest handlerEstateCovenantRequest; //OnEstateCovenantRequest;
@@ -895,6 +896,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
895 public event XferReceive OnXferReceive; 896 public event XferReceive OnXferReceive;
896 public event RequestXfer OnRequestXfer; 897 public event RequestXfer OnRequestXfer;
897 public event ConfirmXfer OnConfirmXfer; 898 public event ConfirmXfer OnConfirmXfer;
899 public event RequestTerrain OnRequestTerrain;
898 public event RezScript OnRezScript; 900 public event RezScript OnRezScript;
899 public event UpdateTaskInventory OnUpdateTaskInventory; 901 public event UpdateTaskInventory OnUpdateTaskInventory;
900 public event MoveTaskInventory OnMoveTaskItem; 902 public event MoveTaskInventory OnMoveTaskItem;
@@ -2527,7 +2529,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2527 newPack.Header.Zerocoded = true; 2529 newPack.Header.Zerocoded = true;
2528 OutPacket(newPack, ThrottleOutPacketType.Asset); 2530 OutPacket(newPack, ThrottleOutPacketType.Asset);
2529 } 2531 }
2530 2532 public void SendInitiateDownload(string simFileName, string clientFileName)
2533 {
2534 InitiateDownloadPacket newPack = new InitiateDownloadPacket();
2535 newPack.AgentData.AgentID = AgentId;
2536 newPack.FileData.SimFilename = Utils.StringToBytes(simFileName);
2537 newPack.FileData.ViewerFilename = Utils.StringToBytes(clientFileName);
2538 OutPacket(newPack, ThrottleOutPacketType.Asset);
2539 }
2531 public void SendImageFirstPart( 2540 public void SendImageFirstPart(
2532 ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec) 2541 ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
2533 { 2542 {
@@ -5756,7 +5765,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5756 5765
5757 case PacketType.EstateOwnerMessage: 5766 case PacketType.EstateOwnerMessage:
5758 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 5767 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
5759 5768
5760 switch (Utils.BytesToString(messagePacket.MethodData.Method)) 5769 switch (Utils.BytesToString(messagePacket.MethodData.Method))
5761 { 5770 {
5762 case "getinfo": 5771 case "getinfo":
@@ -5975,11 +5984,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5975 case "terrain": 5984 case "terrain":
5976 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false)) 5985 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5977 { 5986 {
5978 handlerBakeTerrain = OnBakeTerrain; 5987 if (messagePacket.ParamList.Length > 0)
5979 if (handlerBakeTerrain != null)
5980 { 5988 {
5981 handlerBakeTerrain(this); 5989 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake")
5990 {
5991 handlerBakeTerrain = OnBakeTerrain;
5992 if (handlerBakeTerrain != null)
5993 {
5994 handlerBakeTerrain(this);
5995 }
5996 }
5997 if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "download filename")
5998 {
5999 if (messagePacket.ParamList.Length > 1)
6000 {
6001 handlerRequestTerrain = OnRequestTerrain;
6002 if (handlerRequestTerrain != null)
6003 {
6004 handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
6005 }
6006 }
6007 }
5982 } 6008 }
6009
6010
5983 } 6011 }
5984 break; 6012 break;
5985 6013
diff --git a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
index 3c69621..2f9a691 100644
--- a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs
@@ -105,6 +105,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
105 /// <param name="fileName"></param> 105 /// <param name="fileName"></param>
106 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) 106 public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
107 { 107 {
108
108 lock (NewFiles) 109 lock (NewFiles)
109 { 110 {
110 if (NewFiles.ContainsKey(fileName)) 111 if (NewFiles.ContainsKey(fileName))
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index 041bba5..c38d502 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -421,6 +421,31 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
421 } 421 }
422 } 422 }
423 423
424 private void handleTerrainRequest(IClientAPI remote_client, string clientFileName)
425 {
426 // Save terrain here
427 OpenSim.Region.Environment.Modules.World.Terrain.ITerrainModule terr = m_scene.RequestModuleInterface<OpenSim.Region.Environment.Modules.World.Terrain.ITerrainModule>();
428
429 if (terr != null)
430 {
431 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName);
432 if (System.IO.File.Exists(Util.dataDir() + "/terrain.raw"))
433 {
434 System.IO.File.Delete(Util.dataDir() + "/terrain.raw");
435 }
436 terr.SaveToFile(Util.dataDir() + "/terrain.raw");
437
438 System.IO.FileStream input = new System.IO.FileStream(Util.dataDir() + "/terrain.raw", System.IO.FileMode.Open);
439 byte[] bdata = new byte[input.Length];
440 input.Read(bdata, 0, (int)input.Length);
441 remote_client.SendAlertMessage("Terrain file written, starting download...");
442 m_scene.XferManager.AddNewFile("terrain.raw", bdata);
443 // Tell client about it
444 m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name);
445 remote_client.SendInitiateDownload("terrain.raw", clientFileName);
446 }
447 }
448
424 private void HandleRegionInfoRequest(IClientAPI remote_client) 449 private void HandleRegionInfoRequest(IClientAPI remote_client)
425 { 450 {
426 451
@@ -767,6 +792,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
767 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; 792 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest;
768 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; 793 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest;
769 client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest; 794 client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest;
795 client.OnRequestTerrain += handleTerrainRequest;
770 796
771 client.OnRegionInfoRequest += HandleRegionInfoRequest; 797 client.OnRegionInfoRequest += HandleRegionInfoRequest;
772 client.OnEstateCovenantRequest += HandleEstateCovenantRequest; 798 client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index cf8ba94..7b077ec 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -268,7 +268,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
268 public event ObjectDeselect OnObjectDeselect; 268 public event ObjectDeselect OnObjectDeselect;
269 public event RegionInfoRequest OnRegionInfoRequest; 269 public event RegionInfoRequest OnRegionInfoRequest;
270 public event EstateCovenantRequest OnEstateCovenantRequest; 270 public event EstateCovenantRequest OnEstateCovenantRequest;
271 271 public event RequestTerrain OnRequestTerrain;
272 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; 272 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
273 273
274 public event FriendActionDelegate OnApproveFriendRequest; 274 public event FriendActionDelegate OnApproveFriendRequest;
@@ -698,6 +698,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
698 { 698 {
699 } 699 }
700 700
701 public void SendInitiateDownload(string simFileName, string clientFileName)
702 {
703 }
704
701 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec) 705 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
702 { 706 {
703 } 707 }
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 789d24b..66fb6d8 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -136,6 +136,7 @@ namespace OpenSim.Region.Examples.SimpleModule
136 public event CopyInventoryItem OnCopyInventoryItem; 136 public event CopyInventoryItem OnCopyInventoryItem;
137 public event MoveInventoryItem OnMoveInventoryItem; 137 public event MoveInventoryItem OnMoveInventoryItem;
138 public event UDPAssetUploadRequest OnAssetUploadRequest; 138 public event UDPAssetUploadRequest OnAssetUploadRequest;
139 public event RequestTerrain OnRequestTerrain;
139 public event XferReceive OnXferReceive; 140 public event XferReceive OnXferReceive;
140 public event RequestXfer OnRequestXfer; 141 public event RequestXfer OnRequestXfer;
141 public event ConfirmXfer OnConfirmXfer; 142 public event ConfirmXfer OnConfirmXfer;
@@ -615,6 +616,10 @@ namespace OpenSim.Region.Examples.SimpleModule
615 { 616 {
616 } 617 }
617 618
619 public void SendInitiateDownload(string simFileName, string clientFileName)
620 {
621 }
622
618 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec) 623 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
619 { 624 {
620 } 625 }