Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

This commit is contained in:
Justin Clark-Casey (justincc)
2010-09-21 01:01:07 +01:00
19 changed files with 874 additions and 157 deletions

View File

@@ -316,7 +316,7 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] <region_file.ini>",
"Create a new region.",
"The settings for \"region name\" are read from <region_file.ini> in your Regions directory."
"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."
+ " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
+ "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
+ "If <region_file.ini> does not exist, it will be created.",

View File

@@ -1531,6 +1531,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(kill, ThrottleOutPacketType.Task);
}
}
else
{
OutPacket(kill, ThrottleOutPacketType.State);
}
}
/// <summary>

View File

@@ -237,9 +237,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
public virtual void OnChatBroadcast(Object sender, OSChatMessage c)
{
// unless the chat to be broadcast is of type Region, we
// drop it if its channel is neither 0 nor DEBUG_CHANNEL
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL && c.Type != ChatTypeEnum.Region) return;
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;
ChatTypeEnum cType = c.Type;
if (c.Channel == DEBUG_CHANNEL)

View File

@@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
continue;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
PresenceInfo presence = null;
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
if (presences != null && presences.Length > 0)
presence = presences[0];
if (presence != null)
im.offline = 0;
im.fromAgentID = fromAgentID.Guid;
im.fromAgentName = account.FirstName + " " + account.LastName;
@@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The friend is not here [as root]. Let's forward.
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
PresenceInfo friendSession = null;
foreach (PresenceInfo pinfo in friendSessions)
if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
{
friendSession = pinfo;
break;
}
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
}
}
// Friend is not online. Ignore.
}
else
{
@@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The prospective friend is not here [as root]. Let's forward.
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
}
}
// If the prospective friend is not online, he'll get the message upon login.
}
@@ -508,12 +531,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
// The friend is not here
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
}
}
}
@@ -532,14 +559,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipDenied(agentID, client.Name, friendID))
return;
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
}
}
@@ -561,11 +592,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipTerminated(exfriendID))
return;
PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
if (friendSession != null)
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
}
}
}
@@ -604,13 +639,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalGrantRights(requester, target, myFlags, rights))
return;
PresenceInfo friendSession = PresenceService.GetAgent(target);
if (friendSession != null)
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
}
}
}

View File

@@ -498,7 +498,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (lookupAgent)
{
// Non-cached user agent lookup.
upd = PresenceService.GetAgent(toAgentID);
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
if (presences != null && presences.Length > 0)
{
foreach (PresenceInfo p in presences)
{
if (p.RegionID != UUID.Zero)
{
upd = p;
break;
}
}
}
if (upd != null)
{

View File

@@ -957,7 +957,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
CacheKey = sb.ToString();
m_memoryCache.TryGetValue(CacheKey, out resp);
}
}
if (resp == null)
@@ -965,22 +964,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
string UserService;
UUID SessionID;
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
param.Add("requestingAgentID", requestingAgentID.ToString());
param.Add("RequestingAgentID", requestingAgentID.ToString());
param.Add("RequestingAgentUserService", UserService);
param.Add("RequestingSessionID", SessionID.ToString());
param.Add("ReadKey", m_groupReadKey);
param.Add("WriteKey", m_groupWriteKey);
IList parameters = new ArrayList();
parameters.Add(param);
ConfigurableKeepAliveXmlRpcRequest req;
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
try
{
resp = req.Send(m_groupsServerURI, 10000);
@@ -989,7 +985,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
}
}
catch (Exception e)
{
@@ -1058,10 +1053,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
}
}
}
/// <summary>
/// Group Request Tokens are an attempt to allow the groups service to authenticate

View File

