From d08ad6459a03a6a5a6a551fd2b275f1c7da94d8e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 20 Mar 2012 17:14:19 -0700 Subject: HG Friends: allow the establishment of HG friendships without requiring co-presence in the same sim. Using avatar picker, users can now search for names such as "first.last@grid.com:9000", find them, and request friendship. Friendship requests are stored if target user is offline. TESTED ON STANDALONE ONLY. --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 31 ++- .../CoreModules/Avatar/Friends/HGFriendsModule.cs | 290 +++++++++++++-------- .../UserManagement/HGUserManagementModule.cs | 76 +++--- .../UserManagement/UserManagementModule.cs | 20 +- .../Hypergrid/HypergridServiceInConnectorModule.cs | 26 +- 5 files changed, 276 insertions(+), 167 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index c266fe5..f6a31b5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -550,7 +550,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends UUID principalID = new UUID(im.fromAgentID); UUID friendID = new UUID(im.toAgentID); - m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2}", principalID, im.fromAgentName, friendID); + m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2} ({3})", principalID, client.FirstName + client.LastName, friendID, im.fromAgentName); + + // Check that the friendship doesn't exist yet + FriendInfo[] finfos = GetFriends(principalID); + if (finfos != null) + { + FriendInfo f = GetFriend(finfos, friendID); + if (f != null) + { + client.SendAgentAlertMessage("This person is already your friend. Please delete it first if you want to reestablish the friendship.", false); + return; + } + } // This user wants to be friends with the other user. // Let's add the relation backwards, in case the other is not online @@ -561,7 +573,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } - private void ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) + protected virtual bool ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) { // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID) // We stick this agent's ID as imSession, so that it's directly available on the receiving end @@ -570,7 +582,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Try the local sim if (LocalFriendshipOffered(friendID, im)) - return; + { + m_log.DebugFormat("[XXX]: LocalFriendshipOffered successes"); + return true; + } // The prospective friend is not here [as root]. Let's forward. PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); @@ -581,9 +596,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); + return true; } } // If the prospective friend is not online, he'll get the message upon login. + return false; } protected virtual string GetFriendshipRequesterName(UUID agentID) @@ -592,7 +609,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; } - private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List callingCardFolders) + protected virtual void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List callingCardFolders) { m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); @@ -603,7 +620,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { StoreFriendships(client.AgentId, friendID); - // Update the local cache + // Update the local cache. RecacheFriends(client); // @@ -756,7 +773,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends #region Local - public bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) + public virtual bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) { IClientAPI friendClient = LocateClientObject(toID); if (friendClient != null) @@ -912,7 +929,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return FriendsService.GetFriends(client.AgentId); } - private void RecacheFriends(IClientAPI client) + protected void RecacheFriends(IClientAPI client) { // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event // is on the critical path for transferring an avatar from one region to another. diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 9c53fc4..0fe1134 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } + protected HGFriendsServicesConnector m_HGFriendsConnector = new HGFriendsServicesConnector(); + #region ISharedRegionModule public override string Name { @@ -94,6 +96,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends #endregion + protected override void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List callingCardFolders) + { + // Update the local cache. Yes, we need to do it right here + // because the HGFriendsService placed something on the DB + // from under the sim + base.OnApproveFriendRequest(client, agentID, friendID, callingCardFolders); + } + protected override bool CacheFriends(IClientAPI client) { // m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name); @@ -183,91 +193,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID); } - //protected override void GetOnlineFriends(UUID userID, List friendList, /*collector*/ List online) - //{ - // // Let's single out the UUIs - // List localFriends = new List(); - // List foreignFriends = new List(); - // string tmp = string.Empty; - - // foreach (string s in friendList) - // { - // UUID id; - // if (UUID.TryParse(s, out id)) - // localFriends.Add(s); - // else if (Util.ParseUniversalUserIdentifier(s, out id, out tmp, out tmp, out tmp, out tmp)) - // { - // foreignFriends.Add(s); - // // add it here too, who knows maybe the foreign friends happens to be on this grid - // localFriends.Add(id.ToString()); - // } - // } - - // // OK, see who's present on this grid - // List toBeRemoved = new List(); - // PresenceInfo[] presence = PresenceService.GetAgents(localFriends.ToArray()); - // foreach (PresenceInfo pi in presence) - // { - // UUID presenceID; - // if (UUID.TryParse(pi.UserID, out presenceID)) - // { - // online.Add(presenceID); - // foreach (string s in foreignFriends) - // if (s.StartsWith(pi.UserID)) - // toBeRemoved.Add(s); - // } - // } - - // foreach (string s in toBeRemoved) - // foreignFriends.Remove(s); - - // // OK, let's send this up the stack, and leave a closure here - // // collecting online friends in other grids - // Util.FireAndForget(delegate { CollectOnlineFriendsElsewhere(userID, foreignFriends); }); - - //} - - //private void CollectOnlineFriendsElsewhere(UUID userID, List foreignFriends) - //{ - // // let's divide the friends on a per-domain basis - // Dictionary> friendsPerDomain = new Dictionary>(); - // foreach (string friend in foreignFriends) - // { - // UUID friendID; - // if (!UUID.TryParse(friend, out friendID)) - // { - // // it's a foreign friend - // string url = string.Empty, tmp = string.Empty; - // if (Util.ParseUniversalUserIdentifier(friend, out friendID, out url, out tmp, out tmp, out tmp)) - // { - // if (!friendsPerDomain.ContainsKey(url)) - // friendsPerDomain[url] = new List(); - // friendsPerDomain[url].Add(friend); - // } - // } - // } - - // // Now, call those worlds - - // foreach (KeyValuePair> kvp in friendsPerDomain) - // { - // List ids = new List(); - // foreach (string f in kvp.Value) - // ids.Add(f); - // UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); - // List online = uConn.GetOnlineFriends(userID, ids); - // // Finally send the notifications to the user - // // this whole process may take a while, so let's check at every - // // iteration that the user is still here - // IClientAPI client = LocateClientObject(userID); - // if (client != null) - // client.SendAgentOnline(online.ToArray()); - // else - // break; - // } - - //} - protected override void StatusNotify(List friendList, UUID userID, bool online) { // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID); @@ -335,12 +260,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return true; // fid is not a UUID... - string url = string.Empty, tmp = string.Empty; - if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out first, out last, out tmp)) + string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty; + m_log.DebugFormat("[YYY]: FID {0}", fid); + if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp)) { - IUserManagement userMan = m_Scenes[0].RequestModuleInterface(); - userMan.AddUser(agentID, first, last, url); + m_log.DebugFormat("[YYY]: Adding user {0} {1} {2}", f, l, url); + m_uMan.AddUser(agentID, f, l, url); + string name = m_uMan.GetUserName(agentID); + string[] parts = name.Trim().Split(new char[] {' '}); + if (parts.Length == 2) + { + first = parts[0]; + last = parts[1]; + } + else + { + first = f; + last = l; + } return true; } return false; @@ -348,13 +286,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected override string GetFriendshipRequesterName(UUID agentID) { - // For the time being we assume that HG friendship requests can only happen - // when avies are on the same region. - IClientAPI client = LocateClientObject(agentID); - if (client != null) - return client.FirstName + " " + client.LastName; - else - return base.GetFriendshipRequesterName(agentID); + return m_uMan.GetUserName(agentID); } protected override string FriendshipMessage(string friendID) @@ -392,10 +324,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); if (agentClientCircuit != null) { - string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); + //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); - finfos = FriendsService.GetFriends(agentUUI); - m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, agentUUI); + finfos = FriendsService.GetFriends(client.AgentId.ToString()); + m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); } // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); @@ -454,16 +386,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); } - // Are they both local users? - if (agentIsLocal && friendIsLocal) + // Is the requester a local user? + if (agentIsLocal) { // local grid users - m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); + m_log.DebugFormat("[HGFRIENDS MODULE]: Friendship requester is local. Storing backwards."); + base.StoreBackwards(friendID, agentID); return; } - // no provision for this temporary friendship state + // no provision for this temporary friendship state when user is not local //FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), 0); } @@ -501,12 +434,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); + RecacheFriends(agentClient); } if (friendClient != null) { friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); friendFriendService = friendClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); + RecacheFriends(friendClient); } m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}", @@ -515,14 +450,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Generate a random 8-character hex number that will sign this friendship string secret = UUID.Random().ToString().Substring(0, 8); + string theFriendUUID = friendUUI + ";" + secret; + string agentUUID = agentUUI + ";" + secret; + if (agentIsLocal) // agent is local, 'friend' is foreigner { // This may happen when the agent returned home, in which case the friend is not there // We need to look for its information in the friends list itself + FriendInfo[] finfos = null; bool confirming = false; if (friendUUI == string.Empty) { - FriendInfo[] finfos = GetFriends(agentID); + finfos = GetFriends(agentID); foreach (FriendInfo finfo in finfos) { if (finfo.TheirFlags == -1) @@ -530,29 +469,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (finfo.Friend.StartsWith(friendID.ToString())) { friendUUI = finfo.Friend; + theFriendUUID = friendUUI; + UUID utmp = UUID.Zero; String url = String.Empty; String first = String.Empty, last = String.Empty, tmp = String.Empty; + // If it's confirming the friendship, we already have the full UUI with the secret + if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) + { + agentUUID = agentUUI + ";" + secret; + m_uMan.AddUser(utmp, first, last, url); + } confirming = true; + break; } } } - } + if (!confirming) + { + friendUUI = m_uMan.GetUserUUI(friendID); + theFriendUUID = friendUUI + ";" + secret; + } + + friendFriendService = m_uMan.GetUserServerURL(friendID, "FriendsServerURI"); - // If it's confirming the friendship, we already have the full friendUUI with the secret - string theFriendUUID = confirming ? friendUUI : friendUUI + ";" + secret; + // m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}", + // agentUUI, friendUUI, agentFriendService, friendFriendService); + + } + + // Delete any previous friendship relations + DeletePreviousRelations(agentID, friendID); // store in the local friends service a reference to the foreign friend FriendsService.StoreFriend(agentID.ToString(), theFriendUUID, 1); // and also the converse FriendsService.StoreFriend(theFriendUUID, agentID.ToString(), 1); - if (!confirming && friendClientCircuit != null) - { + //if (!confirming) + //{ // store in the foreign friends service a reference to the local agent - HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(friendFriendService, friendClientCircuit.SessionID, friendClientCircuit.ServiceSessionID); - friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); - } + HGFriendsServicesConnector friendsConn = null; + if (friendClientCircuit != null) // the friend is here, validate session + friendsConn = new HGFriendsServicesConnector(friendFriendService, friendClientCircuit.SessionID, friendClientCircuit.ServiceSessionID); + else // the friend is not here, he initiated the request in his home world + friendsConn = new HGFriendsServicesConnector(friendFriendService); + + friendsConn.NewFriendship(friendID, agentUUID); + //} } else if (friendIsLocal) // 'friend' is local, agent is foreigner { + // Delete any previous friendship relations + DeletePreviousRelations(agentID, friendID); + // store in the local friends service a reference to the foreign agent FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); // and also the converse @@ -582,6 +549,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // my brain hurts now } + private void DeletePreviousRelations(UUID a1, UUID a2) + { + // Delete any previous friendship relations + FriendInfo[] finfos = null; + FriendInfo f = null; + finfos = GetFriends(a1); + if (finfos != null) + { + f = GetFriend(finfos, a2); + if (f != null) + { + FriendsService.Delete(a1, f.Friend); + // and also the converse + FriendsService.Delete(f.Friend, a1.ToString()); + } + } + + finfos = GetFriends(a2); + if (finfos != null) + { + f = GetFriend(finfos, a1); + if (f != null) + { + FriendsService.Delete(a2, f.Friend); + // and also the converse + FriendsService.Delete(f.Friend, a2.ToString()); + } + } + } + protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) { Boolean agentIsLocal = true; @@ -684,5 +681,74 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends friendConn.DeleteFriendship(foreignUser, localUser, secret); } } + + protected override bool ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) + { + if (base.ForwardFriendshipOffer(agentID, friendID, im)) + return true; + + // OK, that didn't work, so let's try to find this user somewhere + if (!m_uMan.IsLocalGridUser(friendID)) + { + string friendsURL = m_uMan.GetUserServerURL(friendID, "FriendsServerURI"); + if (friendsURL != string.Empty) + { + m_log.DebugFormat("[HGFRIENDS MODULE]: Forwading friendship from {0} to {1} @ {2}", agentID, friendID, friendsURL); + GridRegion region = new GridRegion(); + region.ServerURI = friendsURL; + + string name = im.fromAgentName; + if (m_uMan.IsLocalGridUser(agentID)) + { + IClientAPI agentClient = LocateClientObject(agentID); + AgentCircuitData agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); + string agentHomeService = string.Empty; + try + { + agentHomeService = agentClientCircuit.ServiceURLs["HomeURI"].ToString(); + string lastname = "@" + new Uri(agentHomeService).Authority; + string firstname = im.fromAgentName.Replace(" ", "."); + name = firstname + lastname; + } + catch (KeyNotFoundException) + { + m_log.DebugFormat("[HGFRIENDS MODULE]: Key HomeURI not found for user {0}", agentID); + return false; + } + catch (NullReferenceException) + { + m_log.DebugFormat("[HGFRIENDS MODULE]: Null HomeUri for local user {0}", agentID); + return false; + } + catch (UriFormatException) + { + m_log.DebugFormat("[HGFRIENDS MODULE]: Malformed HomeUri {0} for local user {1}", agentHomeService, agentID); + return false; + } + } + + m_HGFriendsConnector.FriendshipOffered(region, agentID, friendID, im.message, name); + + return true; + } + } + + return false; + } + + public override bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) + { + if (base.LocalFriendshipOffered(toID, im)) + { + if (im.fromAgentName.Contains("@")) + { + string[] parts = im.fromAgentName.Split(new char[] { '@' }); + if (parts.Length == 2) + m_uMan.AddUser(new UUID(im.fromAgentID), parts[0], "http://" + parts[1]); + } + return true; + } + return false; + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs index 66de8e4..4eecaa2 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs @@ -71,43 +71,52 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement protected override void AddAdditionalUsers(UUID avatarID, string query, List users) { - string[] words = query.Split(new char[] { ' ' }); - - for (int i = 0; i < words.Length; i++) + if (query.Contains("@")) // First.Last@foo.com, maybe? { - if (words[i].Length < 3) + string[] words = query.Split(new char[] { '@' }); + if (words.Length != 2) { - if (i != words.Length - 1) - Array.Copy(words, i + 1, words, i, words.Length - i - 1); - Array.Resize(ref words, words.Length - 1); + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query); + return; } - } - if (words.Length == 0 || words.Length > 2) - return; + words[0] = words[0].Trim(); // it has at least 1 + words[1] = words[1].Trim(); - if (words.Length == 2) // First.Last @foo.com, maybe? - { - bool found = false; + if (words[0] == String.Empty) // query was @foo.com? + { + foreach (UserData d in m_UserCache.Values) + { + if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower())) + users.Add(d); + } + + // We're done + return; + } + + // words.Length == 2 and words[0] != string.empty + // first.last@foo.com ? foreach (UserData d in m_UserCache.Values) { - if (d.LastName.StartsWith("@") && + if (d.LastName.StartsWith("@") && d.FirstName.ToLower().Equals(words[0].ToLower()) && - d.LastName.ToLower().Equals(words[1].ToLower())) + d.LastName.ToLower().Equals("@" + words[1].ToLower())) { users.Add(d); - found = true; - break; + // It's cached. We're done + return; } } - if (!found && words[1].StartsWith("@") && words[0].Contains(".")) // This is it! Let's ask the other world + // This is it! Let's ask the other world + if (words[0].Contains(".")) { string[] names = words[0].Split(new char[] { '.' }); if (names.Length >= 2) { - string uriStr = "http://" + words[1].Substring(1); // remove the @ + string uriStr = "http://" + words[1]; // Let's check that the last name is a valid address try { @@ -115,6 +124,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } catch (UriFormatException) { + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr); return; } @@ -125,26 +135,26 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement UserData ud = new UserData(); ud.Id = userID; ud.FirstName = words[0]; - ud.LastName = words[1]; + ud.LastName = "@" + words[1]; users.Add(ud); - AddUser(userID, ud.FirstName, ud.LastName, uriStr); - m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0} {1} found", words[0], words[1]); + AddUser(userID, names[0], names[1], uriStr); + m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]); } else - m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0} {1} not found", words[0], words[1]); + m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]); } } } - else - { - foreach (UserData d in m_UserCache.Values) - { - if (d.LastName.StartsWith("@") && - (d.FirstName.ToLower().StartsWith(query.ToLower()) || - d.LastName.ToLower().StartsWith(query.ToLower()))) - users.Add(d); - } - } + //else + //{ + // foreach (UserData d in m_UserCache.Values) + // { + // if (d.LastName.StartsWith("@") && + // (d.FirstName.ToLower().StartsWith(query.ToLower()) || + // d.LastName.ToLower().StartsWith(query.ToLower()))) + // users.Add(d); + // } + //} } } diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index cb562a2..0397478 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -299,7 +299,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement public string GetUserName(UUID uuid) { - //m_log.DebugFormat("[XXX] GetUserName {0}", uuid); string[] names = GetUserNames(uuid); if (names.Length == 2) { @@ -340,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) { - m_log.DebugFormat( - "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", - serverType, userdata.HomeURL, userID); + //m_log.DebugFormat( + // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", + // serverType, userdata.HomeURL, userID); UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); userdata.ServerURLs = uConn.GetServerURLs(userID); @@ -401,11 +400,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement public void AddUser(UUID uuid, string first, string last, string homeURL) { + // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL); + AddUser(uuid, homeURL + ";" + first + " " + last); } public void AddUser (UUID id, string creatorData) { + //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); + UserData oldUser; //lock the whole block - prevent concurrent update lock (m_UserCache) @@ -431,9 +434,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return; } } -// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); - UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); if (account != null) { @@ -482,9 +484,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement lock (m_UserCache) m_UserCache[user.Id] = user; -// m_log.DebugFormat( -// "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", -// user.Id, user.FirstName, user.LastName, user.HomeURL); + //m_log.DebugFormat( + // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", + // user.Id, user.FirstName, user.LastName, user.HomeURL); } public bool IsLocalGridUser(UUID uuid) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 89abbb2..8df1c7b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs @@ -48,8 +48,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid private static bool m_Enabled = false; private IConfigSource m_Config; - bool m_Registered = false; - GatekeeperServiceInConnector m_HypergridHandler; + private bool m_Registered = false; + private string m_LocalServiceDll = String.Empty; + private GatekeeperServiceInConnector m_HypergridHandler; + private UserAgentServerConnector m_UASHandler; #region IRegionModule interface @@ -63,6 +65,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid if (m_Enabled) { m_log.Info("[HGGRID IN CONNECTOR]: Hypergrid Service In Connector enabled"); + IConfig fconfig = config.Configs["FriendsService"]; + if (fconfig != null) + { + m_LocalServiceDll = fconfig.GetString("LocalServiceModule", m_LocalServiceDll); + if (m_LocalServiceDll == String.Empty) + m_log.WarnFormat("[HGGRID IN CONNECTOR]: Friends LocalServiceModule config missing"); + } } } @@ -91,7 +100,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid { if (!m_Enabled) return; - } public void RemoveRegion(Scene scene) @@ -112,14 +120,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid m_log.Info("[HypergridService]: Starting..."); ISimulationService simService = scene.RequestModuleInterface(); + IFriendsSimConnector friendsConn = scene.RequestModuleInterface(); + Object[] args = new Object[] { m_Config }; + IFriendsService friendsService = ServerUtils.LoadPlugin(m_LocalServiceDll, args); + m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); - IFriendsSimConnector friendsConn = scene.RequestModuleInterface(); - new UserAgentServerConnector(m_Config, MainServer.Instance, friendsConn); + m_UASHandler = new UserAgentServerConnector(m_Config, MainServer.Instance, friendsConn); + new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); - new HGFriendsServerConnector(m_Config, MainServer.Instance, "HGFriendsService"); + + new HGFriendsServerConnector(m_Config, MainServer.Instance, "HGFriendsService", friendsConn); } scene.RegisterModuleInterface(m_HypergridHandler.GateKeeper); + scene.RegisterModuleInterface(m_UASHandler.HomeUsersService); } #endregion -- cgit v1.1