This hopefully fixes all issues with online/offline notifications across grids. http://opensimulator.org/mantis/view.php?id=5528
parent
02b40670be
commit
3307db5d4a
|
@ -830,10 +830,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
|
public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
|
||||||
IClientAPI friendClient = LocateClientObject(friendID);
|
IClientAPI friendClient = LocateClientObject(friendID);
|
||||||
if (friendClient != null)
|
if (friendClient != null)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
|
|
||||||
// the friend in this sim as root agent
|
// the friend in this sim as root agent
|
||||||
if (online)
|
if (online)
|
||||||
friendClient.SendAgentOnline(new UUID[] { userID });
|
friendClient.SendAgentOnline(new UUID[] { userID });
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
/// <param name="friendID">friend whose status changed</param>
|
/// <param name="friendID">friend whose status changed</param>
|
||||||
/// <param name="online">status</param>
|
/// <param name="online">status</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool StatusNotify(UUID userID, UUID friendID, bool online)
|
public bool StatusNotify(UUID friendID, UUID userID, bool online)
|
||||||
{
|
{
|
||||||
return LocalStatusNotification(friendID, userID, online);
|
return LocalStatusNotification(friendID, userID, online);
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
foreach (FriendInfo f in kvp.Value)
|
foreach (FriendInfo f in kvp.Value)
|
||||||
ids.Add(f.Friend);
|
ids.Add(f.Friend);
|
||||||
UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
|
UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
|
||||||
uConn.StatusNotification(ids, userID, online);
|
List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online);
|
||||||
|
// need to debug this here
|
||||||
|
if (online)
|
||||||
|
{
|
||||||
|
IClientAPI client = LocateClientObject(userID);
|
||||||
|
if (client != null)
|
||||||
|
client.SendAgentOnline(friendsOnline.ToArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,10 +237,20 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||||
bool online = false;
|
bool online = false;
|
||||||
bool.TryParse(requestData["online"].ToString(), out online);
|
bool.TryParse(requestData["online"].ToString(), out online);
|
||||||
|
|
||||||
hash["result"] = "true";
|
|
||||||
|
|
||||||
// let's spawn a thread for this, because it may take a long time...
|
// let's spawn a thread for this, because it may take a long time...
|
||||||
Util.FireAndForget(delegate { m_HomeUsersService.StatusNotification(ids, userID, online); });
|
List<UUID> friendsOnline = m_HomeUsersService.StatusNotification(ids, userID, online);
|
||||||
|
if (friendsOnline.Count > 0)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
foreach (UUID id in friendsOnline)
|
||||||
|
{
|
||||||
|
hash["friend_" + i.ToString()] = id.ToString();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hash["result"] = "No Friends Online";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
|
|
@ -404,7 +404,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
GetBoolResponse(request, out reason);
|
GetBoolResponse(request, out reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StatusNotification(List<string> friends, UUID userID, bool online)
|
public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online)
|
||||||
{
|
{
|
||||||
Hashtable hash = new Hashtable();
|
Hashtable hash = new Hashtable();
|
||||||
hash["userID"] = userID.ToString();
|
hash["userID"] = userID.ToString();
|
||||||
|
@ -421,8 +421,59 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
|
|
||||||
XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList);
|
XmlRpcRequest request = new XmlRpcRequest("status_notification", paramList);
|
||||||
string reason = string.Empty;
|
string reason = string.Empty;
|
||||||
GetBoolResponse(request, out reason);
|
|
||||||
|
|
||||||
|
// Send and get reply
|
||||||
|
List<UUID> friendsOnline = new List<UUID>();
|
||||||
|
XmlRpcResponse response = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = request.Send(m_ServerURL, 10000);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
|
||||||
|
reason = "Exception: " + e.Message;
|
||||||
|
return friendsOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.IsFault)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
|
||||||
|
reason = "XMLRPC Fault";
|
||||||
|
return friendsOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
hash = (Hashtable)response.Value;
|
||||||
|
//foreach (Object o in hash)
|
||||||
|
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (hash == null)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
|
||||||
|
reason = "Internal error 1";
|
||||||
|
return friendsOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here is the actual response
|
||||||
|
foreach (object key in hash.Keys)
|
||||||
|
{
|
||||||
|
if (key is string && ((string)key).StartsWith("friend_") && hash[key] != null)
|
||||||
|
{
|
||||||
|
UUID uuid;
|
||||||
|
if (UUID.TryParse(hash[key].ToString(), out uuid))
|
||||||
|
friendsOnline.Add(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
|
||||||
|
reason = "Exception: " + e.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return friendsOnline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UUID> GetOnlineFriends(UUID userID, List<string> friends)
|
public List<UUID> GetOnlineFriends(UUID userID, List<string> friends)
|
||||||
|
|
|
@ -324,14 +324,16 @@ namespace OpenSim.Services.HypergridService
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StatusNotification(List<string> friends, UUID foreignUserID, bool online)
|
public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
|
||||||
{
|
{
|
||||||
if (m_FriendsService == null || m_PresenceService == null)
|
if (m_FriendsService == null || m_PresenceService == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[USER AGENT SERVICE]: Unable to perform status notifications because friends or presence services are missing");
|
m_log.WarnFormat("[USER AGENT SERVICE]: Unable to perform status notifications because friends or presence services are missing");
|
||||||
return;
|
return new List<UUID>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<UUID> localFriendsOnline = new List<UUID>();
|
||||||
|
|
||||||
m_log.DebugFormat("[USER AGENT SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends", foreignUserID, friends.Count);
|
m_log.DebugFormat("[USER AGENT SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends", foreignUserID, friends.Count);
|
||||||
|
|
||||||
// First, let's double check that the reported friends are, indeed, friends of that user
|
// First, let's double check that the reported friends are, indeed, friends of that user
|
||||||
|
@ -372,8 +374,12 @@ namespace OpenSim.Services.HypergridService
|
||||||
|
|
||||||
if (friendSession != null)
|
if (friendSession != null)
|
||||||
{
|
{
|
||||||
ForwardStatusNotificationToSim(friendSession.RegionID, friendSession.UserID, foreignUserID, online);
|
ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online);
|
||||||
usersToBeNotified.Remove(friendSession.UserID.ToString());
|
usersToBeNotified.Remove(friendSession.UserID.ToString());
|
||||||
|
UUID id;
|
||||||
|
if (UUID.TryParse(friendSession.UserID, out id))
|
||||||
|
localFriendsOnline.Add(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,9 +394,17 @@ namespace OpenSim.Services.HypergridService
|
||||||
m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url);
|
m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// and finally, let's send the online friends
|
||||||
|
if (online)
|
||||||
|
{
|
||||||
|
return localFriendsOnline;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return new List<UUID>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ForwardStatusNotificationToSim(UUID regionID, string user, UUID foreignUserID, bool online)
|
protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
|
||||||
{
|
{
|
||||||
UUID userID;
|
UUID userID;
|
||||||
if (UUID.TryParse(user, out userID))
|
if (UUID.TryParse(user, out userID))
|
||||||
|
@ -398,15 +412,15 @@ namespace OpenSim.Services.HypergridService
|
||||||
if (m_FriendsLocalSimConnector != null)
|
if (m_FriendsLocalSimConnector != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[USER AGENT SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline"));
|
m_log.DebugFormat("[USER AGENT SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline"));
|
||||||
m_FriendsLocalSimConnector.StatusNotify(userID, foreignUserID, online);
|
m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID);
|
GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID);
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, user, foreignUserID, (online ? "online" : "offline"));
|
m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
|
||||||
m_FriendsSimConnector.StatusNotify(region, userID, foreignUserID, online);
|
m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,8 @@ namespace OpenSim.Services.Interfaces
|
||||||
// on behalf of the userID
|
// on behalf of the userID
|
||||||
string GetUUI(UUID userID, UUID targetUserID);
|
string GetUUI(UUID userID, UUID targetUserID);
|
||||||
|
|
||||||
void StatusNotification(List<string> friends, UUID userID, bool online);
|
// Returns the local friends online
|
||||||
|
List<UUID> StatusNotification(List<string> friends, UUID userID, bool online);
|
||||||
//List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
|
//List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
|
||||||
|
|
||||||
bool AgentIsComingHome(UUID sessionID, string thisGridExternalName);
|
bool AgentIsComingHome(UUID sessionID, string thisGridExternalName);
|
||||||
|
|
Loading…
Reference in New Issue