private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID) { FriendsService.Delete(agentID, exfriendID.ToString()); FriendsService.Delete(exfriendID, agentID.ToString()); // Update local cache UpdateFriendsCache(agentID); client.SendTerminateFriend(exfriendID); // // Notify the friend // // Try local if (LocalFriendshipTerminated(exfriendID, agentID)) { return; } UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(exfriendID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendTerminated( agentID, exfriendID, region.RegionHandle)); } }
private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders) { m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", agentID, friendID); FriendsService.Delete(agentID, friendID.ToString()); FriendsService.Delete(friendID, agentID.ToString()); // // Notify the friend // // Try local if (LocalFriendshipDenied(agentID, client.Name, friendID)) { return; } UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(friendID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendshipDenied( agentID, client.Name, friendID, region.RegionHandle)); } }
private void 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 im.imSessionID = im.fromAgentID; // Try the local sim UserAccount account = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; if (LocalFriendshipOffered(friendID, im)) { return; } // The prospective friend is not here [as root]. Let's forward. UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(friendID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendshipOffered( agentID, friendID, im, region.RegionHandle)); } // If the prospective friend is not online, he'll get the message upon login. }
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { FriendInfo[] friends = GetFriends(remoteClient.AgentId); if (friends.Length == 0) { return; } m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); // Let's find the friend in this user's friend list FriendInfo friend = null; foreach (FriendInfo fi in friends) { if (fi.Friend == target.ToString()) { friend = fi; } } if (friend != null) // Found it { // Store it on the DB FriendsService.StoreFriend(requester, target.ToString(), rights); // Store it in the local cache int myFlags = friend.MyFlags; friend.MyFlags = rights; // Always send this back to the original client remoteClient.SendChangeUserRights(requester, target, rights); // // Notify the friend // // Try local if (!LocalGrantRights(requester, target, myFlags, rights)) { UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(target.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendGrantRights( requester, target, myFlags, rights, region.RegionHandle)); } } } }
private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders) { m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); // Update the local cache UpdateFriendsCache(agentID); // // Notify the friend // // // Send calling card to the local user // ICallingCardModule ccmodule = client.Scene.RequestModuleInterface <ICallingCardModule>(); if (ccmodule != null) { UserAccount account = ((Scene)client.Scene).UserAccountService.GetUserAccount(UUID.Zero, friendID); UUID folderID = ((Scene)client.Scene).InventoryService.GetFolderForType(agentID, AssetType.CallingCard).ID; ccmodule.CreateCallingCard(client, friendID, folderID, account.Name); } // Try Local if (LocalFriendshipApproved(agentID, client.Name, client, friendID)) { return; } // The friend is not here UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(friendID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID); AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendshipApproved( agentID, client.Name, friendID, region.RegionHandle)); } }