@@ -3956,7 +3956,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
pinfo = World.PresenceService.GetAgent(uuid);
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
if (pinfos != null && pinfos.Length > 0)
{
foreach (PresenceInfo p in pinfos)
{
if (p.RegionID != UUID.Zero)
{
pinfo = p;
}
}
}
ce = new UserInfoCacheEntry();
ce.time = Util.EnvironmentTickCount();
@@ -3974,7 +3984,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
{
pinfo = World.PresenceService.GetAgent(uuid);
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
if (pinfos != null && pinfos.Length > 0)
{
foreach (PresenceInfo p in pinfos)
{
if (p.RegionID != UUID.Zero)
{
pinfo = p;
}
}
}
else
pinfo = null;
ce.time = Util.EnvironmentTickCount();
ce.pinfo = pinfo;
@@ -5579,78 +5601,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(5000);
}
public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
{
m_host.AddScriptLPS(1);
LSL_List ret = new LSL_List();
LSL_List spacers = new LSL_List();
if (in_spacers.Length > 0 && separators.Length > 0)
{
for (int i = 0; i < in_spacers.Length; i++)
{
object s = in_spacers.Data[i];
for (int j = 0; j < separators.Length; j++)
{
if (separators.Data[j].ToString() == s.ToString())
{
s = null;
break;
}
}
if (s != null)
{
spacers.Add(s);
}
}
}
object[] delimiters = new object[separators.Length + spacers.Length];
separators.Data.CopyTo(delimiters, 0);
spacers.Data.CopyTo(delimiters, separators.Length);
bool dfound = false;
do
{
dfound = false;
int cindex = -1;
string cdeli = "";
for (int i = 0; i < delimiters.Length; i++)
{
int index = str.IndexOf(delimiters[i].ToString());
bool found = index != -1;
if (found && String.Empty != delimiters[i].ToString())
{
if ((cindex > index) || (cindex == -1))
{
cindex = index;
cdeli = delimiters[i].ToString();
}
dfound = dfound || found;
}
}
if (cindex != -1)
{
if (cindex > 0)
{
ret.Add(new LSL_String(str.Substring(0, cindex)));
}
// Cannot use spacers.Contains() because spacers may be either type String or LSLString
for (int j = 0; j < spacers.Length; j++)
{
if (spacers.Data[j].ToString() == cdeli)
{
ret.Add(new LSL_String(cdeli));
break;
}
}
str = str.Substring(cindex + cdeli.Length);
}
} while (dfound);
if (str != "")
{
ret.Add(new LSL_String(str));
}
return ret;
}
public LSL_Integer llOverMyLand(string id)
{
m_host.AddScriptLPS(1);
@@ -8414,7 +8364,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// of arrays or other objects.
// </remarks>
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
private LSL_List ParseString(string src, LSL_List separators, LSL_List spacers, bool keepNulls)
{
int beginning = 0;
int srclen = src.Length;
@@ -8434,8 +8384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List tokens = new LSL_List();
m_host.AddScriptLPS(1);
// All entries are initially valid
for (int i = 0; i < mlen; i++)
@@ -8507,14 +8455,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
// no markers were found on this pass
// so we're pretty much done
tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning)));
if ((keepNulls) || ((!keepNulls) && (srclen - beginning) > 0))
tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning)));
break;
}
// Otherwise we just add the newly delimited token
// and recalculate where the search should continue.
tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning)));
if ((keepNulls) || ((!keepNulls) && (offset[best] - beginning) > 0))
tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning)));
if (best < seplen)
{
@@ -8523,7 +8472,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
{
beginning = offset[best] + (spcarray[best - seplen].ToString()).Length;
tokens.Add(new LSL_String(spcarray[best - seplen].ToString()));
string str = spcarray[best - seplen].ToString();
if ((keepNulls) || ((!keepNulls) && (str.Length > 0)))
tokens.Add(new LSL_String(str));
}
}
@@ -8533,7 +8484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// arduous. Alternatively the 'break' could be replced with a return
// but that's shabby programming.
if (beginning == srclen)
if ((beginning == srclen) && (keepNulls))
{
if (srclen != 0)
tokens.Add(new LSL_String(""));
@@ -8541,7 +8492,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return tokens;
}
public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers)
{
m_host.AddScriptLPS(1);
return this.ParseString(src, separators, spacers, false);
}
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
{
m_host.AddScriptLPS(1);
return this.ParseString(src, separators, spacers, true);
}
public LSL_Integer llGetObjectPermMask(int mask)
{
m_host.AddScriptLPS(1);