mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
More cleaning on presence. Friends online/offline works again.
This commit is contained in:
@@ -345,8 +345,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
|
||||
im.fromAgentName = account.FirstName + " " + account.LastName;
|
||||
|
||||
PresenceInfo presence = null;
|
||||
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
|
||||
PresenceInfo presence = PresenceInfo.GetOnlinePresence(presences);
|
||||
if (presences != null && presences.Length > 0)
|
||||
presence = presences[0];
|
||||
if (presence != null)
|
||||
im.offline = 0;
|
||||
|
||||
@@ -380,13 +382,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
|
||||
|
||||
foreach (PresenceInfo pi in presence)
|
||||
{
|
||||
if (pi.Online)
|
||||
{
|
||||
online.Add(new UUID(pi.UserID));
|
||||
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
|
||||
}
|
||||
}
|
||||
online.Add(new UUID(pi.UserID));
|
||||
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
|
||||
|
||||
return online;
|
||||
}
|
||||
@@ -462,11 +459,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
// The friend is not here [as root]. Let's forward.
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||
if (friendSession != null)
|
||||
if (friendSessions != null && friendSessions.Length > 0)
|
||||
{
|
||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
|
||||
PresenceInfo friendSession = friendSessions[0];
|
||||
if (friendSession != null)
|
||||
{
|
||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
|
||||
}
|
||||
}
|
||||
|
||||
// Friend is not online. Ignore.
|
||||
@@ -504,13 +504,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
// The prospective friend is not here [as root]. Let's forward.
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||
if (friendSession != null)
|
||||
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.
|
||||
}
|
||||
|
||||
@@ -536,14 +538,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
// The friend is not here
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||
if (friendSession != null)
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
|
||||
@@ -562,11 +566,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
return;
|
||||
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
|
||||
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||
if (friendSession != null)
|
||||
if (friendSessions != null && friendSessions.Length > 0)
|
||||
{
|
||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
|
||||
PresenceInfo friendSession = friendSessions[0];
|
||||
if (friendSession != null)
|
||||
{
|
||||
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
|
||||
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,11 +596,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
return;
|
||||
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
|
||||
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||
if (friendSession != null)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,13 +641,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
return;
|
||||
|
||||
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
|
||||
PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions);
|
||||
if (friendSession != null)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user