예제 #1
0
        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;
            }

            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    if (region != null)
                    {
                        m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
                    }
                    else
                    {
                        m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
                    }
                }
            }
        }
예제 #2
0
        private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders)
        {
            MainConsole.Instance.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", agentID, friendID);


            FriendInfo[] friends = FriendsService.GetFriendsRequest(agentID).ToArray();
            foreach (FriendInfo fi in friends)
            {
                if (fi.MyFlags == 0)
                {
                    UUID fromAgentID;
                    if (!UUID.TryParse(fi.Friend, out fromAgentID))
                    {
                        continue;
                    }
                    if (fromAgentID == friendID) //Get those pesky HG travelers as well
                    {
                        FriendsService.Delete(agentID, fi.Friend);
                    }
                }
            }
            FriendsService.Delete(friendID, agentID.ToString());

            //
            // Notify the friend
            //

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

            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
                }
            }
        }
예제 #4
0
        private void DeletePreviousRelations(UUID a1, UUID a2)
        {
            // Delete any previous friendship relations
            FriendInfo[] finfos = null;
            FriendInfo   f      = null;

            finfos = GetFriendsFromCache(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 = GetFriendsFromCache(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());
                }
            }
        }
예제 #5
0
        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));
            }
        }
예제 #6
0
        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));
            }
        }
예제 #7
0
        public bool Delete(UUID PrincipalID, string Friend)
        {
            bool success = m_localService.Delete(PrincipalID, Friend);

            if (!success)
            {
                success = m_remoteService.Delete(PrincipalID, Friend);
            }
            return(success);
        }
예제 #8
0
        private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders)
        {
            MainConsole.Instance.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;
            }
            SyncMessagePosterService.Post(SyncMessageHelper.FriendshipDenied(
                                              agentID, client.Name, friendID, m_Scenes[0].RegionInfo.RegionHandle),
                                          m_Scenes[0].RegionInfo.RegionHandle);
        }
예제 #9
0
        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;
            }

            SyncMessagePosterService.PostToServer(SyncMessageHelper.FriendTerminated(
                                                      agentID, exfriendID, m_scene.RegionInfo.RegionID));
        }
예제 #10
0
        private void DeletePreviousHGRelations(UUID a1, UUID a2)
        {
            // Delete any previous friendship relations
            FriendInfo[] finfos = null;
            finfos = GetFriendsFromCache(a1);
            if (finfos != null)
            {
                foreach (FriendInfo f in finfos)
                {
                    if (f.TheirFlags == -1)
                    {
                        if (f.Friend.StartsWith(a2.ToString()))
                        {
                            FriendsService.Delete(a1, f.Friend);
                            // and also the converse
                            FriendsService.Delete(f.Friend, a1.ToString());
                        }
                    }
                }
            }

            finfos = GetFriendsFromCache(a1);
            if (finfos != null)
            {
                foreach (FriendInfo f in finfos)
                {
                    if (f.TheirFlags == -1)
                    {
                        if (f.Friend.StartsWith(a1.ToString()))
                        {
                            FriendsService.Delete(a2, f.Friend);
                            // and also the converse
                            FriendsService.Delete(f.Friend, a2.ToString());
                        }
                    }
                }
            }
        }
예제 #11
0
        protected override bool DeleteFriendship(UUID agentID, UUID exfriendID)
        {
            Boolean agentIsLocal  = true;
            Boolean friendIsLocal = true;

            if (UserManagementModule != null)
            {
                agentIsLocal  = UserManagementModule.IsLocalGridUser(agentID);
                friendIsLocal = UserManagementModule.IsLocalGridUser(exfriendID);
            }

            // Are they both local users?
            if (agentIsLocal && friendIsLocal)
            {
                // local grid users
                return(base.DeleteFriendship(agentID, exfriendID));
            }

            // ok, at least one of them is foreigner, let's get their data
            string agentUUI  = string.Empty;
            string friendUUI = string.Empty;

            if (agentIsLocal) // agent is local, 'friend' is foreigner
            {
                // We need to look for its information in the friends list itself
                FriendInfo[] finfos = GetFriends(agentID);
                FriendInfo   finfo  = GetFriend(finfos, exfriendID);
                if (finfo != null)
                {
                    friendUUI = finfo.Friend;

                    // delete in the local friends service the reference to the foreign friend
                    FriendsService.Delete(agentID, friendUUI);
                    // and also the converse
                    FriendsService.Delete(friendUUI, agentID.ToString());

                    // notify the exfriend's service
                    Util.FireAndForget(delegate { Delete(exfriendID, agentID, friendUUI); });

                    m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentID, friendUUI);
                    return(true);
                }
            }
            else if (friendIsLocal) // agent is foreigner, 'friend' is local
            {
                agentUUI = GetUUI(exfriendID, agentID);

                if (agentUUI != string.Empty)
                {
                    // delete in the local friends service the reference to the foreign agent
                    FriendsService.Delete(exfriendID, agentUUI);
                    // and also the converse
                    FriendsService.Delete(agentUUI, exfriendID.ToString());

                    // notify the agent's service?
                    Util.FireAndForget(delegate { Delete(agentID, exfriendID, agentUUI); });

                    m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentUUI, exfriendID);
                    return(true);
                }
            }
            //else They're both foreigners! Can't handle this

            return(false);
        }
예제 #12
0
 public async Task <IActionResult> Delete([FromRoute] int id)
 {
     FriendsService.Delete(await FriendsService.GetSingle(id));
     return(NoContent());
 }
예제 #13
0
 protected virtual bool DeleteFriendship(UUID agentID, UUID exfriendID)
 {
     FriendsService.Delete(agentID, exfriendID.ToString());
     FriendsService.Delete(exfriendID, agentID.ToString());
     return(true);
 }