From 679ad9575083370204a6d83e9933323c9f60ae45 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 25 Feb 2010 16:11:04 -0800 Subject: List of friends now retrieved upon login. Configured and tested in standalone only. --- OpenSim/Services/Friends/FriendsServiceBase.cs | 8 ++++--- .../Services/HypergridService/GatekeeperService.cs | 1 + OpenSim/Services/LLLoginService/LLLoginResponse.cs | 26 +++++++++++----------- OpenSim/Services/LLLoginService/LLLoginService.cs | 17 +++++++++++--- bin/config-include/Standalone.ini | 4 ++++ bin/config-include/StandaloneHypergrid.ini | 10 ++++++--- 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/OpenSim/Services/Friends/FriendsServiceBase.cs b/OpenSim/Services/Friends/FriendsServiceBase.cs index cabe944..9858972 100644 --- a/OpenSim/Services/Friends/FriendsServiceBase.cs +++ b/OpenSim/Services/Friends/FriendsServiceBase.cs @@ -71,12 +71,14 @@ namespace OpenSim.Services.Friends // // We tried, but this doesn't exist. We can't proceed. // - if (dllName.Equals(String.Empty)) + if (String.Empty.Equals(dllName)) throw new Exception("No StorageProvider configured"); - string realm = friendsConfig.GetString("Realm", "Friends"); + string realm = "Friends"; + if (friendsConfig != null) + realm = friendsConfig.GetString("Realm", realm); - m_Database = LoadPlugin(dllName, new Object[] {connString, realm}); + m_Database = LoadPlugin(dllName, new Object[] { connString, realm }); if (m_Database == null) throw new Exception("Could not find a storage interface in the given module"); } diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index e2d0eb8..56744b6 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -306,6 +306,7 @@ namespace OpenSim.Services.HypergridService return false; string addressee = parts[0]; + m_log.DebugFormat("[GATEKEEPER SERVICE]: Verifying {0} against {1}", addressee, m_ExternalName); return (addressee == m_ExternalName); } diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 4db6a05..11a7473 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using log4net; using OpenMetaverse; @@ -215,7 +216,7 @@ namespace OpenSim.Services.LLLoginService } public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, PresenceInfo pinfo, - GridRegion destination, List invSkel, ILibraryService libService, + GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, string message, GridRegion home, IPEndPoint clientIP) : this() @@ -230,8 +231,7 @@ namespace OpenSim.Services.LLLoginService SecureSessionID = aCircuit.SecureSessionID; Message = message; // While we don't have friends... - //BuddList = ConvertFriendListItem(m_userManager.GetUserFriendList(agentID)); - BuddList = new LLLoginResponse.BuddyList(); + BuddList = ConvertFriendListItem(friendsList); StartLocation = where; FillOutHomeData(pinfo, home); @@ -607,15 +607,15 @@ namespace OpenSim.Services.LLLoginService } - private static LLLoginResponse.BuddyList ConvertFriendListItem(List LFL) + private static LLLoginResponse.BuddyList ConvertFriendListItem(FriendInfo[] friendsList) { LLLoginResponse.BuddyList buddylistreturn = new LLLoginResponse.BuddyList(); - foreach (FriendListItem fl in LFL) + foreach (FriendInfo finfo in friendsList) { - LLLoginResponse.BuddyList.BuddyInfo buddyitem = new LLLoginResponse.BuddyList.BuddyInfo(fl.Friend); - buddyitem.BuddyID = fl.Friend; - buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; - buddyitem.BuddyRightsGiven = (int)fl.FriendPerms; + LLLoginResponse.BuddyList.BuddyInfo buddyitem = new LLLoginResponse.BuddyList.BuddyInfo(finfo.Friend); + buddyitem.BuddyID = finfo.Friend; + buddyitem.BuddyRightsHave = (int)finfo.TheirFlags; + buddyitem.BuddyRightsGiven = (int)finfo.MyFlags; buddylistreturn.AddNewBuddy(buddyitem); } return buddylistreturn; @@ -945,16 +945,16 @@ namespace OpenSim.Services.LLLoginService { public int BuddyRightsHave = 1; public int BuddyRightsGiven = 1; - public UUID BuddyID; + public string BuddyID; public BuddyInfo(string buddyID) { - BuddyID = new UUID(buddyID); + BuddyID = buddyID; } public BuddyInfo(UUID buddyID) { - BuddyID = buddyID; + BuddyID = buddyID.ToString(); } public Hashtable ToHashTable() @@ -962,7 +962,7 @@ namespace OpenSim.Services.LLLoginService Hashtable hTable = new Hashtable(); hTable["buddy_rights_has"] = BuddyRightsHave; hTable["buddy_rights_given"] = BuddyRightsGiven; - hTable["buddy_id"] = BuddyID.ToString(); + hTable["buddy_id"] = BuddyID; return hTable; } } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index ba50e3f..143e5f1 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -14,6 +14,7 @@ using OpenSim.Framework.Console; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using OpenSim.Services.Connectors.Hypergrid; namespace OpenSim.Services.LLLoginService @@ -31,6 +32,7 @@ namespace OpenSim.Services.LLLoginService private ISimulationService m_LocalSimulationService; private ISimulationService m_RemoteSimulationService; private ILibraryService m_LibraryService; + private IFriendsService m_FriendsService; private IAvatarService m_AvatarService; private IUserAgentService m_UserAgentService; @@ -57,6 +59,7 @@ namespace OpenSim.Services.LLLoginService string gridService = m_LoginServerConfig.GetString("GridService", String.Empty); string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty); string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty); + string friendsService = m_LoginServerConfig.GetString("FriendsService", String.Empty); string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty); string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty); @@ -79,6 +82,8 @@ namespace OpenSim.Services.LLLoginService m_PresenceService = ServerUtils.LoadPlugin(presenceService, args); if (avatarService != string.Empty) m_AvatarService = ServerUtils.LoadPlugin(avatarService, args); + if (friendsService != string.Empty) + m_FriendsService = ServerUtils.LoadPlugin(friendsService, args); if (simulationService != string.Empty) m_RemoteSimulationService = ServerUtils.LoadPlugin(simulationService, args); if (agentService != string.Empty) @@ -228,12 +233,18 @@ namespace OpenSim.Services.LLLoginService return LLFailedLoginResponse.AuthorizationProblem; } - // TODO: Get Friends list... + // Get Friends list + FriendInfo[] friendsList = new FriendInfo[0]; + if (m_FriendsService != null) + { + friendsList = m_FriendsService.GetFriends(account.PrincipalID); + m_log.DebugFormat("[LLOGIN SERVICE]: Retrieved {0} friends", friendsList.Length); + } // // Finally, fill out the response and return it // - LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, m_LibraryService, + LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, friendsList, m_LibraryService, where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP); return response; @@ -587,7 +598,7 @@ namespace OpenSim.Services.LLLoginService private bool LaunchAgentIndirectly(GridRegion gatekeeper, GridRegion destination, AgentCircuitData aCircuit, out string reason) { - m_log.Debug("XXX Launching agent at {0}" + destination.RegionName); + m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName); return m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); } diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index 06333d8..ce77b3f 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -59,6 +59,9 @@ GridService = "OpenSim.Services.GridService.dll:GridService" InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" +[Friends] + Connector = "OpenSim.Services.FriendsService.dll" + [LoginService] LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService" UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService" @@ -67,6 +70,7 @@ PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService" + FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" WelcomeMessage = "Welcome, Avatar!" diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 04a2356..ecdd6f7 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -77,6 +77,8 @@ GridService = "OpenSim.Services.GridService.dll:GridService" InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" +[Friends] + Connector = "OpenSim.Services.FriendsService.dll" [LoginService] LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService" @@ -87,16 +89,18 @@ PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService" + FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" [GatekeeperService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" - ;; for the service + ;; for the service UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService" - UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" + UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" GridService = "OpenSim.Services.GridService.dll:GridService" AuthenticationService = "OpenSim.Services.Connectors.dll:AuthenticationServicesConnector" - ; how does the outside world reach me? This acts as public key too. + SimulationService ="OpenSim.Services.Connectors.dll:SimulationServiceConnector" + WelcomeMessage = "Welcome, Avatar!" [UserAgentService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:UserAgentService" -- cgit v1.1