diff options
author | Justin Clark-Casey (justincc) | 2010-09-21 01:01:07 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-21 01:01:07 +0100 |
commit | 192bcab98711245e241f1b37cb12cc29a26b168e (patch) | |
tree | 6e72ef2c0b7d20355f29119a603877786d83bf37 /OpenSim/Region | |
parent | If the uuid of a SceneObjectGroup (RootPart) is changed before adding to the ... (diff) | |
parent | * Tweaked the LocationTests for maximum coverage. (diff) | |
download | opensim-SC_OLD-192bcab98711245e241f1b37cb12cc29a26b168e.zip opensim-SC_OLD-192bcab98711245e241f1b37cb12cc29a26b168e.tar.gz opensim-SC_OLD-192bcab98711245e241f1b37cb12cc29a26b168e.tar.bz2 opensim-SC_OLD-192bcab98711245e241f1b37cb12cc29a26b168e.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
7 files changed, 137 insertions, 129 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c85ff82..7a0142f 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -316,7 +316,7 @@ namespace OpenSim | |||
316 | m_console.Commands.AddCommand("region", false, "create region", | 316 | m_console.Commands.AddCommand("region", false, "create region", |
317 | "create region [\"region name\"] <region_file.ini>", | 317 | "create region [\"region name\"] <region_file.ini>", |
318 | "Create a new region.", | 318 | "Create a new region.", |
319 | "The settings for \"region name\" are read from <region_file.ini> in your Regions directory." | 319 | "The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given." |
320 | + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine | 320 | + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine |
321 | + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine | 321 | + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine |
322 | + "If <region_file.ini> does not exist, it will be created.", | 322 | + "If <region_file.ini> does not exist, it will be created.", |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index cede050..48d5a12 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -1531,6 +1531,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1531 | OutPacket(kill, ThrottleOutPacketType.Task); | 1531 | OutPacket(kill, ThrottleOutPacketType.Task); |
1532 | } | 1532 | } |
1533 | } | 1533 | } |
1534 | else | ||
1535 | { | ||
1536 | OutPacket(kill, ThrottleOutPacketType.State); | ||
1537 | } | ||
1534 | } | 1538 | } |
1535 | 1539 | ||
1536 | /// <summary> | 1540 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 02f0968..ef5efdd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -237,9 +237,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
237 | 237 | ||
238 | public virtual void OnChatBroadcast(Object sender, OSChatMessage c) | 238 | public virtual void OnChatBroadcast(Object sender, OSChatMessage c) |
239 | { | 239 | { |
240 | // unless the chat to be broadcast is of type Region, we | 240 | if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return; |
241 | // drop it if its channel is neither 0 nor DEBUG_CHANNEL | ||
242 | if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL && c.Type != ChatTypeEnum.Region) return; | ||
243 | 241 | ||
244 | ChatTypeEnum cType = c.Type; | 242 | ChatTypeEnum cType = c.Type; |
245 | if (c.Channel == DEBUG_CHANNEL) | 243 | if (c.Channel == DEBUG_CHANNEL) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 4e4eee9..7a21d5e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
317 | continue; | 317 | continue; |
318 | 318 | ||
319 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); | 319 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); |
320 | PresenceInfo presence = PresenceService.GetAgent(fromAgentID); | 320 | |
321 | PresenceInfo presence = null; | ||
322 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); | ||
323 | if (presences != null && presences.Length > 0) | ||
324 | presence = presences[0]; | ||
325 | if (presence != null) | ||
326 | im.offline = 0; | ||
321 | 327 | ||
322 | im.fromAgentID = fromAgentID.Guid; | 328 | im.fromAgentID = fromAgentID.Guid; |
323 | im.fromAgentName = account.FirstName + " " + account.LastName; | 329 | im.fromAgentName = account.FirstName + " " + account.LastName; |
@@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
430 | return; | 436 | return; |
431 | 437 | ||
432 | // The friend is not here [as root]. Let's forward. | 438 | // The friend is not here [as root]. Let's forward. |
433 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); | 439 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
434 | if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check | 440 | if (friendSessions != null && friendSessions.Length > 0) |
435 | { | 441 | { |
436 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 442 | PresenceInfo friendSession = null; |
437 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); | 443 | foreach (PresenceInfo pinfo in friendSessions) |
438 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); | 444 | if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad |
445 | { | ||
446 | friendSession = pinfo; | ||
447 | break; | ||
448 | } | ||
449 | |||
450 | if (friendSession != null) | ||
451 | { | ||
452 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
453 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); | ||
454 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); | ||
455 | } | ||
439 | } | 456 | } |
457 | |||
458 | // Friend is not online. Ignore. | ||
440 | } | 459 | } |
441 | else | 460 | else |
442 | { | 461 | { |
@@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
477 | return; | 496 | return; |
478 | 497 | ||
479 | // The prospective friend is not here [as root]. Let's forward. | 498 | // The prospective friend is not here [as root]. Let's forward. |
480 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); | 499 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
481 | if (friendSession != null) | 500 | if (friendSessions != null && friendSessions.Length > 0) |
482 | { | 501 | { |
483 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 502 | PresenceInfo friendSession = friendSessions[0]; |
484 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); | 503 | if (friendSession != null) |
504 | { | ||
505 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
506 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); | ||
507 | } | ||
485 | } | 508 | } |
486 | // If the prospective friend is not online, he'll get the message upon login. | 509 | // If the prospective friend is not online, he'll get the message upon login. |
487 | } | 510 | } |
@@ -508,12 +531,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
508 | } | 531 | } |
509 | 532 | ||
510 | // The friend is not here | 533 | // The friend is not here |
511 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); | 534 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
512 | if (friendSession != null) | 535 | if (friendSessions != null && friendSessions.Length > 0) |
513 | { | 536 | { |
514 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 537 | PresenceInfo friendSession = friendSessions[0]; |
515 | m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); | 538 | if (friendSession != null) |
516 | client.SendAgentOnline(new UUID[] { friendID }); | 539 | { |
540 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
541 | m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); | ||
542 | client.SendAgentOnline(new UUID[] { friendID }); | ||
543 | } | ||
517 | } | 544 | } |
518 | } | 545 | } |
519 | 546 | ||
@@ -532,14 +559,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
532 | if (LocalFriendshipDenied(agentID, client.Name, friendID)) | 559 | if (LocalFriendshipDenied(agentID, client.Name, friendID)) |
533 | return; | 560 | return; |
534 | 561 | ||
535 | PresenceInfo friendSession = PresenceService.GetAgent(friendID); | 562 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
536 | if (friendSession != null) | 563 | if (friendSessions != null && friendSessions.Length > 0) |
537 | { | 564 | { |
538 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 565 | PresenceInfo friendSession = friendSessions[0]; |
539 | if (region != null) | 566 | if (friendSession != null) |
540 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); | 567 | { |
541 | else | 568 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
542 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); | 569 | if (region != null) |
570 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); | ||
571 | else | ||
572 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); | ||
573 | } | ||
543 | } | 574 | } |
544 | } | 575 | } |
545 | 576 | ||
@@ -561,11 +592,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
561 | if (LocalFriendshipTerminated(exfriendID)) | 592 | if (LocalFriendshipTerminated(exfriendID)) |
562 | return; | 593 | return; |
563 | 594 | ||
564 | PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); | 595 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); |
565 | if (friendSession != null) | 596 | if (friendSessions != null && friendSessions.Length > 0) |
566 | { | 597 | { |
567 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 598 | PresenceInfo friendSession = friendSessions[0]; |
568 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); | 599 | if (friendSession != null) |
600 | { | ||
601 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
602 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); | ||
603 | } | ||
569 | } | 604 | } |
570 | } | 605 | } |
571 | 606 | ||
@@ -604,13 +639,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
604 | if (LocalGrantRights(requester, target, myFlags, rights)) | 639 | if (LocalGrantRights(requester, target, myFlags, rights)) |
605 | return; | 640 | return; |
606 | 641 | ||
607 | PresenceInfo friendSession = PresenceService.GetAgent(target); | 642 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); |
608 | if (friendSession != null) | 643 | if (friendSessions != null && friendSessions.Length > 0) |
609 | { | 644 | { |
610 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 645 | PresenceInfo friendSession = friendSessions[0]; |
611 | // TODO: You might want to send the delta to save the lookup | 646 | if (friendSession != null) |
612 | // on the other end!! | 647 | { |
613 | m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); | 648 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
649 | // TODO: You might want to send the delta to save the lookup | ||
650 | // on the other end!! | ||
651 | m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); | ||
652 | } | ||
614 | } | 653 | } |
615 | } | 654 | } |
616 | } | 655 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 43bbf0d..9b1222b 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -498,7 +498,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
498 | if (lookupAgent) | 498 | if (lookupAgent) |
499 | { | 499 | { |
500 | // Non-cached user agent lookup. | 500 | // Non-cached user agent lookup. |
501 | upd = PresenceService.GetAgent(toAgentID); | 501 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); |
502 | if (presences != null && presences.Length > 0) | ||
503 | { | ||
504 | foreach (PresenceInfo p in presences) | ||
505 | { | ||
506 | if (p.RegionID != UUID.Zero) | ||
507 | { | ||
508 | upd = p; | ||
509 | break; | ||
510 | } | ||
511 | } | ||
512 | } | ||
502 | 513 | ||
503 | if (upd != null) | 514 | if (upd != null) |
504 | { | 515 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index a88c5e2..5fabbb0 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -957,7 +957,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
957 | CacheKey = sb.ToString(); | 957 | CacheKey = sb.ToString(); |
958 | m_memoryCache.TryGetValue(CacheKey, out resp); | 958 | m_memoryCache.TryGetValue(CacheKey, out resp); |
959 | } | 959 | } |
960 | |||
961 | } | 960 | } |
962 | 961 | ||
963 | if (resp == null) | 962 | if (resp == null) |
@@ -965,22 +964,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
965 | string UserService; | 964 | string UserService; |
966 | UUID SessionID; | 965 | UUID SessionID; |
967 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); | 966 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); |
968 | param.Add("requestingAgentID", requestingAgentID.ToString()); | 967 | |
968 | param.Add("RequestingAgentID", requestingAgentID.ToString()); | ||
969 | param.Add("RequestingAgentUserService", UserService); | 969 | param.Add("RequestingAgentUserService", UserService); |
970 | param.Add("RequestingSessionID", SessionID.ToString()); | 970 | param.Add("RequestingSessionID", SessionID.ToString()); |
971 | |||
972 | |||
973 | param.Add("ReadKey", m_groupReadKey); | 971 | param.Add("ReadKey", m_groupReadKey); |
974 | param.Add("WriteKey", m_groupWriteKey); | 972 | param.Add("WriteKey", m_groupWriteKey); |
975 | 973 | ||
976 | |||
977 | IList parameters = new ArrayList(); | 974 | IList parameters = new ArrayList(); |
978 | parameters.Add(param); | 975 | parameters.Add(param); |
979 | 976 | ||
980 | ConfigurableKeepAliveXmlRpcRequest req; | 977 | ConfigurableKeepAliveXmlRpcRequest req; |
981 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); | 978 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); |
982 | 979 | ||
983 | |||
984 | try | 980 | try |
985 | { | 981 | { |
986 | resp = req.Send(m_groupsServerURI, 10000); | 982 | resp = req.Send(m_groupsServerURI, 10000); |
@@ -989,7 +985,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
989 | { | 985 | { |
990 | m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); | 986 | m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); |
991 | } | 987 | } |
992 | |||
993 | } | 988 | } |
994 | catch (Exception e) | 989 | catch (Exception e) |
995 | { | 990 | { |
@@ -1058,10 +1053,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1058 | { | 1053 | { |
1059 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line); | 1054 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line); |
1060 | } | 1055 | } |
1061 | |||
1062 | } | 1056 | } |
1063 | } | 1057 | } |
1064 | |||
1065 | 1058 | ||
1066 | /// <summary> | 1059 | /// <summary> |
1067 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | 1060 | /// Group Request Tokens are an attempt to allow the groups service to authenticate |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 01c026e..a6ca171 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3956,7 +3956,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3956 | } | 3956 | } |
3957 | 3957 | ||
3958 | 3958 | ||
3959 | pinfo = World.PresenceService.GetAgent(uuid); | 3959 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); |
3960 | if (pinfos != null && pinfos.Length > 0) | ||
3961 | { | ||
3962 | foreach (PresenceInfo p in pinfos) | ||
3963 | { | ||
3964 | if (p.RegionID != UUID.Zero) | ||
3965 | { | ||
3966 | pinfo = p; | ||
3967 | } | ||
3968 | } | ||
3969 | } | ||
3960 | 3970 | ||
3961 | ce = new UserInfoCacheEntry(); | 3971 | ce = new UserInfoCacheEntry(); |
3962 | ce.time = Util.EnvironmentTickCount(); | 3972 | ce.time = Util.EnvironmentTickCount(); |
@@ -3974,7 +3984,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3974 | 3984 | ||
3975 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) | 3985 | if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) |
3976 | { | 3986 | { |
3977 | pinfo = World.PresenceService.GetAgent(uuid); | 3987 | PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); |
3988 | if (pinfos != null && pinfos.Length > 0) | ||
3989 | { | ||
3990 | foreach (PresenceInfo p in pinfos) | ||
3991 | { | ||
3992 | if (p.RegionID != UUID.Zero) | ||
3993 | { | ||
3994 | pinfo = p; | ||
3995 | } | ||
3996 | } | ||
3997 | } | ||
3998 | else | ||
3999 | pinfo = null; | ||
3978 | 4000 | ||
3979 | ce.time = Util.EnvironmentTickCount(); | 4001 | ce.time = Util.EnvironmentTickCount(); |
3980 | ce.pinfo = pinfo; | 4002 | ce.pinfo = pinfo; |
@@ -5579,78 +5601,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5579 | ScriptSleep(5000); | 5601 | ScriptSleep(5000); |
5580 | } | 5602 | } |
5581 | 5603 | ||
5582 | public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers) | ||
5583 | { | ||
5584 | m_host.AddScriptLPS(1); | ||
5585 | LSL_List ret = new LSL_List(); | ||
5586 | LSL_List spacers = new LSL_List(); | ||
5587 | if (in_spacers.Length > 0 && separators.Length > 0) | ||
5588 | { | ||
5589 | for (int i = 0; i < in_spacers.Length; i++) | ||
5590 | { | ||
5591 | object s = in_spacers.Data[i]; | ||
5592 | for (int j = 0; j < separators.Length; j++) | ||
5593 | { | ||
5594 | if (separators.Data[j].ToString() == s.ToString()) | ||
5595 | { | ||
5596 | s = null; | ||
5597 | break; | ||
5598 | } | ||
5599 | } | ||
5600 | if (s != null) | ||
5601 | { | ||
5602 | spacers.Add(s); | ||
5603 | } | ||
5604 | } | ||
5605 | } | ||
5606 | object[] delimiters = new object[separators.Length + spacers.Length]; | ||
5607 | separators.Data.CopyTo(delimiters, 0); | ||
5608 | spacers.Data.CopyTo(delimiters, separators.Length); | ||
5609 | bool dfound = false; | ||
5610 | do | ||
5611 | { | ||
5612 | dfound = false; | ||
5613 | int cindex = -1; | ||
5614 | string cdeli = ""; | ||
5615 | for (int i = 0; i < delimiters.Length; i++) | ||
5616 | { | ||
5617 | int index = str.IndexOf(delimiters[i].ToString()); | ||
5618 | bool found = index != -1; | ||
5619 | if (found && String.Empty != delimiters[i].ToString()) | ||
5620 | { | ||
5621 | if ((cindex > index) || (cindex == -1)) | ||
5622 | { | ||
5623 | cindex = index; | ||
5624 | cdeli = delimiters[i].ToString(); | ||
5625 | } | ||
5626 | dfound = dfound || found; | ||
5627 | } | ||
5628 | } | ||
5629 | if (cindex != -1) | ||
5630 | { | ||
5631 | if (cindex > 0) | ||
5632 | { | ||
5633 | ret.Add(new LSL_String(str.Substring(0, cindex))); | ||
5634 | } | ||
5635 | // Cannot use spacers.Contains() because spacers may be either type String or LSLString | ||
5636 | for (int j = 0; j < spacers.Length; j++) | ||
5637 | { | ||
5638 | if (spacers.Data[j].ToString() == cdeli) | ||
5639 | { | ||
5640 | ret.Add(new LSL_String(cdeli)); | ||
5641 | break; | ||
5642 | } | ||
5643 | } | ||
5644 | str = str.Substring(cindex + cdeli.Length); | ||
5645 | } | ||
5646 | } while (dfound); | ||
5647 | if (str != "") | ||
5648 | { | ||
5649 | ret.Add(new LSL_String(str)); | ||
5650 | } | ||
5651 | return ret; | ||
5652 | } | ||
5653 | |||
5654 | public LSL_Integer llOverMyLand(string id) | 5604 | public LSL_Integer llOverMyLand(string id) |
5655 | { | 5605 | { |
5656 | m_host.AddScriptLPS(1); | 5606 | m_host.AddScriptLPS(1); |
@@ -8414,7 +8364,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8414 | // of arrays or other objects. | 8364 | // of arrays or other objects. |
8415 | // </remarks> | 8365 | // </remarks> |
8416 | 8366 | ||
8417 | public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) | 8367 | private LSL_List ParseString(string src, LSL_List separators, LSL_List spacers, bool keepNulls) |
8418 | { | 8368 | { |
8419 | int beginning = 0; | 8369 | int beginning = 0; |
8420 | int srclen = src.Length; | 8370 | int srclen = src.Length; |
@@ -8434,8 +8384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8434 | 8384 | ||
8435 | LSL_List tokens = new LSL_List(); | 8385 | LSL_List tokens = new LSL_List(); |
8436 | 8386 | ||
8437 | m_host.AddScriptLPS(1); | ||
8438 | |||
8439 | // All entries are initially valid | 8387 | // All entries are initially valid |
8440 | 8388 | ||
8441 | for (int i = 0; i < mlen; i++) | 8389 | for (int i = 0; i < mlen; i++) |
@@ -8507,14 +8455,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8507 | { | 8455 | { |
8508 | // no markers were found on this pass | 8456 | // no markers were found on this pass |
8509 | // so we're pretty much done | 8457 | // so we're pretty much done |
8510 | tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning))); | 8458 | if ((keepNulls) || ((!keepNulls) && (srclen - beginning) > 0)) |
8459 | tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning))); | ||
8511 | break; | 8460 | break; |
8512 | } | 8461 | } |
8513 | 8462 | ||
8514 | // Otherwise we just add the newly delimited token | 8463 | // Otherwise we just add the newly delimited token |
8515 | // and recalculate where the search should continue. | 8464 | // and recalculate where the search should continue. |
8516 | 8465 | if ((keepNulls) || ((!keepNulls) && (offset[best] - beginning) > 0)) | |
8517 | tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning))); | 8466 | tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning))); |
8518 | 8467 | ||
8519 | if (best < seplen) | 8468 | if (best < seplen) |
8520 | { | 8469 | { |
@@ -8523,7 +8472,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8523 | else | 8472 | else |
8524 | { | 8473 | { |
8525 | beginning = offset[best] + (spcarray[best - seplen].ToString()).Length; | 8474 | beginning = offset[best] + (spcarray[best - seplen].ToString()).Length; |
8526 | tokens.Add(new LSL_String(spcarray[best - seplen].ToString())); | 8475 | string str = spcarray[best - seplen].ToString(); |
8476 | if ((keepNulls) || ((!keepNulls) && (str.Length > 0))) | ||
8477 | tokens.Add(new LSL_String(str)); | ||
8527 | } | 8478 | } |
8528 | } | 8479 | } |
8529 | 8480 | ||
@@ -8533,7 +8484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8533 | // arduous. Alternatively the 'break' could be replced with a return | 8484 | // arduous. Alternatively the 'break' could be replced with a return |
8534 | // but that's shabby programming. | 8485 | // but that's shabby programming. |
8535 | 8486 | ||
8536 | if (beginning == srclen) | 8487 | if ((beginning == srclen) && (keepNulls)) |
8537 | { | 8488 | { |
8538 | if (srclen != 0) | 8489 | if (srclen != 0) |
8539 | tokens.Add(new LSL_String("")); | 8490 | tokens.Add(new LSL_String("")); |
@@ -8541,7 +8492,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8541 | 8492 | ||
8542 | return tokens; | 8493 | return tokens; |
8543 | } | 8494 | } |
8544 | 8495 | ||
8496 | public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers) | ||
8497 | { | ||
8498 | m_host.AddScriptLPS(1); | ||
8499 | return this.ParseString(src, separators, spacers, false); | ||
8500 | } | ||
8501 | |||
8502 | public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) | ||
8503 | { | ||
8504 | m_host.AddScriptLPS(1); | ||
8505 | return this.ParseString(src, separators, spacers, true); | ||
8506 | } | ||
8507 | |||
8545 | public LSL_Integer llGetObjectPermMask(int mask) | 8508 | public LSL_Integer llGetObjectPermMask(int mask) |
8546 | { | 8509 | { |
8547 | m_host.AddScriptLPS(1); | 8510 | m_host.AddScriptLPS(1); |