From b60391860348fdc59c518a9c585ac201767f0378 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 9 Jul 2021 21:55:17 +0200 Subject: [PATCH] add hg notification to friendService --- .../HypergridService/HGFriendsService.cs | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index d3b4f18283..cf68eb549c 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs @@ -61,6 +61,7 @@ namespace OpenSim.Services.HypergridService protected static IFriendsService m_FriendsService; protected static IPresenceService m_PresenceService; protected static IUserAccountService m_UserAccountService; + protected static IUserAgentService m_UserAgentService; protected static IFriendsSimConnector m_FriendsLocalSimConnector; // standalone, points to HGFriendsModule protected static FriendsSimConnector m_FriendsSimConnector; // grid @@ -88,7 +89,7 @@ namespace OpenSim.Services.HypergridService if (theService == String.Empty) throw new Exception("No FriendsService in config file " + m_ConfigName); m_FriendsService = ServerUtils.LoadPlugin(theService, args); - + theService = serverConfig.GetString("UserAccountService", string.Empty); if (theService == String.Empty) throw new Exception("No UserAccountService in " + m_ConfigName); @@ -99,13 +100,17 @@ namespace OpenSim.Services.HypergridService throw new Exception("No GridService in " + m_ConfigName); m_GridService = ServerUtils.LoadPlugin(theService, args); + theService = serverConfig.GetString("UserAgentService", string.Empty); + if (theService == String.Empty) + throw new Exception("No UserAgentService in " + m_ConfigName); + m_UserAgentService = ServerUtils.LoadPlugin(theService, args); + theService = serverConfig.GetString("PresenceService", string.Empty); if (theService == String.Empty) throw new Exception("No PresenceService in " + m_ConfigName); - m_PresenceService = ServerUtils.LoadPlugin(theService, args); + m_PresenceService = ServerUtils.LoadPlugin(theService, args); m_FriendsSimConnector = new FriendsSimConnector(); - m_log.DebugFormat("[HGFRIENDS SERVICE]: Starting..."); } @@ -277,19 +282,22 @@ namespace OpenSim.Services.HypergridService } } -// // Lastly, let's notify the rest who may be online somewhere else -// foreach (string user in usersToBeNotified) -// { -// UUID id = new UUID(user); -// //m_UserAgentService.LocateUser(id); -// //etc... -// //if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName) -// //{ -// // string url = m_TravelingAgents[id].GridExternalName; -// // // forward -// //} -// //m_log.WarnFormat("[HGFRIENDS SERVICE]: User {0} is visiting another grid. HG Status notifications still not implemented.", user); -// } + foreach (string user in usersToBeNotified) + { + try + { + UUID id = new UUID(user); + String remoteServer = m_UserAgentService.LocateUser(id); + GridRegion remoteRegion = m_GridService.GetRegionByURI(UUID.Zero, new RegionURI(remoteServer)); + m_FriendsSimConnector.StatusNotify(remoteRegion, id, user, online); + } + catch(Exception error) + { + m_log.Error("User: " + user); + m_log.Error(error.Message); + m_log.Error(error.StackTrace); + } + } // and finally, let's send the online friends if (online) -- 2.30.1.windows.1