aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-12-14 00:12:17 +0000
committerJustin Clark-Casey (justincc)2010-12-14 00:12:17 +0000
commite08da02a0fe3bcf19c6cc84023e56f81e3b1a7f5 (patch)
treefc4a33689299573e29ad4bf1e7aa74e821cf68d9 /OpenSim
parentreinstate IAttachmentsModule.UpdateAttachmentPosition() since this is being u... (diff)
parentFix a small bug in ban list handling (diff)
downloadopensim-SC_OLD-e08da02a0fe3bcf19c6cc84023e56f81e3b1a7f5.zip
opensim-SC_OLD-e08da02a0fe3bcf19c6cc84023e56f81e3b1a7f5.tar.gz
opensim-SC_OLD-e08da02a0fe3bcf19c6cc84023e56f81e3b1a7f5.tar.bz2
opensim-SC_OLD-e08da02a0fe3bcf19c6cc84023e56f81e3b1a7f5.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs202
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs56
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs13
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs88
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs31
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs76
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs29
14 files changed, 322 insertions, 234 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 027f9c5..b9c9323 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -174,9 +174,10 @@ namespace OpenSim.Framework
174 public delegate void ParcelAccessListRequest( 174 public delegate void ParcelAccessListRequest(
175 UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); 175 UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client);
176 176
177 public delegate void ParcelAccessListUpdateRequest( 177 public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags,
178 UUID agentID, UUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries, 178 int landLocalID, UUID transactionID, int sequenceID,
179 IClientAPI remote_client); 179 int sections, List<ParcelManager.ParcelAccessEntry> entries,
180 IClientAPI remote_client);
180 181
181 public delegate void ParcelPropertiesRequest( 182 public delegate void ParcelPropertiesRequest(
182 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); 183 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f125822..c934b9e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -8239,7 +8239,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8239 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 8239 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
8240 entry.AgentID = block.ID; 8240 entry.AgentID = block.ID;
8241 entry.Flags = (AccessList)block.Flags; 8241 entry.Flags = (AccessList)block.Flags;
8242 entry.Time = new DateTime(); 8242 entry.Time = Util.ToDateTime(block.Time);
8243 entries.Add(entry); 8243 entries.Add(entry);
8244 } 8244 }
8245 8245
@@ -8247,8 +8247,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8247 if (handlerParcelAccessListUpdateRequest != null) 8247 if (handlerParcelAccessListUpdateRequest != null)
8248 { 8248 {
8249 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, 8249 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
8250 updatePacket.AgentData.SessionID, updatePacket.Data.Flags, 8250 updatePacket.Data.Flags,
8251 updatePacket.Data.LocalID, entries, this); 8251 updatePacket.Data.LocalID,
8252 updatePacket.Data.TransactionID,
8253 updatePacket.Data.SequenceID,
8254 updatePacket.Data.Sections,
8255 entries, this);
8252 } 8256 }
8253 return true; 8257 return true;
8254 } 8258 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 695202f..ac4705c 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Land
159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects; 159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects;
160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest; 160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest;
161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest; 161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest;
162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessUpdateListRequest; 162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessListUpdateRequest;
163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest; 163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest;
164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
165 client.OnParcelReclaim += ClientOnParcelReclaim; 165 client.OnParcelReclaim += ClientOnParcelReclaim;
@@ -508,14 +508,22 @@ namespace OpenSim.Region.CoreModules.World.Land
508 508
509 if (land != null) 509 if (land != null)
510 { 510 {
511 m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client); 511 land.SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
512 } 512 }
513 } 513 }
514 514
515 public void ClientOnParcelAccessUpdateListRequest(UUID agentID, UUID sessionID, uint flags, int landLocalID, 515 public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
516 List<ParcelManager.ParcelAccessEntry> entries, 516 uint flags, int landLocalID, UUID transactionID, int sequenceID,
517 IClientAPI remote_client) 517 int sections, List<ParcelManager.ParcelAccessEntry> entries,
518 IClientAPI remote_client)
518 { 519 {
520 // Flags is the list to update, it can mean either the ban or
521 // the access list (WTH is a pass list? Mentioned in ParcelFlags)
522 //
523 // There may be multiple packets, because these can get LONG.
524 // Use transactionID to determine a new chain of packets since
525 // packets may have come in out of sequence and that would be
526 // a big mess if using the sequenceID
519 ILandObject land; 527 ILandObject land;
520 lock (m_landList) 528 lock (m_landList)
521 { 529 {
@@ -524,9 +532,15 @@ namespace OpenSim.Region.CoreModules.World.Land
524 532
525 if (land != null) 533 if (land != null)
526 { 534 {
527 if (agentID == land.LandData.OwnerID) 535 GroupPowers requiredPowers = GroupPowers.LandManageAllowed;
536 if (flags == (uint)AccessList.Ban)
537 requiredPowers = GroupPowers.LandManageBanned;
538
539 if (m_scene.Permissions.CanEditParcelProperties(agentID,
540 land, requiredPowers))
528 { 541 {
529 land.UpdateAccessList(flags, entries, remote_client); 542 land.UpdateAccessList(flags, transactionID, sequenceID,
543 sections, entries, remote_client);
530 } 544 }
531 } 545 }
532 else 546 else
@@ -854,7 +868,7 @@ namespace OpenSim.Region.CoreModules.World.Land
854 868
855 //If we are still here, then they are subdividing within one piece of land 869 //If we are still here, then they are subdividing within one piece of land
856 //Check owner 870 //Check owner
857 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, startLandObject)) 871 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin))
858 { 872 {
859 return; 873 return;
860 } 874 }
@@ -922,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Land
922 { 936 {
923 return; 937 return;
924 } 938 }
925 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, masterLandObject)) 939 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin))
926 { 940 {
927 return; 941 return;
928 } 942 }
@@ -1570,7 +1584,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1570 1584
1571 if (land == null) return; 1585 if (land == null) return;
1572 1586
1573 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) 1587 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions))
1574 return; 1588 return;
1575 1589
1576 land.LandData.OtherCleanTime = otherCleanTime; 1590 land.LandData.OtherCleanTime = otherCleanTime;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index d87352f..3e41c55 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.World.Land
54 protected LandData m_landData = new LandData(); 54 protected LandData m_landData = new LandData();
55 protected Scene m_scene; 55 protected Scene m_scene;
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
57 58
58 public bool[,] LandBitmap 59 public bool[,] LandBitmap
59 { 60 {
@@ -199,36 +200,81 @@ namespace OpenSim.Region.CoreModules.World.Land
199 200
200 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 201 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
201 { 202 {
202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 203 //Needs later group support
204 bool snap_selection = false;
205 LandData newData = LandData.Copy();
206
207 uint allowedDelta = 0;
208
209 // These two are always blocked as no client can set them anyway
210 // ParcelFlags.ForSaleObjects
211 // ParcelFlags.LindenHome
212
213 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
203 { 214 {
204 //Needs later group support 215 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
205 bool snap_selection = false; 216 ParcelFlags.AllowTerraform |
206 LandData newData = LandData.Copy(); 217 ParcelFlags.AllowDamage |
218 ParcelFlags.CreateObjects |
219 ParcelFlags.RestrictPushObject |
220 ParcelFlags.AllowGroupScripts |
221 ParcelFlags.CreateGroupObjects |
222 ParcelFlags.AllowAPrimitiveEntry |
223 ParcelFlags.AllowGroupObjectEntry);
224 }
207 225
208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 226 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale))
227 {
228 if (args.AuthBuyerID != newData.AuthBuyerID ||
229 args.SalePrice != newData.SalePrice)
209 { 230 {
210 if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) 231 snap_selection = true;
211 { 232 }
212 newData.AuthBuyerID = args.AuthBuyerID; 233
213 newData.SalePrice = args.SalePrice; 234 newData.AuthBuyerID = args.AuthBuyerID;
214 snap_selection = true; 235 newData.SalePrice = args.SalePrice;
215 } 236
237 if (!LandData.IsGroupOwned)
238 {
239 newData.GroupID = args.GroupID;
240
241 allowedDelta |= (uint)(ParcelFlags.AllowDeedToGroup |
242 ParcelFlags.ContributeWithDeed |
243 ParcelFlags.SellParcelObjects);
216 } 244 }
245
246 allowedDelta |= (uint)ParcelFlags.ForSale;
247 }
248
249 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces))
250 {
217 newData.Category = args.Category; 251 newData.Category = args.Category;
252
253 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
254 ParcelFlags.AllowPublish |
255 ParcelFlags.MaturePublish);
256 }
257
258 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity))
259 {
218 newData.Description = args.Desc; 260 newData.Description = args.Desc;
219 newData.GroupID = args.GroupID; 261 newData.Name = args.Name;
262 newData.SnapshotID = args.SnapshotID;
263 }
264
265 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint))
266 {
220 newData.LandingType = args.LandingType; 267 newData.LandingType = args.LandingType;
268 newData.UserLocation = args.UserLocation;
269 newData.UserLookAt = args.UserLookAt;
270 }
271
272 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia))
273 {
221 newData.MediaAutoScale = args.MediaAutoScale; 274 newData.MediaAutoScale = args.MediaAutoScale;
222 newData.MediaID = args.MediaID; 275 newData.MediaID = args.MediaID;
223 newData.MediaURL = args.MediaURL; 276 newData.MediaURL = args.MediaURL;
224 newData.MusicURL = args.MusicURL; 277 newData.MusicURL = args.MusicURL;
225 newData.Name = args.Name;
226 newData.Flags = args.ParcelFlags;
227 newData.PassHours = args.PassHours;
228 newData.PassPrice = args.PassPrice;
229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType; 278 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription; 279 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth; 280 newData.MediaWidth = args.MediaWidth;
@@ -237,10 +283,40 @@ namespace OpenSim.Region.CoreModules.World.Land
237 newData.ObscureMusic = args.ObscureMusic; 283 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia; 284 newData.ObscureMedia = args.ObscureMedia;
239 285
240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 286 allowedDelta |= (uint)(ParcelFlags.SoundLocal |
287 ParcelFlags.UrlWebPage |
288 ParcelFlags.UrlRawHtml |
289 ParcelFlags.AllowVoiceChat |
290 ParcelFlags.UseEstateVoiceChan);
291 }
292
293 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses))
294 {
295 newData.PassHours = args.PassHours;
296 newData.PassPrice = args.PassPrice;
297
298 allowedDelta |= (uint)ParcelFlags.UsePassList;
299 }
300
301 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed))
302 {
303 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
304 ParcelFlags.UseAccessList);
305 }
241 306
242 SendLandUpdateToAvatarsOverMe(snap_selection); 307 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned))
308 {
309 allowedDelta |= (uint)(ParcelFlags.UseBanList |
310 ParcelFlags.DenyAnonymous |
311 ParcelFlags.DenyAgeUnverified);
243 } 312 }
313
314 uint preserve = LandData.Flags & ~allowedDelta;
315 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
316
317 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
318
319 SendLandUpdateToAvatarsOverMe(snap_selection);
244 } 320 }
245 321
246 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 322 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -295,14 +371,14 @@ namespace OpenSim.Region.CoreModules.World.Land
295 371
296 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 372 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
297 { 373 {
298 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 374 if (LandData.ParcelAccessList.FindIndex(
299 entry.AgentID = avatar; 375 delegate(ParcelManager.ParcelAccessEntry e)
300 entry.Flags = AccessList.Ban; 376 {
301 entry.Time = new DateTime(); 377 if (e.AgentID == avatar && e.Flags == AccessList.Ban)
302 //See if they are on the list, but make sure the owner isn't banned 378 return true;
303 if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 379 return false;
380 }) != -1 && LandData.OwnerID != avatar)
304 { 381 {
305 //They are banned, so lets send them a notice about this parcel
306 return true; 382 return true;
307 } 383 }
308 } 384 }
@@ -316,15 +392,14 @@ namespace OpenSim.Region.CoreModules.World.Land
316 392
317 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 393 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
318 { 394 {
319 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 395 if (LandData.ParcelAccessList.FindIndex(
320 entry.AgentID = avatar; 396 delegate(ParcelManager.ParcelAccessEntry e)
321 entry.Flags = AccessList.Access; 397 {
322 entry.Time = new DateTime(); 398 if (e.AgentID == avatar && e.Flags == AccessList.Access)
323 399 return true;
324 //If they are not on the access list and are not the owner 400 return false;
325 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 401 }) == -1 && LandData.OwnerID != avatar)
326 { 402 {
327 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
328 return true; 403 return true;
329 } 404 }
330 } 405 }
@@ -421,39 +496,52 @@ namespace OpenSim.Region.CoreModules.World.Land
421 } 496 }
422 } 497 }
423 498
424 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 499 public void UpdateAccessList(uint flags, UUID transactionID,
500 int sequenceID, int sections,
501 List<ParcelManager.ParcelAccessEntry> entries,
502 IClientAPI remote_client)
425 { 503 {
426 LandData newData = LandData.Copy(); 504 LandData newData = LandData.Copy();
427 505
428 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 506 if ((!m_listTransactions.ContainsKey(flags)) ||
507 m_listTransactions[flags] != transactionID)
429 { 508 {
430 entries.Clear(); 509 m_listTransactions[flags] = transactionID;
431 }
432 510
433 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 511 List<ParcelManager.ParcelAccessEntry> toRemove =
434 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) 512 new List<ParcelManager.ParcelAccessEntry>();
435 { 513
436 if (entry.Flags == (AccessList)flags) 514 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
437 { 515 {
438 toRemove.Add(entry); 516 if (entry.Flags == (AccessList)flags)
517 toRemove.Add(entry);
439 } 518 }
440 }
441 519
442 foreach (ParcelManager.ParcelAccessEntry entry in toRemove) 520 foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
443 { 521 {
444 newData.ParcelAccessList.Remove(entry); 522 newData.ParcelAccessList.Remove(entry);
523 }
524
525 // Checked here because this will always be the first
526 // and only packet in a transaction
527 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
528 {
529 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
530
531 return;
532 }
445 } 533 }
534
446 foreach (ParcelManager.ParcelAccessEntry entry in entries) 535 foreach (ParcelManager.ParcelAccessEntry entry in entries)
447 { 536 {
448 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); 537 ParcelManager.ParcelAccessEntry temp =
538 new ParcelManager.ParcelAccessEntry();
539
449 temp.AgentID = entry.AgentID; 540 temp.AgentID = entry.AgentID;
450 temp.Time = new DateTime(); //Pointless? Yes. 541 temp.Time = entry.Time;
451 temp.Flags = (AccessList)flags; 542 temp.Flags = (AccessList)flags;
452 543
453 if (!newData.ParcelAccessList.Contains(temp)) 544 newData.ParcelAccessList.Add(temp);
454 {
455 newData.ParcelAccessList.Add(temp);
456 }
457 } 545 }
458 546
459 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 547 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
@@ -711,7 +799,7 @@ namespace OpenSim.Region.CoreModules.World.Land
711 799
712 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 800 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
713 { 801 {
714 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 802 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
715 { 803 {
716 List<uint> resultLocalIDs = new List<uint>(); 804 List<uint> resultLocalIDs = new List<uint>();
717 try 805 try
@@ -761,7 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land
761 /// </param> 849 /// </param>
762 public void SendLandObjectOwners(IClientAPI remote_client) 850 public void SendLandObjectOwners(IClientAPI remote_client)
763 { 851 {
764 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 852 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
765 { 853 {
766 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 854 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
767 List<UUID> groups = new List<UUID>(); 855 List<UUID> groups = new List<UUID>();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f5f3839..364dd6c 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -37,56 +37,6 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40// Temporary fix of wrong GroupPowers constants in OpenMetaverse library
41enum GroupPowers : long
42 {
43 None = 0,
44 LandEjectAndFreeze = 1,
45 Invite = 2,
46 ReturnGroupSet = 2,
47 Eject = 4,
48 ReturnNonGroup = 4,
49 ChangeOptions = 8,
50 LandGardening = 8,
51 CreateRole = 16,
52 DeedObject = 16,
53 ModerateChat = 32,
54 DeleteRole = 32,
55 RoleProperties = 64,
56 ObjectManipulate = 64,
57 ObjectSetForSale = 128,
58 AssignMemberLimited = 128,
59 AssignMember = 256,
60 Accountable = 256,
61 RemoveMember = 512,
62 SendNotices = 1024,
63 ChangeActions = 1024,
64 ChangeIdentity = 2048,
65 ReceiveNotices = 2048,
66 StartProposal = 4096,
67 LandDeed = 4096,
68 VoteOnProposal = 8192,
69 LandRelease = 8192,
70 LandSetSale = 16384,
71 LandDivideJoin = 32768,
72 ReturnGroupOwned = 65536,
73 JoinChat = 65536,
74 FindPlaces = 131072,
75 LandChangeIdentity = 262144,
76 SetLandingPoint = 524288,
77 ChangeMedia = 1048576,
78 LandEdit = 2097152,
79 LandOptions = 4194304,
80 AllowEditLand = 8388608,
81 AllowFly = 16777216,
82 AllowRez = 33554432,
83 AllowLandmark = 67108864,
84 AllowVoiceChat = 134217728,
85 AllowSetHome = 268435456,
86 LandManageAllowed = 536870912,
87 LandManageBanned = 1073741824
88 }
89
90namespace OpenSim.Region.CoreModules.World.Permissions 40namespace OpenSim.Region.CoreModules.World.Permissions
91{ 41{
92 public class PermissionsModule : IRegionModule 42 public class PermissionsModule : IRegionModule
@@ -214,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
214 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 164 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
215 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 165 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
216 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 166 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
217 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED 167 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
218 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 168 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
219 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 169 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
220 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 170 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -1005,12 +955,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1005 return GenericObjectPermission(editorID, objectID, false); 955 return GenericObjectPermission(editorID, objectID, false);
1006 } 956 }
1007 957
1008 private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) 958 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene)
1009 { 959 {
1010 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 960 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1011 if (m_bypassPermissions) return m_bypassPermissionsValue; 961 if (m_bypassPermissions) return m_bypassPermissionsValue;
1012 962
1013 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDivideJoin); 963 return GenericParcelOwnerPermission(user, parcel, (ulong)p);
1014 } 964 }
1015 965
1016 /// <summary> 966 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index 084184f..585eb00 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces
57 void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); 57 void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
58 List<UUID> CreateAccessListArrayByFlag(AccessList flag); 58 List<UUID> CreateAccessListArrayByFlag(AccessList flag);
59 void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); 59 void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
60 void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); 60 void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
61 void UpdateLandBitmapByteArray(); 61 void UpdateLandBitmapByteArray();
62 void SetLandBitmapFromByteArray(); 62 void SetLandBitmapFromByteArray();
63 bool[,] GetLandBitmap(); 63 bool[,] GetLandBitmap();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index d67638a..1295e58 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -68,6 +68,7 @@ namespace OpenSim.Region.Framework.Scenes
68 public delegate bool IsGodHandler(UUID user, Scene requestFromScene); 68 public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
69 public delegate bool IsAdministratorHandler(UUID user); 69 public delegate bool IsAdministratorHandler(UUID user);
70 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 70 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
71 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene);
71 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); 72 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
72 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 73 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
73 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); 74 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
@@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes
131 public event IsGodHandler OnIsGod; 132 public event IsGodHandler OnIsGod;
132 public event IsAdministratorHandler OnIsAdministrator; 133 public event IsAdministratorHandler OnIsAdministrator;
133 public event EditParcelHandler OnEditParcel; 134 public event EditParcelHandler OnEditParcel;
135 public event EditParcelPropertiesHandler OnEditParcelProperties;
134 public event SellParcelHandler OnSellParcel; 136 public event SellParcelHandler OnSellParcel;
135 public event AbandonParcelHandler OnAbandonParcel; 137 public event AbandonParcelHandler OnAbandonParcel;
136 public event ReclaimParcelHandler OnReclaimParcel; 138 public event ReclaimParcelHandler OnReclaimParcel;
@@ -720,15 +722,16 @@ namespace OpenSim.Region.Framework.Scenes
720 #endregion 722 #endregion
721 723
722 #region EDIT PARCEL 724 #region EDIT PARCEL
723 public bool CanEditParcel(UUID user, ILandObject parcel) 725
726 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p)
724 { 727 {
725 EditParcelHandler handler = OnEditParcel; 728 EditParcelPropertiesHandler handler = OnEditParcelProperties;
726 if (handler != null) 729 if (handler != null)
727 { 730 {
728 Delegate[] list = handler.GetInvocationList(); 731 Delegate[] list = handler.GetInvocationList();
729 foreach (EditParcelHandler h in list) 732 foreach (EditParcelPropertiesHandler h in list)
730 { 733 {
731 if (h(user, parcel, m_scene) == false) 734 if (h(user, parcel, p, m_scene) == false)
732 return false; 735 return false;
733 } 736 }
734 } 737 }
@@ -1043,4 +1046,4 @@ namespace OpenSim.Region.Framework.Scenes
1043 return true; 1046 return true;
1044 } 1047 }
1045 } 1048 }
1046} \ No newline at end of file 1049}
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index ff0e743..4a24c7d 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -1001,7 +1001,7 @@ namespace OpenSim.Region.RegionCombinerModule
1001 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; 1001 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
1002 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED 1002 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
1003 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED 1003 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
1004 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED 1004 VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
1005 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; 1005 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
1006 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED 1006 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
1007 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED 1007 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
index 393322d..7c662c9 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -105,9 +105,9 @@ namespace OpenSim.Region.RegionCombinerModule
105 return m_rootScene.Permissions.CanEditObject(objectid, editorid); 105 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
106 } 106 }
107 107
108 public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) 108 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene)
109 { 109 {
110 return m_rootScene.Permissions.CanEditParcel(user, parcel); 110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g);
111 } 111 }
112 112
113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene) 113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3c5f2d0..30fb252 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6287,16 +6287,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6287 { 6287 {
6288 m_host.AddScriptLPS(1); 6288 m_host.AddScriptLPS(1);
6289 UUID key; 6289 UUID key;
6290 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 6290 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
6291 if (land.OwnerID == m_host.OwnerID) 6291 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
6292 { 6292 {
6293 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 6293 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
6294 if (UUID.TryParse(avatar, out key)) 6294 if (UUID.TryParse(avatar, out key))
6295 { 6295 {
6296 entry.AgentID = key; 6296 if (land.LandData.ParcelAccessList.FindIndex(
6297 entry.Flags = AccessList.Access; 6297 delegate(ParcelManager.ParcelAccessEntry e)
6298 entry.Time = DateTime.Now.AddHours(hours); 6298 {
6299 land.ParcelAccessList.Add(entry); 6299 if (e.AgentID == key && e.Flags == AccessList.Access)
6300 return true;
6301 return false;
6302 }) == -1)
6303 {
6304 entry.AgentID = key;
6305 entry.Flags = AccessList.Access;
6306 entry.Time = DateTime.Now.AddHours(hours);
6307 land.LandData.ParcelAccessList.Add(entry);
6308 }
6300 } 6309 }
6301 } 6310 }
6302 ScriptSleep(100); 6311 ScriptSleep(100);
@@ -9023,7 +9032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9023 // according to the docs, this command only works if script owner and land owner are the same 9032 // according to the docs, this command only works if script owner and land owner are the same
9024 // lets add estate owners and gods, too, and use the generic permission check. 9033 // lets add estate owners and gods, too, and use the generic permission check.
9025 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 9034 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9026 if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return; 9035 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return;
9027 9036
9028 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 9037 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
9029 byte loop = 0; 9038 byte loop = 0;
@@ -9466,16 +9475,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9466 { 9475 {
9467 m_host.AddScriptLPS(1); 9476 m_host.AddScriptLPS(1);
9468 UUID key; 9477 UUID key;
9469 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9478 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9470 if (land.OwnerID == m_host.OwnerID) 9479 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
9471 { 9480 {
9472 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 9481 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
9473 if (UUID.TryParse(avatar, out key)) 9482 if (UUID.TryParse(avatar, out key))
9474 { 9483 {
9475 entry.AgentID = key; 9484 if (land.LandData.ParcelAccessList.FindIndex(
9476 entry.Flags = AccessList.Ban; 9485 delegate(ParcelManager.ParcelAccessEntry e)
9477 entry.Time = DateTime.Now.AddHours(hours); 9486 {
9478 land.ParcelAccessList.Add(entry); 9487 if (e.AgentID == key && e.Flags == AccessList.Ban)
9488 return true;
9489 return false;
9490 }) == -1)
9491 {
9492 entry.AgentID = key;
9493 entry.Flags = AccessList.Ban;
9494 entry.Time = DateTime.Now.AddHours(hours);
9495 land.LandData.ParcelAccessList.Add(entry);
9496 }
9479 } 9497 }
9480 } 9498 }
9481 ScriptSleep(100); 9499 ScriptSleep(100);
@@ -9485,19 +9503,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9485 { 9503 {
9486 m_host.AddScriptLPS(1); 9504 m_host.AddScriptLPS(1);
9487 UUID key; 9505 UUID key;
9488 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9506 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9489 if (land.OwnerID == m_host.OwnerID) 9507 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
9490 { 9508 {
9491 if (UUID.TryParse(avatar, out key)) 9509 if (UUID.TryParse(avatar, out key))
9492 { 9510 {
9493 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9511 int idx = land.LandData.ParcelAccessList.FindIndex(
9494 { 9512 delegate(ParcelManager.ParcelAccessEntry e)
9495 if (entry.AgentID == key && entry.Flags == AccessList.Access) 9513 {
9496 { 9514 if (e.AgentID == key && e.Flags == AccessList.Access)
9497 land.ParcelAccessList.Remove(entry); 9515 return true;
9498 break; 9516 return false;
9499 } 9517 });
9500 } 9518
9519 if (idx != -1)
9520 land.LandData.ParcelAccessList.RemoveAt(idx);
9501 } 9521 }
9502 } 9522 }
9503 ScriptSleep(100); 9523 ScriptSleep(100);
@@ -9507,19 +9527,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9507 { 9527 {
9508 m_host.AddScriptLPS(1); 9528 m_host.AddScriptLPS(1);
9509 UUID key; 9529 UUID key;
9510 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9530 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9511 if (land.OwnerID == m_host.OwnerID) 9531 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
9512 { 9532 {
9513 if (UUID.TryParse(avatar, out key)) 9533 if (UUID.TryParse(avatar, out key))
9514 { 9534 {
9515 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9535 int idx = land.LandData.ParcelAccessList.FindIndex(
9516 { 9536 delegate(ParcelManager.ParcelAccessEntry e)
9517 if (entry.AgentID == key && entry.Flags == AccessList.Ban) 9537 {
9518 { 9538 if (e.AgentID == key && e.Flags == AccessList.Ban)
9519 land.ParcelAccessList.Remove(entry); 9539 return true;
9520 break; 9540 return false;
9521 } 9541 });
9522 } 9542
9543 if (idx != -1)
9544 land.LandData.ParcelAccessList.RemoveAt(idx);
9523 } 9545 }
9524 } 9546 }
9525 ScriptSleep(100); 9547 ScriptSleep(100);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 3b13d06..5a796b8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1335 return; 1335 return;
1336 } 1336 }
1337 1337
1338 if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) 1338 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions))
1339 { 1339 {
1340 OSSLShoutError("You do not have permission to modify the parcel"); 1340 OSSLShoutError("You do not have permission to modify the parcel");
1341 return; 1341 return;
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 85c1380..1ac8478 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Drawing; 31using System.Drawing;
32using System.IO;
32using System.Net; 33using System.Net;
33using System.Reflection; 34using System.Reflection;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -48,7 +49,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
48 { 49 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 51
51// private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); 52 private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
52 53
53 private IAssetService m_AssetService; 54 private IAssetService m_AssetService;
54 55
@@ -143,24 +144,25 @@ namespace OpenSim.Services.Connectors.Hypergrid
143 return true; 144 return true;
144 } 145 }
145 146
146 UUID m_MissingTexture = new UUID("5748decc-f629-461c-9a36-a35a221fe21f"); 147 public UUID GetMapImage(UUID regionID, string imageURL, string storagePath)
147
148 public UUID GetMapImage(UUID regionID, string imageURL)
149 { 148 {
150 if (m_AssetService == null) 149 if (m_AssetService == null)
151 return m_MissingTexture; 150 return m_HGMapImage;
152 151
152 UUID mapTile = m_HGMapImage;
153 string filename = string.Empty;
154 Bitmap bitmap = null;
153 try 155 try
154 { 156 {
155
156 WebClient c = new WebClient(); 157 WebClient c = new WebClient();
157 //m_log.Debug("JPEG: " + imageURL); 158 //m_log.Debug("JPEG: " + imageURL);
158 string filename = regionID.ToString(); 159 string name = regionID.ToString();
159 c.DownloadFile(imageURL, filename + ".jpg"); 160 filename = Path.Combine(storagePath, name + ".jpg");
160 Bitmap m = new Bitmap(filename + ".jpg"); 161 c.DownloadFile(imageURL, filename);
162 bitmap = new Bitmap(filename);
161 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); 163 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
162 byte[] imageData = OpenJPEG.EncodeFromImage(m, true); 164 byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
163 AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID.ToString()); 165 AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
164 166
165 // !!! for now 167 // !!! for now
166 //info.RegionSettings.TerrainImageID = ass.FullID; 168 //info.RegionSettings.TerrainImageID = ass.FullID;
@@ -172,14 +174,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
172 m_AssetService.Store(ass); 174 m_AssetService.Store(ass);
173 175
174 // finally 176 // finally
175 return ass.FullID; 177 mapTile = ass.FullID;
176
177 } 178 }
178 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke 179 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
179 { 180 {
180 m_log.Warn("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache"); 181 m_log.Info("[GATEKEEPER SERVICE CONNECTOR]: Failed getting/storing map image, because it is probably already in the cache");
181 } 182 }
182 return UUID.Zero; 183 return mapTile;
183 } 184 }
184 185
185 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) 186 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 9863ba0..643d0fc 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.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.IO;
31using System.Linq; 32using System.Linq;
32using System.Net; 33using System.Net;
33using System.Reflection; 34using System.Reflection;
@@ -52,8 +53,6 @@ namespace OpenSim.Services.GridService
52 LogManager.GetLogger( 53 LogManager.GetLogger(
53 MethodBase.GetCurrentMethod().DeclaringType); 54 MethodBase.GetCurrentMethod().DeclaringType);
54 55
55 private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
56
57 private static uint m_autoMappingX = 0; 56 private static uint m_autoMappingX = 0;
58 private static uint m_autoMappingY = 0; 57 private static uint m_autoMappingY = 0;
59 private static bool m_enableAutoMapping = false; 58 private static bool m_enableAutoMapping = false;
@@ -65,6 +64,7 @@ namespace OpenSim.Services.GridService
65 64
66 protected UUID m_ScopeID = UUID.Zero; 65 protected UUID m_ScopeID = UUID.Zero;
67 protected bool m_Check4096 = true; 66 protected bool m_Check4096 = true;
67 protected string m_MapTileDirectory = string.Empty;
68 68
69 // Hyperlink regions are hyperlinks on the map 69 // Hyperlink regions are hyperlinks on the map
70 public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); 70 public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@@ -121,9 +121,24 @@ namespace OpenSim.Services.GridService
121 121
122 m_Check4096 = gridConfig.GetBoolean("Check4096", true); 122 m_Check4096 = gridConfig.GetBoolean("Check4096", true);
123 123
124 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty);
125
124 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); 126 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
125 127
126 m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); 128 m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
129 }
130
131 if (!string.IsNullOrEmpty(m_MapTileDirectory))
132 {
133 try
134 {
135 Directory.CreateDirectory(m_MapTileDirectory);
136 }
137 catch (Exception e)
138 {
139 m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e);
140 m_MapTileDirectory = string.Empty;
141 }
127 } 142 }
128 143
129 if (MainConsole.Instance != null) 144 if (MainConsole.Instance != null)
@@ -271,42 +286,22 @@ namespace OpenSim.Services.GridService
271 if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) 286 if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason))
272 return false; 287 return false;
273 288
274 if (regionID != UUID.Zero) 289 if (regionID == UUID.Zero)
275 {
276 region = m_GridService.GetRegionByUUID(scopeID, regionID);
277 if (region != null)
278 {
279 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
280 region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
281 regInfo = region;
282 return true;
283 }
284
285 regInfo.RegionID = regionID;
286
287 if ( externalName == string.Empty )
288 regInfo.RegionName = regInfo.ServerURI;
289 else
290 regInfo.RegionName = externalName;
291
292 m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
293
294 // Try get the map image
295 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
296 // I need a texture that works for this... the one I tried doesn't seem to be working
297 regInfo.TerrainImage = m_HGMapImage;
298
299 AddHyperlinkRegion(regInfo, handle);
300 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
301
302 }
303 else
304 { 290 {
305 m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); 291 m_log.Warn("[HYPERGRID LINKER]: Unable to link region");
306 reason = "Remote region could not be found"; 292 reason = "Remote region could not be found";
307 return false; 293 return false;
308 } 294 }
309 295
296 region = m_GridService.GetRegionByUUID(scopeID, regionID);
297 if (region != null)
298 {
299 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
300 region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
301 regInfo = region;
302 return true;
303 }
304
310 uint x, y; 305 uint x, y;
311 if (m_Check4096 && !Check4096(handle, out x, out y)) 306 if (m_Check4096 && !Check4096(handle, out x, out y))
312 { 307 {
@@ -316,7 +311,20 @@ namespace OpenSim.Services.GridService
316 return false; 311 return false;
317 } 312 }
318 313
319 m_log.Debug("[HYPERGRID LINKER]: link region succeeded"); 314 regInfo.RegionID = regionID;
315
316 if ( externalName == string.Empty )
317 regInfo.RegionName = regInfo.ServerURI;
318 else
319 regInfo.RegionName = externalName;
320
321 m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
322
323 // Get the map image
324 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
325
326 AddHyperlinkRegion(regInfo, handle);
327 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
320 return true; 328 return true;
321 } 329 }
322 330
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 05be7b8..4419201 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -123,42 +123,39 @@ namespace OpenSim.Services.HypergridService
123 externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); 123 externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : "");
124 imageURL = string.Empty; 124 imageURL = string.Empty;
125 reason = string.Empty; 125 reason = string.Empty;
126 126 GridRegion region = null;
127 127
128 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); 128 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName);
129 if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) 129 if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty)
130 { 130 {
131 List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); 131 List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID);
132 if (defs != null && defs.Count > 0) 132 if (defs != null && defs.Count > 0)
133 m_DefaultGatewayRegion = defs[0];
134
135 try
136 { 133 {
137 regionID = m_DefaultGatewayRegion.RegionID; 134 region = defs[0];
138 regionHandle = m_DefaultGatewayRegion.RegionHandle; 135 m_DefaultGatewayRegion = region;
139 } 136 }
140 catch 137 else
141 { 138 {
142 reason = "Grid setup problem. Try specifying a particular region here."; 139 reason = "Grid setup problem. Try specifying a particular region here.";
143 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!"); 140 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!");
144 return false; 141 return false;
145 } 142 }
146
147 return true;
148 } 143 }
149 144 else
150 GridRegion region = m_GridService.GetRegionByName(m_ScopeID, regionName);
151 if (region == null)
152 { 145 {
153 reason = "Region not found"; 146 region = m_GridService.GetRegionByName(m_ScopeID, regionName);
154 return false; 147 if (region == null)
148 {
149 reason = "Region not found";
150 return false;
151 }
155 } 152 }
156 153
157 regionID = region.RegionID; 154 regionID = region.RegionID;
158 regionHandle = region.RegionHandle; 155 regionHandle = region.RegionHandle;
159 string regionimage = "regionImage" + region.RegionID.ToString();
160 regionimage = regionimage.Replace("-", "");
161 156
157 string regionimage = "regionImage" + regionID.ToString();
158 regionimage = regionimage.Replace("-", "");
162 imageURL = region.ServerURI + "index.php?method=" + regionimage; 159 imageURL = region.ServerURI + "index.php?method=" + regionimage;
163 160
164 return true; 161 return true;