예제 #1
0
        private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID,
                                            List <UUID> callingCardFolders)
        {
            MainConsole.Instance.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 and send calling card to the local user

            ICallingCardModule ccmodule = client.Scene.RequestModuleInterface <ICallingCardModule>();

            if (ccmodule != null)
            {
                UserAccount account  = client.Scene.UserAccountService.GetUserAccount(client.AllScopeIDs, friendID);
                UUID        folderID =
                    client.Scene.InventoryService.GetFolderForType(agentID, InventoryType.Unknown, AssetType.CallingCard)
                    .ID;
                if (account != null)
                {
                    ccmodule.CreateCallingCard(client, friendID, folderID, account.Name);
                }
            }

            // Try Local
            if (LocalFriendshipApproved(agentID, client.Name, client, friendID))
            {
                return;
            }
            SyncMessagePosterService.PostToServer(SyncMessageHelper.FriendshipApproved(
                                                      agentID, client.Name, friendID, m_scene.RegionInfo.RegionID));
        }
예제 #2
0
        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));
            }
        }