aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs134
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs44
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs201
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs252
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
-rw-r--r--OpenSim/Services/Connectors/Land/LandServicesConnector.cs19
-rw-r--r--OpenSim/Services/GridService/GridService.cs58
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs123
-rw-r--r--bin/OpenSim.ini.example5
-rw-r--r--bin/OpenSimDefaults.ini4
-rw-r--r--bin/config-include/osslEnable.ini5
16 files changed, 595 insertions, 366 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a6fd99f..b622523 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -414,6 +414,140 @@ namespace OpenSim.Framework
414 return regionCoord << 8; 414 return regionCoord << 8;
415 } 415 }
416 416
417 public static bool checkServiceURI(string uristr, out string serviceURI)
418 {
419 serviceURI = string.Empty;
420 try
421 {
422 Uri uri = new Uri(uristr);
423 serviceURI = uri.AbsoluteUri;
424 if(uri.Port == 80)
425 serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":80/";
426 else if(uri.Port == 443)
427 serviceURI = serviceURI.Trim(new char[] { '/', ' ' }) +":443/";
428 return true;
429 }
430 catch
431 {
432 serviceURI = string.Empty;
433 }
434 return false;
435 }
436
437 public static bool buildHGRegionURI(string inputName, out string serverURI, out string regionName)
438 {
439 serverURI = string.Empty;
440 regionName = string.Empty;
441
442 inputName = inputName.Trim();
443
444 if (!inputName.StartsWith("http") && !inputName.StartsWith("https"))
445 {
446 // Formats: grid.example.com:8002:region name
447 // grid.example.com:region name
448 // grid.example.com:8002
449 // grid.example.com
450
451 string host;
452 uint port = 80;
453
454 string[] parts = inputName.Split(new char[] { ':' });
455 int indx;
456 if(parts.Length == 0)
457 return false;
458 if (parts.Length == 1)
459 {
460 indx = inputName.IndexOf('/');
461 if (indx < 0)
462 serverURI = "http://"+ inputName + "/";
463 else
464 {
465 serverURI = "http://"+ inputName.Substring(0,indx + 1);
466 if(indx + 2 < inputName.Length)
467 regionName = inputName.Substring(indx + 1);
468 }
469 }
470 else
471 {
472 host = parts[0];
473
474 if (parts.Length >= 2)
475 {
476 indx = parts[1].IndexOf('/');
477 if(indx < 0)
478 {
479 // If it's a number then assume it's a port. Otherwise, it's a region name.
480 if (!UInt32.TryParse(parts[1], out port))
481 {
482 port = 80;
483 regionName = parts[1];
484 }
485 }
486 else
487 {
488 string portstr = parts[1].Substring(0, indx);
489 if(indx + 2 < parts[1].Length)
490 regionName = parts[1].Substring(indx + 1);
491 if (!UInt32.TryParse(portstr, out port))
492 port = 80;
493 }
494 }
495 // always take the last one
496 if (parts.Length >= 3)
497 {
498 regionName = parts[2];
499 }
500
501 serverURI = "http://"+ host +":"+ port.ToString() + "/";
502 }
503 }
504 else
505 {
506 // Formats: http://grid.example.com region name
507 // http://grid.example.com "region name"
508 // http://grid.example.com
509
510 string[] parts = inputName.Split(new char[] { ' ' });
511
512 if (parts.Length == 0)
513 return false;
514
515 serverURI = parts[0];
516
517 int indx = serverURI.LastIndexOf('/');
518 if(indx > 10)
519 {
520 if(indx + 2 < inputName.Length)
521 regionName = inputName.Substring(indx + 1);
522 serverURI = inputName.Substring(0, indx + 1);
523 }
524 else if (parts.Length >= 2)
525 {
526 regionName = inputName.Substring(serverURI.Length);
527 }
528 }
529
530 // use better code for sanity check
531 Uri uri;
532 try
533 {
534 uri = new Uri(serverURI);
535 }
536 catch
537 {
538 return false;
539 }
540
541 if(!string.IsNullOrEmpty(regionName))
542 regionName = regionName.Trim(new char[] { '"', ' ' });
543 serverURI = uri.AbsoluteUri;
544 if(uri.Port == 80)
545 serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/";
546 else if(uri.Port == 443)
547 serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/";
548 return true;
549 }
550
417 public static T Clamp<T>(T x, T min, T max) 551 public static T Clamp<T>(T x, T min, T max)
418 where T : IComparable<T> 552 where T : IComparable<T>
419 { 553 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 6873325..14a4873 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -994,7 +994,6 @@ namespace OpenSim.Region.ClientStack.Linden
994 994
995 pbs.TextureEntry = textureEntry.GetBytes(); 995 pbs.TextureEntry = textureEntry.GetBytes();
996 996
997 bool hasmesh = false;
998 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ... 997 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
999 { 998 {
1000 int meshindx = inner_instance_list["mesh"].AsInteger(); 999 int meshindx = inner_instance_list["mesh"].AsInteger();
@@ -1004,10 +1003,34 @@ namespace OpenSim.Region.ClientStack.Linden
1004 pbs.SculptType = (byte)SculptType.Mesh; 1003 pbs.SculptType = (byte)SculptType.Mesh;
1005 pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction 1004 pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
1006 // data will be requested from asset on rez (i hope) 1005 // data will be requested from asset on rez (i hope)
1007 hasmesh = true;
1008 } 1006 }
1009 } 1007 }
1010 1008
1009 // faces number to pbs shape
1010 switch(face_list.Count)
1011 {
1012 case 1:
1013 case 2:
1014 pbs.ProfileCurve = (byte)ProfileCurve.Circle;
1015 pbs.PathCurve = (byte)PathCurve.Circle;
1016 break;
1017
1018 case 3:
1019 case 4:
1020 pbs.ProfileCurve = (byte)ProfileCurve.Circle;
1021 pbs.PathCurve = (byte)PathCurve.Line;
1022 break;
1023 case 5:
1024 pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
1025 pbs.PathCurve = (byte)PathCurve.Line;
1026 break;
1027
1028 default:
1029 pbs.ProfileCurve = (byte)ProfileCurve.Square;
1030 pbs.PathCurve = (byte)PathCurve.Line;
1031 break;
1032 }
1033
1011 Vector3 position = inner_instance_list["position"].AsVector3(); 1034 Vector3 position = inner_instance_list["position"].AsVector3();
1012 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); 1035 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
1013 1036
@@ -1018,23 +1041,6 @@ namespace OpenSim.Region.ClientStack.Linden
1018// int material = inner_instance_list["material"].AsInteger(); 1041// int material = inner_instance_list["material"].AsInteger();
1019 byte material = (byte)Material.Wood; 1042 byte material = (byte)Material.Wood;
1020 1043
1021// no longer used - begin ------------------------
1022// int mesh = inner_instance_list["mesh"].AsInteger();
1023
1024// OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
1025// int base_mask = permissions["base_mask"].AsInteger();
1026// int everyone_mask = permissions["everyone_mask"].AsInteger();
1027// UUID creator_id = permissions["creator_id"].AsUUID();
1028// UUID group_id = permissions["group_id"].AsUUID();
1029// int group_mask = permissions["group_mask"].AsInteger();
1030// bool is_owner_group = permissions["is_owner_group"].AsBoolean();
1031// UUID last_owner_id = permissions["last_owner_id"].AsUUID();
1032// int next_owner_mask = permissions["next_owner_mask"].AsInteger();
1033// UUID owner_id = permissions["owner_id"].AsUUID();
1034// int owner_mask = permissions["owner_mask"].AsInteger();
1035// no longer used - end ------------------------
1036
1037
1038 SceneObjectPart prim 1044 SceneObjectPart prim
1039 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); 1045 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
1040 1046
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 5314927..57025bf 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
69 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); 69 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>();
70 70
71 private JsonRpcRequestManager rpc = new JsonRpcRequestManager(); 71 private JsonRpcRequestManager rpc = new JsonRpcRequestManager();
72 private bool m_allowUserProfileWebURLs = true;
72 73
73 public Scene Scene 74 public Scene Scene
74 { 75 {
@@ -159,7 +160,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
159 Enabled = false; 160 Enabled = false;
160 return; 161 return;
161 } 162 }
162 163
164 m_allowUserProfileWebURLs = profileConfig.GetBoolean("AllowUserProfileWebURLs", m_allowUserProfileWebURLs);
165
163 m_log.Debug("[PROFILES]: Full Profiles Enabled"); 166 m_log.Debug("[PROFILES]: Full Profiles Enabled");
164 ReplaceableInterface = null; 167 ReplaceableInterface = null;
165 Enabled = true; 168 Enabled = true;
@@ -316,37 +319,46 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
316 return; 319 return;
317 320
318 IClientAPI remoteClient = (IClientAPI)sender; 321 IClientAPI remoteClient = (IClientAPI)sender;
322 Dictionary<UUID, string> classifieds = new Dictionary<UUID, string>();
319 323
320 UUID targetID; 324 UUID targetID;
321 UUID.TryParse(args[0], out targetID); 325 if(!UUID.TryParse(args[0], out targetID) || targetID == UUID.Zero)
322 326 return;
323 327
324 ScenePresence p = FindPresence(targetID); 328 ScenePresence p = FindPresence(targetID);
325 if (p != null && p.isNPC) 329 if (p != null && p.isNPC)
326 { 330 {
327 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), new Dictionary<UUID, string>()); 331 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
328 return; 332 return;
329 } 333 }
330 334
331 string serverURI = string.Empty; 335 string serverURI = string.Empty;
332 GetUserProfileServerURI(targetID, out serverURI); 336 GetUserProfileServerURI(targetID, out serverURI);
333 UUID creatorId = UUID.Zero; 337 if(string.IsNullOrWhiteSpace(serverURI))
334 Dictionary<UUID, string> classifieds = new Dictionary<UUID, string>(); 338 {
339 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
340 return;
341 }
335 342
336 OSDMap parameters= new OSDMap(); 343 OSDMap parameters= new OSDMap();
337 UUID.TryParse(args[0], out creatorId); 344
338 parameters.Add("creatorId", OSD.FromUUID(creatorId)); 345 parameters.Add("creatorId", OSD.FromUUID(targetID));
339 OSD Params = (OSD)parameters; 346 OSD Params = (OSD)parameters;
340 if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) 347 if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
341 { 348 {
342 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); 349 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
343 return; 350 return;
344 } 351 }
345 352
346 parameters = (OSDMap)Params; 353 parameters = (OSDMap)Params;
347 354
348 OSDArray list = (OSDArray)parameters["result"]; 355 if(!parameters.ContainsKey("result") || parameters["result"] == null)
356 {
357 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
358 return;
359 }
349 360
361 OSDArray list = (OSDArray)parameters["result"];
350 362
351 foreach(OSD map in list) 363 foreach(OSD map in list)
352 { 364 {
@@ -360,7 +372,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
360 { 372 {
361 if (!m_classifiedCache.ContainsKey(cid)) 373 if (!m_classifiedCache.ContainsKey(cid))
362 { 374 {
363 m_classifiedCache.Add(cid,creatorId); 375 m_classifiedCache.Add(cid,targetID);
364 m_classifiedInterest.Add(cid, 0); 376 m_classifiedInterest.Add(cid, 0);
365 } 377 }
366 378
@@ -368,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
368 } 380 }
369 } 381 }
370 382
371 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); 383 remoteClient.SendAvatarClassifiedReply(targetID, classifieds);
372 } 384 }
373 385
374 public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient) 386 public void ClassifiedInfoRequest(UUID queryClassifiedID, IClientAPI remoteClient)
@@ -395,6 +407,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
395 407
396 string serverURI = string.Empty; 408 string serverURI = string.Empty;
397 GetUserProfileServerURI(target, out serverURI); 409 GetUserProfileServerURI(target, out serverURI);
410 if(string.IsNullOrWhiteSpace(serverURI))
411 {
412 return;
413 }
398 414
399 object Ad = (object)ad; 415 object Ad = (object)ad;
400 if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) 416 if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString()))
@@ -465,6 +481,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
465 481
466 string serverURI = string.Empty; 482 string serverURI = string.Empty;
467 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 483 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
484 if(string.IsNullOrWhiteSpace(serverURI))
485 {
486 return;
487 }
468 488
469 OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; 489 OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}};
470 OSD Params = (OSD)parameters; 490 OSD Params = (OSD)parameters;
@@ -531,10 +551,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
531 { 551 {
532 string serverURI = string.Empty; 552 string serverURI = string.Empty;
533 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 553 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
554 if(string.IsNullOrWhiteSpace(serverURI))
555 return;
534 556
535 UUID classifiedId; 557 UUID classifiedId;
558 if(!UUID.TryParse(queryClassifiedID.ToString(), out classifiedId))
559 return;
560
536 OSDMap parameters= new OSDMap(); 561 OSDMap parameters= new OSDMap();
537 UUID.TryParse(queryClassifiedID.ToString(), out classifiedId);
538 parameters.Add("classifiedId", OSD.FromUUID(classifiedId)); 562 parameters.Add("classifiedId", OSD.FromUUID(classifiedId));
539 OSD Params = (OSD)parameters; 563 OSD Params = (OSD)parameters;
540 if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString())) 564 if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString()))
@@ -569,33 +593,41 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
569 IClientAPI remoteClient = (IClientAPI)sender; 593 IClientAPI remoteClient = (IClientAPI)sender;
570 594
571 UUID targetId; 595 UUID targetId;
572 UUID.TryParse(args[0], out targetId); 596 if(!UUID.TryParse(args[0], out targetId))
597 return;
573 598
574 // Can't handle NPC yet... 599 Dictionary<UUID, string> picks = new Dictionary<UUID, string>();
575 ScenePresence p = FindPresence(targetId);
576 600
601 ScenePresence p = FindPresence(targetId);
577 if (p != null && p.isNPC) 602 if (p != null && p.isNPC)
578 { 603 {
579 remoteClient.SendAvatarPicksReply(new UUID(args[0]), new Dictionary<UUID, string>()); 604 remoteClient.SendAvatarPicksReply(targetId, picks);
580 return; 605 return;
581 } 606 }
582 607
583 string serverURI = string.Empty; 608 string serverURI = string.Empty;
584 GetUserProfileServerURI(targetId, out serverURI); 609 GetUserProfileServerURI(targetId, out serverURI);
585 610 if(string.IsNullOrWhiteSpace(serverURI))
586 Dictionary<UUID, string> picks = new Dictionary<UUID, string>(); 611 {
612 remoteClient.SendAvatarPicksReply(targetId, picks);
613 return;
614 }
587 615
588 OSDMap parameters= new OSDMap(); 616 OSDMap parameters= new OSDMap();
589 parameters.Add("creatorId", OSD.FromUUID(targetId)); 617 parameters.Add("creatorId", OSD.FromUUID(targetId));
590 OSD Params = (OSD)parameters; 618 OSD Params = (OSD)parameters;
591 if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString())) 619 if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString()))
592 { 620 {
593 remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); 621 remoteClient.SendAvatarPicksReply(targetId, picks);
594 return; 622 return;
595 } 623 }
596 624
597 parameters = (OSDMap)Params; 625 parameters = (OSDMap)Params;
598 626 if(!parameters.ContainsKey("result") || parameters["result"] == null)
627 {
628 remoteClient.SendAvatarPicksReply(targetId, picks);
629 return;
630 }
599 OSDArray list = (OSDArray)parameters["result"]; 631 OSDArray list = (OSDArray)parameters["result"];
600 632
601 foreach(OSD map in list) 633 foreach(OSD map in list)
@@ -603,12 +635,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
603 OSDMap m = (OSDMap)map; 635 OSDMap m = (OSDMap)map;
604 UUID cid = m["pickuuid"].AsUUID(); 636 UUID cid = m["pickuuid"].AsUUID();
605 string name = m["name"].AsString(); 637 string name = m["name"].AsString();
606
607 m_log.DebugFormat("[PROFILES]: PicksRequest {0}", name);
608
609 picks[cid] = name; 638 picks[cid] = name;
610 } 639 }
611 remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); 640 remoteClient.SendAvatarPicksReply(targetId, picks);
612 } 641 }
613 642
614 /// <summary> 643 /// <summary>
@@ -628,20 +657,27 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
628 if (!(sender is IClientAPI)) 657 if (!(sender is IClientAPI))
629 return; 658 return;
630 659
660 UserProfilePick pick = new UserProfilePick ();
631 UUID targetID; 661 UUID targetID;
632 UUID.TryParse (args [0], out targetID); 662 if(!UUID.TryParse(args [0], out targetID))
663 return;
664
665 pick.CreatorId = targetID;
666
667 if(!UUID.TryParse (args [1], out pick.PickId))
668 return;
669
633 string serverURI = string.Empty; 670 string serverURI = string.Empty;
634 GetUserProfileServerURI (targetID, out serverURI); 671 GetUserProfileServerURI (targetID, out serverURI);
672 if(string.IsNullOrWhiteSpace(serverURI))
673 {
674 return;
675 }
635 676
636 string theirGatekeeperURI; 677 string theirGatekeeperURI;
637 GetUserGatekeeperURI (targetID, out theirGatekeeperURI); 678 GetUserGatekeeperURI(targetID, out theirGatekeeperURI);
638 679
639 IClientAPI remoteClient = (IClientAPI)sender; 680 IClientAPI remoteClient = (IClientAPI)sender;
640
641 UserProfilePick pick = new UserProfilePick ();
642 UUID.TryParse (args [0], out pick.CreatorId);
643 UUID.TryParse (args [1], out pick.PickId);
644
645 681
646 object Pick = (object)pick; 682 object Pick = (object)pick;
647 if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) { 683 if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) {
@@ -652,13 +688,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
652 pick = (UserProfilePick)Pick; 688 pick = (UserProfilePick)Pick;
653 689
654 Vector3 globalPos = new Vector3(Vector3.Zero); 690 Vector3 globalPos = new Vector3(Vector3.Zero);
691 Vector3.TryParse(pick.GlobalPos, out globalPos);
655 692
656 // Smoke and mirrors 693 if (!string.IsNullOrWhiteSpace(MyGatekeeper) && pick.Gatekeeper != MyGatekeeper)
657 if (pick.Gatekeeper == MyGatekeeper)
658 {
659 Vector3.TryParse(pick.GlobalPos,out globalPos);
660 }
661 else
662 { 694 {
663 // Setup the illusion 695 // Setup the illusion
664 string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName); 696 string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName);
@@ -666,21 +698,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
666 698
667 if(target == null) 699 if(target == null)
668 { 700 {
669 // This is a dead or unreachable region 701 // This is a unreachable region
670 } 702 }
671 else 703 else
672 { 704 {
673 // Work our slight of hand 705 // we have a proxy on map
674 int x = target.RegionLocX; 706 // this is a fail on large regions
675 int y = target.RegionLocY; 707 uint gtmp = (uint)globalPos.X >> 8;
676 708 globalPos.X -= (gtmp << 8);
677 dynamic synthX = globalPos.X - (globalPos.X/Constants.RegionSize) * Constants.RegionSize; 709 globalPos.X += target.RegionLocX;
678 synthX += x; 710
679 globalPos.X = synthX; 711 gtmp = (uint)globalPos.Y >> 8;
680 712 globalPos.Y -= (gtmp << 8);
681 dynamic synthY = globalPos.Y - (globalPos.Y/Constants.RegionSize) * Constants.RegionSize; 713 globalPos.Y += target.RegionLocY;
682 synthY += y;
683 globalPos.Y = synthY;
684 } 714 }
685 } 715 }
686 716
@@ -730,6 +760,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
730 UserProfilePick pick = new UserProfilePick(); 760 UserProfilePick pick = new UserProfilePick();
731 string serverURI = string.Empty; 761 string serverURI = string.Empty;
732 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 762 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
763 if(string.IsNullOrWhiteSpace(serverURI))
764 {
765 return;
766 }
767
733 ScenePresence p = FindPresence(remoteClient.AgentId); 768 ScenePresence p = FindPresence(remoteClient.AgentId);
734 769
735 Vector3 avaPos = p.AbsolutePosition; 770 Vector3 avaPos = p.AbsolutePosition;
@@ -795,6 +830,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
795 { 830 {
796 string serverURI = string.Empty; 831 string serverURI = string.Empty;
797 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 832 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
833 if(string.IsNullOrWhiteSpace(serverURI))
834 {
835 return;
836 }
798 837
799 OSDMap parameters= new OSDMap(); 838 OSDMap parameters= new OSDMap();
800 parameters.Add("pickId", OSD.FromUUID(queryPickID)); 839 parameters.Add("pickId", OSD.FromUUID(queryPickID));
@@ -828,11 +867,19 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
828 if (!(sender is IClientAPI)) 867 if (!(sender is IClientAPI))
829 return; 868 return;
830 869
870 if(!UUID.TryParse(args[0], out note.TargetId))
871 return;
872
831 IClientAPI remoteClient = (IClientAPI)sender; 873 IClientAPI remoteClient = (IClientAPI)sender;
874 note.UserId = remoteClient.AgentId;
875
832 string serverURI = string.Empty; 876 string serverURI = string.Empty;
833 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 877 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
834 note.UserId = remoteClient.AgentId; 878 if(string.IsNullOrWhiteSpace(serverURI))
835 UUID.TryParse(args[0], out note.TargetId); 879 {
880 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
881 return;
882 }
836 883
837 object Note = (object)note; 884 object Note = (object)note;
838 if(!rpc.JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) 885 if(!rpc.JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString()))
@@ -840,8 +887,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
840 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); 887 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
841 return; 888 return;
842 } 889 }
843 note = (UserProfileNotes) Note; 890 note = (UserProfileNotes) Note;
844
845 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); 891 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
846 } 892 }
847 893
@@ -875,6 +921,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
875 921
876 string serverURI = string.Empty; 922 string serverURI = string.Empty;
877 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 923 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
924 if(string.IsNullOrWhiteSpace(serverURI))
925 return;
878 926
879 object Note = note; 927 object Note = note;
880 if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) 928 if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString()))
@@ -910,6 +958,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
910 958
911 string serverURI = string.Empty; 959 string serverURI = string.Empty;
912 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 960 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
961 if(string.IsNullOrWhiteSpace(serverURI))
962 return;
913 963
914 object Pref = pref; 964 object Pref = pref;
915 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString())) 965 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString()))
@@ -934,7 +984,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
934 984
935 string serverURI = string.Empty; 985 string serverURI = string.Empty;
936 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 986 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
937 987 if(string.IsNullOrWhiteSpace(serverURI))
988 return;
938 989
939 object Pref = (object)pref; 990 object Pref = (object)pref;
940 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString())) 991 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString()))
@@ -985,6 +1036,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
985 1036
986 string serverURI = string.Empty; 1037 string serverURI = string.Empty;
987 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 1038 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
1039 if(string.IsNullOrWhiteSpace(serverURI))
1040 return;
988 1041
989 object Param = prop; 1042 object Param = prop;
990 if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString())) 1043 if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
@@ -1004,13 +1057,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1004 return; 1057 return;
1005 } 1058 }
1006 1059
1007 // Can't handle NPC yet...
1008 ScenePresence p = FindPresence(avatarID); 1060 ScenePresence p = FindPresence(avatarID);
1009
1010 if (p != null && p.isNPC) 1061 if (p != null && p.isNPC)
1011 { 1062 {
1012 remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born, 1063 remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born,
1013 Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 16, 1064 Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 0x10,
1014 UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero); 1065 UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero);
1015 remoteClient.SendAvatarInterestsReply(avatarID, 0, "", 1066 remoteClient.SendAvatarInterestsReply(avatarID, 0, "",
1016 0, "Getting into trouble", "Droidspeak"); 1067 0, "Getting into trouble", "Droidspeak");
@@ -1033,19 +1084,15 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1033 } 1084 }
1034 1085
1035 Byte[] membershipType = new Byte[1]; 1086 Byte[] membershipType = new Byte[1];
1036 string born = String.Empty; 1087 string born = string.Empty;
1037 uint flags = 0x00; 1088 uint flags = 0x00;
1038 1089
1039 if (null != account) 1090 if (null != account)
1040 { 1091 {
1041 if (account.UserTitle == "") 1092 if (account.UserTitle == "")
1042 {
1043 membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8); 1093 membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8);
1044 }
1045 else 1094 else
1046 {
1047 membershipType = Utils.StringToBytes(account.UserTitle); 1095 membershipType = Utils.StringToBytes(account.UserTitle);
1048 }
1049 1096
1050 born = Util.ToDateTime(account.Created).ToString( 1097 born = Util.ToDateTime(account.Created).ToString(
1051 "M/d/yyyy", CultureInfo.InvariantCulture); 1098 "M/d/yyyy", CultureInfo.InvariantCulture);
@@ -1056,16 +1103,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1056 if (GetUserAccountData(avatarID, out userInfo) == true) 1103 if (GetUserAccountData(avatarID, out userInfo) == true)
1057 { 1104 {
1058 if ((string)userInfo["user_title"] == "") 1105 if ((string)userInfo["user_title"] == "")
1059 {
1060 membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8); 1106 membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8);
1061 }
1062 else 1107 else
1063 {
1064 membershipType = Utils.StringToBytes((string)userInfo["user_title"]); 1108 membershipType = Utils.StringToBytes((string)userInfo["user_title"]);
1065 }
1066 1109
1067 int val_born = (int)userInfo["user_created"]; 1110 int val_born = (int)userInfo["user_created"];
1068 born = Util.ToDateTime(val_born).ToString( 1111 if(val_born != 0)
1112 born = Util.ToDateTime(val_born).ToString(
1069 "M/d/yyyy", CultureInfo.InvariantCulture); 1113 "M/d/yyyy", CultureInfo.InvariantCulture);
1070 1114
1071 // picky, picky 1115 // picky, picky
@@ -1075,16 +1119,21 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1075 } 1119 }
1076 1120
1077 UserProfileProperties props = new UserProfileProperties(); 1121 UserProfileProperties props = new UserProfileProperties();
1078 string result = string.Empty;
1079
1080 props.UserId = avatarID; 1122 props.UserId = avatarID;
1081 1123
1082 if (!GetProfileData(ref props, foreign, out result)) 1124 string result = string.Empty;
1125 if(!GetProfileData(ref props, foreign, out result))
1083 { 1126 {
1084// m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result); 1127 props.AboutText ="Profile not avaible at this time. User may still be unknown to this grid";
1085 return;
1086 } 1128 }
1087 1129
1130 // if on same region force online
1131 if(p != null && !p.IsDeleted)
1132 flags |= 0x10;
1133
1134 if(!m_allowUserProfileWebURLs)
1135 props.WebUrl ="";
1136
1088 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags, 1137 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags,
1089 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); 1138 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
1090 1139
@@ -1115,6 +1164,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1115 prop.FirstLifeImageId = newProfile.FirstLifeImage; 1164 prop.FirstLifeImageId = newProfile.FirstLifeImage;
1116 prop.FirstLifeText = newProfile.FirstLifeAboutText; 1165 prop.FirstLifeText = newProfile.FirstLifeAboutText;
1117 1166
1167 if(!m_allowUserProfileWebURLs)
1168 prop.WebUrl ="";
1169
1118 string serverURI = string.Empty; 1170 string serverURI = string.Empty;
1119 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 1171 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
1120 1172
@@ -1153,12 +1205,11 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1153 1205
1154 string serverURI = string.Empty; 1206 string serverURI = string.Empty;
1155 GetUserProfileServerURI(properties.UserId, out serverURI); 1207 GetUserProfileServerURI(properties.UserId, out serverURI);
1156
1157 // This is checking a friend on the home grid 1208 // This is checking a friend on the home grid
1158 // Not HG friend 1209 // Not HG friend
1159 if (String.IsNullOrEmpty(serverURI)) 1210 if (String.IsNullOrEmpty(serverURI))
1160 { 1211 {
1161 message = "No Presence - foreign friend"; 1212 message = "User profile service unknown at this time";
1162 return false; 1213 return false;
1163 } 1214 }
1164 1215
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index b632146..1273f0d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -131,7 +131,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
131 131
132 uint rx = 0, ry = 0; 132 uint rx = 0, ry = 0;
133 Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry); 133 Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry);
134 134 rx += x;
135 ry += y;
135 foreach (Scene s in m_Scenes) 136 foreach (Scene s in m_Scenes)
136 { 137 {
137 uint t = s.RegionInfo.WorldLocX; 138 uint t = s.RegionInfo.WorldLocX;
@@ -147,6 +148,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
147 if( ry < t) 148 if( ry < t)
148 { 149 {
149// m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from"); 150// m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from");
151 x = rx - s.RegionInfo.WorldLocX;
152 y = ry - s.RegionInfo.WorldLocY;
150 regionAccess = s.RegionInfo.AccessLevel; 153 regionAccess = s.RegionInfo.AccessLevel;
151 return s.GetLandData(x, y); 154 return s.GetLandData(x, y);
152 } 155 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index e6e3abb..50e4c8a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
52 MethodBase.GetCurrentMethod().DeclaringType); 52 MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private bool m_Enabled = false; 54 private bool m_Enabled = false;
55 private string m_ThisGatekeeper = string.Empty;
55 56
56 private IGridService m_LocalGridService; 57 private IGridService m_LocalGridService;
57 private IGridService m_RemoteGridService; 58 private IGridService m_RemoteGridService;
@@ -118,13 +119,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
118 m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache); 119 m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache);
119 if (m_LocalGridService == null) 120 if (m_LocalGridService == null)
120 { 121 {
121 m_log.Error("[REMOTE GRID CONNECTOR]: failed to loar local connector"); 122 m_log.Error("[REMOTE GRID CONNECTOR]: failed to load local connector");
122 return false; 123 return false;
123 } 124 }
124 125
125 if(m_RegionInfoCache == null) 126 if(m_RegionInfoCache == null)
126 m_RegionInfoCache = new RegionInfoCache(); 127 m_RegionInfoCache = new RegionInfoCache();
127 128
129 m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
130 new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
131 // Legacy. Remove soon!
132 m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
133
134 Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper);
135
128 return true; 136 return true;
129 } 137 }
130 138
@@ -227,11 +235,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
227 return rinfo; 235 return rinfo;
228 } 236 }
229 237
230 public GridRegion GetRegionByName(UUID scopeID, string regionName) 238 public GridRegion GetRegionByName(UUID scopeID, string name)
231 { 239 {
232 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); 240 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name);
233 if (rinfo != null) 241 if (rinfo != null)
234 return rinfo; 242 return rinfo;
243
244 // HG urls should not get here, strip them
245 // side effect is that local regions with same name as HG may also be found
246 // this mb good or bad
247 string regionName = name;
248 if(name.Contains("."))
249 {
250 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
251 return rinfo; // no HG
252
253 string regionURI = "";
254 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
255 return rinfo; // invalid
256 if(m_ThisGatekeeper != regionURI)
257 return rinfo; // not local grid
258 }
235 259
236 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); 260 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
237 m_RegionInfoCache.Cache(scopeID, rinfo); 261 m_RegionInfoCache.Cache(scopeID, rinfo);
@@ -242,7 +266,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
242 { 266 {
243 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); 267 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
244 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); 268 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);
245 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber); 269
270 // HG urls should not get here, strip them
271 // side effect is that local regions with same name as HG may also be found
272 // this mb good or bad
273 string regionName = name;
274 if(name.Contains("."))
275 {
276 if(string.IsNullOrWhiteSpace(m_ThisGatekeeper))
277 return rinfo; // no HG
278
279 string regionURI = "";
280 if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName))
281 return rinfo; // invalid
282 if(m_ThisGatekeeper != regionURI)
283 return rinfo; // not local grid
284 }
285
286 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);
246 287
247 if (grinfo != null) 288 if (grinfo != null)
248 { 289 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7efdc62..eeaec42 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -15010,7 +15010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15010 int rejectTypes = 0; 15010 int rejectTypes = 0;
15011 int dataFlags = 0; 15011 int dataFlags = 0;
15012 int maxHits = 1; 15012 int maxHits = 1;
15013 bool detectPhantom = false; 15013 bool notdetectPhantom = true;
15014 for (int i = 0; i < options.Length; i += 2) 15014 for (int i = 0; i < options.Length; i += 2)
15015 { 15015 {
15016 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES) 15016 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
@@ -15020,7 +15020,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15020 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS) 15020 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
15021 maxHits = options.GetLSLIntegerItem(i + 1); 15021 maxHits = options.GetLSLIntegerItem(i + 1);
15022 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM) 15022 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
15023 detectPhantom = (options.GetLSLIntegerItem(i + 1) != 0); 15023 notdetectPhantom = (options.GetLSLIntegerItem(i + 1) == 0);
15024 } 15024 }
15025 if (maxHits > m_maxHitsInCastRay) 15025 if (maxHits > m_maxHitsInCastRay)
15026 maxHits = m_maxHitsInCastRay; 15026 maxHits = m_maxHitsInCastRay;
@@ -15050,157 +15050,159 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
15050 World.ForEachSOG( 15050 World.ForEachSOG(
15051 delegate(SceneObjectGroup group) 15051 delegate(SceneObjectGroup group)
15052 { 15052 {
15053 if(group.IsDeleted || group.RootPart == null)
15054 return;
15053 // Check group filters unless part filters are configured 15055 // Check group filters unless part filters are configured
15054 bool isPhysical = (group.RootPart != null && group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical); 15056 bool isPhysical = (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical);
15055 bool isNonphysical = !isPhysical; 15057 bool isNonphysical = !isPhysical;
15056 bool isPhantom = group.IsPhantom || group.IsVolumeDetect; 15058 bool isPhantom = group.IsPhantom || group.IsVolumeDetect;
15057 bool isAttachment = group.IsAttachment; 15059 bool isAttachment = group.IsAttachment;
15058 bool doGroup = true;
15059 if (isPhysical && rejectPhysical) 15060 if (isPhysical && rejectPhysical)
15060 doGroup = false; 15061 return;
15061 if (isNonphysical && rejectNonphysical) 15062 if (isNonphysical && rejectNonphysical)
15062 doGroup = false; 15063 return;
15063 if (isPhantom && detectPhantom) 15064 if (isPhantom && notdetectPhantom)
15064 doGroup = true; 15065 return;
15065 if (m_filterPartsInCastRay) 15066 if (m_filterPartsInCastRay)
15066 doGroup = true; 15067 return;
15067 if (isAttachment && !m_doAttachmentsInCastRay) 15068 if (isAttachment && !m_doAttachmentsInCastRay)
15068 doGroup = false; 15069 return;
15070
15069 // Parse object/group if passed filters 15071 // Parse object/group if passed filters
15070 if (doGroup) 15072 // Iterate over all prims/parts in object/group
15073 foreach(SceneObjectPart part in group.Parts)
15071 { 15074 {
15072 // Iterate over all prims/parts in object/group 15075 // Check part filters if configured
15073 foreach(SceneObjectPart part in group.Parts) 15076 if (m_filterPartsInCastRay)
15074 { 15077 {
15075 // Check part filters if configured 15078 // ignore PhysicsShapeType.None as physics engines do
15076 if (m_filterPartsInCastRay) 15079 // or we will get into trouble in future
15080 if(part.PhysicsShapeType == (byte)PhysicsShapeType.None)
15081 continue;
15082 isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical);
15083 isNonphysical = !isPhysical;
15084 isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) ||
15085 (part.VolumeDetectActive);
15086
15087 if (isPhysical && rejectPhysical)
15088 continue;
15089 if (isNonphysical && rejectNonphysical)
15090 continue;
15091 if (isPhantom && notdetectPhantom)
15092 continue;
15093 }
15094
15095 // Parse prim/part and project ray if passed filters
15096 Vector3 scalePart = part.Scale;
15097 Vector3 posPart = part.GetWorldPosition();
15098 Quaternion rotPart = part.GetWorldRotation();
15099 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
15100 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
15101 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
15102
15103 // Filter parts by shape bounding boxes
15104 Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f);
15105 if (!part.Shape.SculptEntry)
15106 shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ));
15107 shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol));
15108 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
15109 {
15110 // Prepare data needed to check for ray hits
15111 RayTrans rayTrans = new RayTrans();
15112 rayTrans.PartId = part.UUID;
15113 rayTrans.GroupId = part.ParentGroup.UUID;
15114 rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0;
15115 rayTrans.ScalePart = scalePart;
15116 rayTrans.PositionPart = posPart;
15117 rayTrans.RotationPart = rotPart;
15118 rayTrans.ShapeNeedsEnds = true;
15119 rayTrans.Position1Ray = pos1Ray;
15120 rayTrans.Position1RayProj = pos1RayProj;
15121 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
15122
15123 // Get detail level depending on type
15124 int lod = 0;
15125 // Mesh detail level
15126 if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15127 lod = (int)m_meshLodInCastRay;
15128 // Sculpt detail level
15129 else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15130 lod = (int)m_sculptLodInCastRay;
15131 // Shape detail level
15132 else if (!part.Shape.SculptEntry)
15133 lod = (int)m_primLodInCastRay;
15134
15135 // Try to get cached mesh if configured
15136 ulong meshKey = 0;
15137 FacetedMesh mesh = null;
15138 if (m_useMeshCacheInCastRay)
15077 { 15139 {
15078 isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical); 15140 meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod));
15079 isNonphysical = !isPhysical; 15141 lock (m_cachedMeshes)
15080 isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || (part.VolumeDetectActive); 15142 {
15081 bool doPart = true; 15143 m_cachedMeshes.TryGetValue(meshKey, out mesh);
15082 if (isPhysical && rejectPhysical) 15144 }
15083 doPart = false;
15084 if (isNonphysical && rejectNonphysical)
15085 doPart = false;
15086 if (isPhantom && detectPhantom)
15087 doPart = true;
15088 if (!doPart)
15089 continue;
15090 } 15145 }
15091 15146
15092 // Parse prim/part and project ray if passed filters 15147 // Create mesh if no cached mesh
15093 Vector3 scalePart = part.Scale; 15148 if (mesh == null)
15094 Vector3 posPart = part.GetWorldPosition();
15095 Quaternion rotPart = part.GetWorldRotation();
15096 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
15097 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
15098 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
15099
15100 // Filter parts by shape bounding boxes
15101 Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f);
15102 if (!part.Shape.SculptEntry)
15103 shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ));
15104 shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol));
15105 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
15106 { 15149 {
15107 // Prepare data needed to check for ray hits 15150 // Make an OMV prim to be able to mesh part
15108 RayTrans rayTrans = new RayTrans(); 15151 Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart);
15109 rayTrans.PartId = part.UUID; 15152 byte[] sculptAsset = null;
15110 rayTrans.GroupId = part.ParentGroup.UUID; 15153 if (omvPrim.Sculpt != null)
15111 rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0; 15154 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
15112 rayTrans.ScalePart = scalePart; 15155
15113 rayTrans.PositionPart = posPart; 15156 // When part is mesh, get mesh
15114 rayTrans.RotationPart = rotPart; 15157 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
15115 rayTrans.ShapeNeedsEnds = true;
15116 rayTrans.Position1Ray = pos1Ray;
15117 rayTrans.Position1RayProj = pos1RayProj;
15118 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
15119
15120 // Get detail level depending on type
15121 int lod = 0;
15122 // Mesh detail level
15123 if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15124 lod = (int)m_meshLodInCastRay;
15125 // Sculpt detail level
15126 else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15127 lod = (int)m_sculptLodInCastRay;
15128 // Shape detail level
15129 else if (!part.Shape.SculptEntry)
15130 lod = (int)m_primLodInCastRay;
15131
15132 // Try to get cached mesh if configured
15133 ulong meshKey = 0;
15134 FacetedMesh mesh = null;
15135 if (m_useMeshCacheInCastRay)
15136 { 15158 {
15137 meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod)); 15159 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
15138 lock (m_cachedMeshes) 15160 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh);
15139 { 15161 meshAsset = null;
15140 m_cachedMeshes.TryGetValue(meshKey, out mesh);
15141 }
15142 } 15162 }
15143 15163
15144 // Create mesh if no cached mesh 15164 // When part is sculpt, create mesh
15145 if (mesh == null) 15165 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
15166 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
15146 { 15167 {
15147 // Make an OMV prim to be able to mesh part 15168 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>();
15148 Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart); 15169 if (imgDecoder != null)
15149 byte[] sculptAsset = null;
15150 if (omvPrim.Sculpt != null)
15151 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
15152
15153 // When part is mesh, get mesh
15154 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
15155 {
15156 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
15157 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh);
15158 meshAsset = null;
15159 }
15160
15161 // When part is sculpt, create mesh
15162 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
15163 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
15164 { 15170 {
15165 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>(); 15171 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
15166 if (imgDecoder != null) 15172 if (sculpt != null)
15167 { 15173 {
15168 Image sculpt = imgDecoder.DecodeToImage(sculptAsset); 15174 mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay);
15169 if (sculpt != null) 15175 sculpt.Dispose();
15170 {
15171 mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay);
15172 sculpt.Dispose();
15173 }
15174 } 15176 }
15175 }
15176
15177 // When part is shape, create mesh
15178 else if (omvPrim.Sculpt == null)
15179 {
15180 if (
15181 omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 &&
15182 omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 &&
15183 omvPrim.PrimData.PathSkew == 0.0 &&
15184 omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0
15185 )
15186 rayTrans.ShapeNeedsEnds = false;
15187 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay);
15188 } 15177 }
15178 }
15189 15179
15190 // Cache mesh if configured 15180 // When part is shape, create mesh
15191 if (m_useMeshCacheInCastRay && mesh != null) 15181 else if (omvPrim.Sculpt == null)
15182 {
15183 if (
15184 omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 &&
15185 omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 &&
15186 omvPrim.PrimData.PathSkew == 0.0 &&
15187 omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0
15188 )
15189 rayTrans.ShapeNeedsEnds = false;
15190 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay);
15191 }
15192
15193 // Cache mesh if configured
15194 if (m_useMeshCacheInCastRay && mesh != null)
15195 {
15196 lock(m_cachedMeshes)
15192 { 15197 {
15193 lock(m_cachedMeshes) 15198 if (!m_cachedMeshes.ContainsKey(meshKey))
15194 { 15199 m_cachedMeshes.Add(meshKey, mesh);
15195 if (!m_cachedMeshes.ContainsKey(meshKey))
15196 m_cachedMeshes.Add(meshKey, mesh);
15197 }
15198 } 15200 }
15199 } 15201 }
15200 // Check mesh for ray hits
15201 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
15202 mesh = null;
15203 } 15202 }
15203 // Check mesh for ray hits
15204 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
15205 mesh = null;
15204 } 15206 }
15205 } 15207 }
15206 } 15208 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 9742119..c83682e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1874,6 +1874,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1874 "dataserver", resobj, new DetectParams[0])); 1874 "dataserver", resobj, new DetectParams[0]));
1875 } 1875 }
1876 1876
1877
1878 /// <summary>
1879 /// Similar to llDie but given an object UUID
1880 /// </summary>
1881 /// <param name="objectUUID"></param>
1882
1883 public void osDie(LSL_Key objectUUID)
1884 {
1885// CheckThreatLevel(ThreatLevel.VeryHigh, "osDie");
1886 // if this is restricted to objects rezzed by this host level can be reduced
1887
1888 CheckThreatLevel(ThreatLevel.Low, "osDie");
1889 m_host.AddScriptLPS(1);
1890
1891 UUID objUUID;
1892 if (!UUID.TryParse(objectUUID, out objUUID))
1893 {
1894 OSSLShoutError("osDie() cannot delete objects with invalid UUIDs");
1895 return;
1896 }
1897
1898 // harakiri check
1899 if(objUUID == UUID.Zero)
1900 {
1901 if (!m_host.ParentGroup.IsAttachment)
1902 throw new SelfDeleteException();
1903 return;
1904 }
1905
1906 SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID);
1907
1908 if (sceneOG == null || sceneOG.IsDeleted)
1909 return;
1910
1911 if(sceneOG.IsAttachment)
1912 return;
1913
1914 if (sceneOG.OwnerID != m_host.OwnerID)
1915 return;
1916
1917 // harakiri check
1918 if(sceneOG.UUID == m_host.ParentGroup.UUID)
1919 throw new SelfDeleteException();
1920
1921 // restrict to objects rezzed by host
1922 if(sceneOG.RezzerID == m_host.ParentGroup.UUID)
1923 World.DeleteSceneObject(sceneOG, false);
1924 }
1925
1877 /// <summary> 1926 /// <summary>
1878 /// Write a notecard directly to the prim's inventory. 1927 /// Write a notecard directly to the prim's inventory.
1879 /// </summary> 1928 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index cf3e6df..7415fea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -317,6 +317,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
317 void osForceBreakAllLinks(); 317 void osForceBreakAllLinks();
318 318
319 /// <summary> 319 /// <summary>
320 /// Similar to llDie but given an object UUID
321 /// </summary>
322 /// <param name="objectUUID"></param>
323
324 void osDie(LSL_Key objectUUID);
325
326 /// <summary>
320 /// Check if the given key is an npc 327 /// Check if the given key is an npc
321 /// </summary> 328 /// </summary>
322 /// <param name="npc"></param> 329 /// <param name="npc"></param>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 734d878..903b362 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -643,6 +643,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
643 public const int OBJECT_REZZER_KEY = 32; 643 public const int OBJECT_REZZER_KEY = 32;
644 public const int OBJECT_GROUP_TAG = 33; 644 public const int OBJECT_GROUP_TAG = 33;
645 public const int OBJECT_TEMP_ATTACHED = 34; 645 public const int OBJECT_TEMP_ATTACHED = 34;
646 public const int OBJECT_ATTACHED_SLOTS_AVAILABLE = 35;
646 647
647 // Pathfinding types 648 // Pathfinding types
648 public const int OPT_OTHER = -1; 649 public const int OPT_OTHER = -1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 2e8a76c..c34ccd0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -577,6 +577,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
577 m_OSSL_Functions.osForceBreakAllLinks(); 577 m_OSSL_Functions.osForceBreakAllLinks();
578 } 578 }
579 579
580 public void osDie(LSL_Key objectUUID)
581 {
582 m_OSSL_Functions.osDie(objectUUID);
583 }
584
580 public LSL_Integer osIsNpc(LSL_Key npc) 585 public LSL_Integer osIsNpc(LSL_Key npc)
581 { 586 {
582 return m_OSSL_Functions.osIsNpc(npc); 587 return m_OSSL_Functions.osIsNpc(npc);
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
index 7839a68..5e9331e 100644
--- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
@@ -66,22 +66,31 @@ namespace OpenSim.Services.Connectors
66 public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) 66 public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess)
67 { 67 {
68 LandData landData = null; 68 LandData landData = null;
69 Hashtable hash = new Hashtable();
70 hash["region_handle"] = regionHandle.ToString();
71 hash["x"] = x.ToString();
72 hash["y"] = y.ToString();
73 69
74 IList paramList = new ArrayList(); 70 IList paramList = new ArrayList();
75 paramList.Add(hash);
76 regionAccess = 42; // Default to adult. Better safe... 71 regionAccess = 42; // Default to adult. Better safe...
77 72
78 try 73 try
79 { 74 {
80 uint xpos = 0, ypos = 0; 75 uint xpos = 0, ypos = 0;
81 Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); 76 Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos);
77
82 GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); 78 GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos);
83 if (info != null) // just to be sure 79 if (info != null) // just to be sure
84 { 80 {
81 string targetHandlestr = info.RegionHandle.ToString();
82 if( ypos == 0 ) //HG proxy?
83 {
84 // this is real region handle on hg proxies hack
85 targetHandlestr = info.RegionSecret;
86 }
87
88 Hashtable hash = new Hashtable();
89 hash["region_handle"] = targetHandlestr;
90 hash["x"] = x.ToString();
91 hash["y"] = y.ToString();
92 paramList.Add(hash);
93
85 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); 94 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
86 XmlRpcResponse response = request.Send(info.ServerURI, 10000); 95 XmlRpcResponse response = request.Send(info.ServerURI, 10000);
87 if (response.IsFault) 96 if (response.IsFault)
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 31a186a..aa13a67 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -57,9 +57,6 @@ namespace OpenSim.Services.GridService
57 protected bool m_AllowDuplicateNames = false; 57 protected bool m_AllowDuplicateNames = false;
58 protected bool m_AllowHypergridMapSearch = false; 58 protected bool m_AllowHypergridMapSearch = false;
59 59
60
61 protected bool m_SuppressVarregionOverlapCheckOnRegistration = false;
62
63 private static Dictionary<string,object> m_ExtraFeatures = new Dictionary<string, object>(); 60 private static Dictionary<string,object> m_ExtraFeatures = new Dictionary<string, object>();
64 61
65 public GridService(IConfigSource config) 62 public GridService(IConfigSource config)
@@ -86,8 +83,6 @@ namespace OpenSim.Services.GridService
86 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); 83 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
87 m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); 84 m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
88 85
89 m_SuppressVarregionOverlapCheckOnRegistration = gridConfig.GetBoolean("SuppressVarregionOverlapCheckOnRegistration", m_SuppressVarregionOverlapCheckOnRegistration);
90
91 // This service is also used locally by a simulator running in grid mode. This switches prevents 86 // This service is also used locally by a simulator running in grid mode. This switches prevents
92 // inappropriate console commands from being registered 87 // inappropriate console commands from being registered
93 suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands); 88 suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands);
@@ -202,6 +197,9 @@ namespace OpenSim.Services.GridService
202 if (regionInfos.RegionID == UUID.Zero) 197 if (regionInfos.RegionID == UUID.Zero)
203 return "Invalid RegionID - cannot be zero UUID"; 198 return "Invalid RegionID - cannot be zero UUID";
204 199
200 if (regionInfos.RegionLocY <= Constants.MaximumRegionSize)
201 return "Region location reserved for HG links coord Y must be higher than " + (Constants.MaximumRegionSize/256).ToString();
202
205 String reason = "Region overlaps another region"; 203 String reason = "Region overlaps another region";
206 204
207 List<RegionData> rdatas = m_Database.Get( 205 List<RegionData> rdatas = m_Database.Get(
@@ -295,7 +293,7 @@ namespace OpenSim.Services.GridService
295 293
296 // Region reregistering in other coordinates. Delete the old entry 294 // Region reregistering in other coordinates. Delete the old entry
297 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 295 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
298 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 296 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY);
299 297
300 try 298 try
301 { 299 {
@@ -505,10 +503,16 @@ namespace OpenSim.Services.GridService
505 { 503 {
506 string regionURI = ""; 504 string regionURI = "";
507 string regionName = ""; 505 string regionName = "";
508 if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) 506 if(!Util.buildHGRegionURI(name, out regionURI, out regionName))
509 return null; 507 return null;
510 508
511 string mapname = regionURI + regionName; 509 string mapname;
510 bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI);
511 if(localGrid)
512 mapname = regionName;
513 else
514 mapname = regionURI + regionName;
515
512 bool haveMatch = false; 516 bool haveMatch = false;
513 517
514 if (rdatas != null && (rdatas.Count > 0)) 518 if (rdatas != null && (rdatas.Count > 0))
@@ -531,7 +535,7 @@ namespace OpenSim.Services.GridService
531 if(haveMatch) 535 if(haveMatch)
532 return rinfos; 536 return rinfos;
533 } 537 }
534 538
535 rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID); 539 rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID);
536 if (rdatas != null && (rdatas.Count > 0)) 540 if (rdatas != null && (rdatas.Count > 0))
537 { 541 {
@@ -554,14 +558,16 @@ namespace OpenSim.Services.GridService
554 if(haveMatch) 558 if(haveMatch)
555 return rinfos; 559 return rinfos;
556 } 560 }
557 561 if(!localGrid && !string.IsNullOrWhiteSpace(regionURI))
558 string HGname = regionURI +" "+ regionName;
559 GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
560 if (r != null)
561 { 562 {
562 if( count == maxNumber) 563 string HGname = regionURI +" "+ regionName; // include space for compatibility
563 rinfos.RemoveAt(count - 1); 564 GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
564 rinfos.Add(r); 565 if (r != null)
566 {
567 if( count == maxNumber)
568 rinfos.RemoveAt(count - 1);
569 rinfos.Add(r);
570 }
565 } 571 }
566 } 572 }
567 else if (rdatas != null && (rdatas.Count > 0)) 573 else if (rdatas != null && (rdatas.Count > 0))
@@ -589,19 +595,27 @@ namespace OpenSim.Services.GridService
589 { 595 {
590 string regionURI = ""; 596 string regionURI = "";
591 string regionName = ""; 597 string regionName = "";
592 if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName)) 598 if(!Util.buildHGRegionURI(name, out regionURI, out regionName))
593 return null; 599 return null;
594 600
595 string mapname = regionURI + regionName; 601 string mapname;
602 bool localGrid = m_HypergridLinker.IsLocalGrid(regionURI);
603 if(localGrid)
604 mapname = regionName;
605 else
606 mapname = regionURI + regionName;
607
596 List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID); 608 List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID);
597 if ((rdatas != null) && (rdatas.Count > 0)) 609 if ((rdatas != null) && (rdatas.Count > 0))
598 return RegionData2RegionInfo(rdatas[0]); // get the first 610 return RegionData2RegionInfo(rdatas[0]); // get the first
599 611
600 string HGname = regionURI +" "+ regionName; 612 if(!localGrid && !string.IsNullOrWhiteSpace(regionURI))
601 return m_HypergridLinker.LinkRegion(scopeID, HGname); 613 {
614 string HGname = regionURI +" "+ regionName;
615 return m_HypergridLinker.LinkRegion(scopeID, HGname);
616 }
602 } 617 }
603 else 618 return null;
604 return null;
605 } 619 }
606 620
607 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 621 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index ceb2c6e..aa394ce 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -137,6 +137,12 @@ namespace OpenSim.Services.GridService
137 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); 137 m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
138 } 138 }
139 139
140 m_ThisGatekeeper = m_ThisGatekeeperURI.AbsoluteUri;
141 if(m_ThisGatekeeperURI.Port == 80)
142 m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":80/";
143 else if(m_ThisGatekeeperURI.Port == 443)
144 m_ThisGatekeeper = m_ThisGatekeeper.Trim(new char[] { '/', ' ' }) +":443/";
145
140 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); 146 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
141 147
142 m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); 148 m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@@ -190,119 +196,10 @@ namespace OpenSim.Services.GridService
190 { 196 {
191 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 197 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
192 } 198 }
193 199
194 public bool buildHGRegionURI(string inputName, out string serverURI, out string regionName) 200 public bool IsLocalGrid(string serverURI)
195 { 201 {
196 serverURI = string.Empty; 202 return serverURI == m_ThisGatekeeper;
197 regionName = string.Empty;
198
199 inputName = inputName.Trim();
200
201 if (!inputName.StartsWith("http") && !inputName.StartsWith("https"))
202 {
203 // Formats: grid.example.com:8002:region name
204 // grid.example.com:region name
205 // grid.example.com:8002
206 // grid.example.com
207
208 string host;
209 uint port = 80;
210
211 string[] parts = inputName.Split(new char[] { ':' });
212 int indx;
213 if(parts.Length == 0)
214 return false;
215 if (parts.Length == 1)
216 {
217 indx = inputName.IndexOf('/');
218 if (indx < 0)
219 serverURI = "http://"+ inputName + "/";
220 else
221 {
222 serverURI = "http://"+ inputName.Substring(0,indx + 1);
223 if(indx + 2 < inputName.Length)
224 regionName = inputName.Substring(indx + 1);
225 }
226 }
227 else
228 {
229 host = parts[0];
230
231 if (parts.Length >= 2)
232 {
233 indx = parts[1].IndexOf('/');
234 if(indx < 0)
235 {
236 // If it's a number then assume it's a port. Otherwise, it's a region name.
237 if (!UInt32.TryParse(parts[1], out port))
238 {
239 port = 80;
240 regionName = parts[1];
241 }
242 }
243 else
244 {
245 string portstr = parts[1].Substring(0, indx);
246 if(indx + 2 < parts[1].Length)
247 regionName = parts[1].Substring(indx + 1);
248 if (!UInt32.TryParse(portstr, out port))
249 port = 80;
250 }
251 }
252 // always take the last one
253 if (parts.Length >= 3)
254 {
255 regionName = parts[2];
256 }
257
258 serverURI = "http://"+ host +":"+ port.ToString() + "/";
259 }
260 }
261 else
262 {
263 // Formats: http://grid.example.com region name
264 // http://grid.example.com "region name"
265 // http://grid.example.com
266
267 string[] parts = inputName.Split(new char[] { ' ' });
268
269 if (parts.Length == 0)
270 return false;
271
272 serverURI = parts[0];
273
274 int indx = serverURI.LastIndexOf('/');
275 if(indx > 10)
276 {
277 if(indx + 2 < inputName.Length)
278 regionName = inputName.Substring(indx + 1);
279 serverURI = inputName.Substring(0, indx + 1);
280 }
281 else if (parts.Length >= 2)
282 {
283 regionName = inputName.Substring(serverURI.Length);
284 }
285 }
286
287 // use better code for sanity check
288 Uri uri;
289 try
290 {
291 uri = new Uri(serverURI);
292 }
293 catch
294 {
295 return false;
296 }
297
298 if(!string.IsNullOrEmpty(regionName))
299 regionName = regionName.Trim(new char[] { '"', ' ' });
300 serverURI = uri.AbsoluteUri;
301 if(uri.Port == 80)
302 serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":80/";
303 else if(uri.Port == 443)
304 serverURI = serverURI.Trim(new char[] { '/', ' ' }) +":443/";
305 return true;
306 } 203 }
307 204
308 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 205 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
@@ -313,7 +210,7 @@ namespace OpenSim.Services.GridService
313 string serverURI = string.Empty; 210 string serverURI = string.Empty;
314 string regionName = string.Empty; 211 string regionName = string.Empty;
315 212
316 if(!buildHGRegionURI(mapName, out serverURI, out regionName)) 213 if(!Util.buildHGRegionURI(mapName, out serverURI, out regionName))
317 { 214 {
318 reason = "Wrong URI format for link-region"; 215 reason = "Wrong URI format for link-region";
319 return null; 216 return null;
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 7426980..0544f36 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1202,6 +1202,11 @@
1202 ;; Set the value of the url to your UserProfilesService 1202 ;; Set the value of the url to your UserProfilesService
1203 ;; If un-set / "" the module is disabled 1203 ;; If un-set / "" the module is disabled
1204 ;; ProfileServiceURL = ${Const|BaseURL}:${Const|PublicPort} 1204 ;; ProfileServiceURL = ${Const|BaseURL}:${Const|PublicPort}
1205
1206 ;# {AllowUserProfileWebURLs} {} {allow user profiles web urls} {true false} true
1207 ;; set this to false to prevent your users to be sent to unknown
1208 ;; web sites by other users on their profiles
1209 ; AllowUserProfileWebURLs = true
1205 1210
1206[XBakes] 1211[XBakes]
1207 ;# {URL} {} {Set URL for Baked texture service} {} 1212 ;# {URL} {} {Set URL for Baked texture service} {}
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index a8566e2..fa491fc 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -552,6 +552,10 @@
552 ;; points to your grid's Robust user profiles service 552 ;; points to your grid's Robust user profiles service
553 ;; 553 ;;
554 ; ProfileURL = http://127.0.0.1:9000 554 ; ProfileURL = http://127.0.0.1:9000
555
556 ;; set this to false to prevent your users to be sent to unknown
557 ;; web sites by other users on their profiles
558 ; AllowUserProfileWebURLs = true
555 559
556 560
557[SMTP] 561[SMTP]
diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini
index 59a162a..a064f09 100644
--- a/bin/config-include/osslEnable.ini
+++ b/bin/config-include/osslEnable.ini
@@ -139,8 +139,9 @@
139 Allow_osMessageObject = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER 139 Allow_osMessageObject = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
140 Allow_osRegexIsMatch = true 140 Allow_osRegexIsMatch = true
141 Allow_osGetAvatarHomeURI = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER 141 Allow_osGetAvatarHomeURI = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
142 Allow_osNpcSetProfileAbout = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER 142 Allow_osNpcSetProfileAbout = ${XEngine|osslNPC}
143 Allow_osNpcSetProfileImage = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER 143 Allow_osNpcSetProfileImage = ${XEngine|osslNPC}
144 Allow_osDie = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
144 145
145 ; ThreatLevel Moderate 146 ; ThreatLevel Moderate
146 Allow_osDropAttachment = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER 147 Allow_osDropAttachment = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER