Revert "* Changed 11 calls for session info to the more optimized API method"
This reverts commit 5dc9ea2f24
.
Also makes online indicators and IM more robust
viewer-2-initial-appearance
parent
b49cb3355f
commit
7762301cea
|
@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
|
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.fromAgentID = fromAgentID.Guid;
|
||||||
im.fromAgentName = account.FirstName + " " + account.LastName;
|
im.fromAgentName = account.FirstName + " " + account.LastName;
|
||||||
|
@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The friend is not here [as root]. Let's forward.
|
// The friend is not here [as root]. Let's forward.
|
||||||
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||||
if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
|
if (friendSessions != null && friendSessions.Length > 0)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
PresenceInfo friendSession = null;
|
||||||
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
|
foreach (PresenceInfo pinfo in friendSessions)
|
||||||
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The prospective friend is not here [as root]. Let's forward.
|
// The prospective friend is not here [as root]. Let's forward.
|
||||||
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||||
if (friendSession != null)
|
if (friendSessions != null && friendSessions.Length > 0)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
PresenceInfo friendSession = friendSessions[0];
|
||||||
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
|
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.
|
// 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
|
// The friend is not here
|
||||||
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||||
if (friendSession != null)
|
if (friendSessions != null && friendSessions.Length > 0)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
PresenceInfo friendSession = friendSessions[0];
|
||||||
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
|
if (friendSession != null)
|
||||||
client.SendAgentOnline(new UUID[] { friendID });
|
{
|
||||||
|
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))
|
if (LocalFriendshipDenied(agentID, client.Name, friendID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||||
if (friendSession != null)
|
if (friendSessions != null && friendSessions.Length > 0)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
PresenceInfo friendSession = friendSessions[0];
|
||||||
if (region != null)
|
if (friendSession != null)
|
||||||
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
|
{
|
||||||
else
|
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||||
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
|
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))
|
if (LocalFriendshipTerminated(exfriendID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
|
||||||
if (friendSession != null)
|
if (friendSessions != null && friendSessions.Length > 0)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
PresenceInfo friendSession = friendSessions[0];
|
||||||
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
|
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))
|
if (LocalGrantRights(requester, target, myFlags, rights))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PresenceInfo friendSession = PresenceService.GetAgent(target);
|
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
|
||||||
if (friendSession != null)
|
if (friendSessions != null && friendSessions.Length > 0)
|
||||||
{
|
{
|
||||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
PresenceInfo friendSession = friendSessions[0];
|
||||||
// TODO: You might want to send the delta to save the lookup
|
if (friendSession != null)
|
||||||
// on the other end!!
|
{
|
||||||
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,7 +498,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
if (lookupAgent)
|
if (lookupAgent)
|
||||||
{
|
{
|
||||||
// Non-cached user agent lookup.
|
// 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)
|
if (upd != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 = new UserInfoCacheEntry();
|
||||||
ce.time = Util.EnvironmentTickCount();
|
ce.time = Util.EnvironmentTickCount();
|
||||||
|
@ -3974,7 +3984,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
|
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.time = Util.EnvironmentTickCount();
|
||||||
ce.pinfo = pinfo;
|
ce.pinfo = pinfo;
|
||||||
|
|
|
@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
// Check if the user is online
|
// Check if the user is online
|
||||||
if (client.Scene is Scene)
|
if (client.Scene is Scene)
|
||||||
{
|
{
|
||||||
OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID);
|
OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() });
|
||||||
if (presence != null)
|
if (presences != null && presences.Length > 0)
|
||||||
flags |= ProfileFlags.Online;
|
flags |= ProfileFlags.Online;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue