diff options
author | opensim mirror account | 2010-11-16 18:00:07 -0800 |
---|---|---|
committer | opensim mirror account | 2010-11-16 18:00:07 -0800 |
commit | 36495f699220a766f7a0b9184867f25804d582d9 (patch) | |
tree | 1f407cd17905a436724d503c314885807aaa98b3 | |
parent | Merge branch 'master' of /var/git/opensim/ (diff) | |
parent | Add osUnixTimeToTimestamp() (diff) | |
download | opensim-SC_OLD-36495f699220a766f7a0b9184867f25804d582d9.zip opensim-SC_OLD-36495f699220a766f7a0b9184867f25804d582d9.tar.gz opensim-SC_OLD-36495f699220a766f7a0b9184867f25804d582d9.tar.bz2 opensim-SC_OLD-36495f699220a766f7a0b9184867f25804d582d9.tar.xz |
Merge branch 'master' of /var/git/opensim/
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 13 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 40 | ||||
-rw-r--r-- | prebuild.xml | 1 |
5 files changed, 61 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e6a323e..fc92f23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2298,5 +2298,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2298 | }); | 2298 | }); |
2299 | return result; | 2299 | return result; |
2300 | } | 2300 | } |
2301 | |||
2302 | /// <summary> | ||
2303 | /// Convert a unix time to a llGetTimestamp() like string | ||
2304 | /// </summary> | ||
2305 | /// <param name="unixTime"></param> | ||
2306 | /// <returns></returns> | ||
2307 | public LSL_String osUnixTimeToTimestamp(long time) | ||
2308 | { | ||
2309 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); | ||
2310 | long baseTicks = 621355968000000000; | ||
2311 | long tickResolution = 10000000; | ||
2312 | long epochTicks = (time * tickResolution) + baseTicks; | ||
2313 | DateTime date = new DateTime(epochTicks); | ||
2314 | |||
2315 | return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); | ||
2316 | } | ||
2301 | } | 2317 | } |
2302 | } | 2318 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c9a24f6..10d61ca 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -184,5 +184,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
184 | 184 | ||
185 | LSL_List osGetAvatarList(); | 185 | LSL_List osGetAvatarList(); |
186 | 186 | ||
187 | LSL_String osUnixTimeToTimestamp(long time); | ||
187 | } | 188 | } |
188 | } | 189 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 370bf1d..f3142e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -678,26 +678,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
678 | { | 678 | { |
679 | return m_OSSL_Functions.osGetSimulatorMemory(); | 679 | return m_OSSL_Functions.osGetSimulatorMemory(); |
680 | } | 680 | } |
681 | |||
681 | public void osKickAvatar(string FirstName,string SurName,string alert) | 682 | public void osKickAvatar(string FirstName,string SurName,string alert) |
682 | { | 683 | { |
683 | m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); | 684 | m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); |
684 | } | 685 | } |
686 | |||
685 | public void osSetSpeed(string UUID, float SpeedModifier) | 687 | public void osSetSpeed(string UUID, float SpeedModifier) |
686 | { | 688 | { |
687 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); | 689 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); |
688 | } | 690 | } |
691 | |||
689 | public void osCauseDamage(string avatar, double damage) | 692 | public void osCauseDamage(string avatar, double damage) |
690 | { | 693 | { |
691 | m_OSSL_Functions.osCauseDamage(avatar, damage); | 694 | m_OSSL_Functions.osCauseDamage(avatar, damage); |
692 | } | 695 | } |
696 | |||
693 | public void osCauseHealing(string avatar, double healing) | 697 | public void osCauseHealing(string avatar, double healing) |
694 | { | 698 | { |
695 | m_OSSL_Functions.osCauseHealing(avatar, healing); | 699 | m_OSSL_Functions.osCauseHealing(avatar, healing); |
696 | } | 700 | } |
701 | |||
697 | public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) | 702 | public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) |
698 | { | 703 | { |
699 | return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); | 704 | return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); |
700 | } | 705 | } |
706 | |||
701 | public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) | 707 | public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) |
702 | { | 708 | { |
703 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); | 709 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); |
@@ -717,5 +723,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
717 | { | 723 | { |
718 | return m_OSSL_Functions.osGetAvatarList(); | 724 | return m_OSSL_Functions.osGetAvatarList(); |
719 | } | 725 | } |
726 | |||
727 | public LSL_String osUnixTimeToTimestamp(long time) | ||
728 | { | ||
729 | return m_OSSL_Functions.osUnixTimeToTimestamp(time); | ||
730 | } | ||
720 | } | 731 | } |
721 | } | 732 | } \ No newline at end of file |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index a06476e..fcfdd1d 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | ||
31 | using System.Net; | 32 | using System.Net; |
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using System.Text.RegularExpressions; | 34 | using System.Text.RegularExpressions; |
@@ -427,12 +428,9 @@ namespace OpenSim.Services.LLLoginService | |||
427 | { | 428 | { |
428 | m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", | 429 | m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region", |
429 | account.FirstName, account.LastName); | 430 | account.FirstName, account.LastName); |
430 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); | 431 | region = FindAlternativeRegion(scopeID); |
431 | if (defaults != null && defaults.Count > 0) | 432 | if (region != null) |
432 | { | ||
433 | region = defaults[0]; | ||
434 | where = "safe"; | 433 | where = "safe"; |
435 | } | ||
436 | } | 434 | } |
437 | } | 435 | } |
438 | 436 | ||
@@ -459,12 +457,9 @@ namespace OpenSim.Services.LLLoginService | |||
459 | else | 457 | else |
460 | { | 458 | { |
461 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); | 459 | m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region"); |
462 | defaults = m_GridService.GetRegionsByName(scopeID, "", 1); | 460 | region = FindAlternativeRegion(scopeID); |
463 | if (defaults != null && defaults.Count > 0) | 461 | if (region != null) |
464 | { | ||
465 | region = defaults[0]; | ||
466 | where = "safe"; | 462 | where = "safe"; |
467 | } | ||
468 | } | 463 | } |
469 | 464 | ||
470 | } | 465 | } |
@@ -564,6 +559,31 @@ namespace OpenSim.Services.LLLoginService | |||
564 | 559 | ||
565 | } | 560 | } |
566 | 561 | ||
562 | private GridRegion FindAlternativeRegion(UUID scopeID) | ||
563 | { | ||
564 | List<GridRegion> hyperlinks = null; | ||
565 | List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, 1000 * (int)Constants.RegionSize, 1000 * (int)Constants.RegionSize); | ||
566 | if (regions != null && regions.Count > 0) | ||
567 | { | ||
568 | hyperlinks = m_GridService.GetHyperlinks(scopeID); | ||
569 | IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); | ||
570 | if (availableRegions.Count() > 0) | ||
571 | return availableRegions.ElementAt(0); | ||
572 | } | ||
573 | // No fallbacks, try to find an arbitrary region that is not a hyperlink | ||
574 | // maxNumber is fixed for now; maybe use some search pattern with increasing maxSize here? | ||
575 | regions = m_GridService.GetRegionsByName(scopeID, "", 10); | ||
576 | if (regions != null && regions.Count > 0) | ||
577 | { | ||
578 | if (hyperlinks == null) | ||
579 | hyperlinks = m_GridService.GetHyperlinks(scopeID); | ||
580 | IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); | ||
581 | if (availableRegions.Count() > 0) | ||
582 | return availableRegions.ElementAt(0); | ||
583 | } | ||
584 | return null; | ||
585 | } | ||
586 | |||
567 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) | 587 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) |
568 | { | 588 | { |
569 | gatekeeper = new GridRegion(); | 589 | gatekeeper = new GridRegion(); |
diff --git a/prebuild.xml b/prebuild.xml index e77d5c1..ac003d9 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -1214,6 +1214,7 @@ | |||
1214 | 1214 | ||
1215 | <ReferencePath>../../../bin/</ReferencePath> | 1215 | <ReferencePath>../../../bin/</ReferencePath> |
1216 | <Reference name="System"/> | 1216 | <Reference name="System"/> |
1217 | <Reference name="System.Core"/> | ||
1217 | <Reference name="OpenSim.Framework"/> | 1218 | <Reference name="OpenSim.Framework"/> |
1218 | <Reference name="OpenSim.Framework.Capabilities"/> | 1219 | <Reference name="OpenSim.Framework.Capabilities"/> |
1219 | <Reference name="OpenSim.Framework.Console"/> | 1220 | <Reference name="OpenSim.Framework.Console"/> |