コード例 #1
0
        public void SendFriendsStatusMessage(UUID FriendToInformID, UUID[] userIDs, bool online)
        {
            // Try local
            IClientAPI friendClient = LocateClientObject(FriendToInformID);

            if (friendClient != null)
            {
                MainConsole.Instance.InfoFormat("[FriendsModule]: Local Status Notify {0} that {1} users are {2}", FriendToInformID, userIDs.Length, online);
                // the  friend in this sim as root agent
                if (online)
                {
                    friendClient.SendAgentOnline(userIDs);
                }
                else
                {
                    friendClient.SendAgentOffline(userIDs);
                }
                // we're done
                return;
            }
            else
            {
                MainConsole.Instance.ErrorFormat("[FriendsModule]: Could not send status update to non-existant client {0}.",
                                                 FriendToInformID);
            }
        }
コード例 #2
0
ファイル: FriendsModule.cs プロジェクト: BogusCurry/opensim-1
        public bool LocalGrantRights(UUID userID, UUID friendID, int oldRights, int newRights)
        {
            IClientAPI friendClient = LocateClientObject(friendID);

            if (friendClient != null)
            {
                int  changedRights    = newRights ^ oldRights;
                bool onlineBitChanged = (changedRights & (int)FriendRights.CanSeeOnline) != 0;
                if (onlineBitChanged)
                {
                    if ((newRights & (int)FriendRights.CanSeeOnline) == 1)
                    {
                        friendClient.SendAgentOnline(new UUID[] { userID });
                    }
                    else
                    {
                        friendClient.SendAgentOffline(new UUID[] { userID });
                    }
                }

                if (changedRights != 0)
                {
                    friendClient.SendChangeUserRights(userID, friendID, newRights);
                }

                // Update local cache
                UpdateLocalCache(userID, friendID, newRights);

                return(true);
            }

            return(false);
        }
コード例 #3
0
        public void SendFriendsStatusMessage(UUID FriendToInformID, UUID userID, bool online)
        {
            // Try local
            IClientAPI friendClient = LocateClientObject(FriendToInformID);

            if (friendClient != null)
            {
                //MainConsole.Instance.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
                // the  friend in this sim as root agent
                if (online)
                {
                    friendClient.SendAgentOnline(new[] { userID });
                }
                else
                {
                    friendClient.SendAgentOffline(new[] { userID });
                }
                // we're done
                return;
            }

            lock (m_friendsToInformOfStatusChanges)
            {
                if (!m_friendsToInformOfStatusChanges.ContainsKey(FriendToInformID))
                {
                    m_friendsToInformOfStatusChanges.Add(FriendToInformID, new List <UUID>());
                }
                m_friendsToInformOfStatusChanges[FriendToInformID].Add(userID);
            }

            // Friend is not online. Ignore.
        }
コード例 #4
0
        public bool LocalGrantRights(UUID userID, UUID friendID, int userFlags, int rights)
        {
            IClientAPI friendClient = LocateClientObject(friendID);

            if (friendClient != null)
            {
                bool onlineBitChanged = ((rights ^ userFlags) & (int)FriendRights.CanSeeOnline) != 0;
                if (onlineBitChanged)
                {
                    if ((rights & (int)FriendRights.CanSeeOnline) == 1)
                    {
                        friendClient.SendAgentOnline(new UUID[] { userID });
                    }
                    else
                    {
                        friendClient.SendAgentOffline(new UUID[] { userID });
                    }
                }
                else
                {
                    bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
                    if (canEditObjectsChanged)
                    {
                        friendClient.SendChangeUserRights(userID, friendID, rights);
                    }
                }

                // Update local cache
                UpdateLocalCache(userID, friendID, rights);

                return(true);
            }

            return(false);
        }
コード例 #5
0
        public bool LocalGrantRights(UUID userID, UUID friendID, int userFlags, int rights)
        {
            IClientAPI friendClient = LocateClientObject(friendID);

            if (friendClient != null)
            {
                bool onlineBitChanged = ((rights ^ userFlags) & (int)FriendRights.CanSeeOnline) != 0;
                if (onlineBitChanged)
                {
                    if ((rights & (int)FriendRights.CanSeeOnline) == 1)
                    {
                        friendClient.SendAgentOnline(new[] { new UUID(userID) });
                    }
                    else
                    {
                        friendClient.SendAgentOffline(new[] { new UUID(userID) });
                    }
                }
                else
                {
                    bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
                    if (canEditObjectsChanged)
                    {
                        friendClient.SendChangeUserRights(userID, friendID, rights);
                    }
                }

                // Update local cache
                FriendInfo[] friends = GetFriends(friendID);
                foreach (FriendInfo finfo in friends.Where(finfo => finfo.Friend == userID.ToString()))
                {
                    finfo.TheirFlags = rights;
                }
                friends = GetFriends(userID);
                foreach (FriendInfo finfo in friends.Where(finfo => finfo.Friend == friendID.ToString()))
                {
                    finfo.MyFlags = rights;
                }
                //Add primFlag updates for all the prims in the sim with the owner, so that the new permissions are set up correctly
                IScenePresence friendSP = friendClient.Scene.GetScenePresence(friendClient.AgentId);
                foreach (
                    ISceneEntity entity in
                    friendClient.Scene.Entities.GetEntities().Where(entity => entity.OwnerID == userID))
                {
                    entity.ScheduleGroupUpdateToAvatar(friendSP, PrimUpdateFlags.PrimFlags);
                }

                return(true);
            }

            return(false);
        }
コード例 #6
0
        public bool LocalGrantRights(UUID userID, UUID friendID, int userFlags, int rights)
        {
            IClientAPI friendClient = LocateClientObject(friendID);

            if (friendClient != null)
            {
                bool onlineBitChanged = ((rights ^ userFlags) & (int)FriendRights.CanSeeOnline) != 0;
                if (onlineBitChanged)
                {
                    if ((rights & (int)FriendRights.CanSeeOnline) == 1)
                    {
                        friendClient.SendAgentOnline(new UUID[] { new UUID(userID) });
                    }
                    else
                    {
                        friendClient.SendAgentOffline(new UUID[] { new UUID(userID) });
                    }
                }
                else
                {
                    bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
                    if (canEditObjectsChanged)
                    {
                        friendClient.SendChangeUserRights(userID, friendID, rights);
                    }
                }

                // Update local cache
                lock (m_Friends)
                {
                    FriendInfo[] friends = GetFriends(friendID);
                    foreach (FriendInfo finfo in friends)
                    {
                        if (finfo.Friend == userID.ToString())
                        {
                            finfo.TheirFlags = rights;
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
コード例 #7
0
        public void OnRequestOnlineNotification(object sender, string method, List <string> args)
        {
            if (!(sender is IClientAPI))
            {
                return;
            }

            IClientAPI client = (IClientAPI)sender;

            MainConsole.Instance.DebugFormat("[PRESENCE MODULE]: OnlineNotification requested by {0}", client.Name);

            List <UserInfo> status = m_Scene.RequestModuleInterface <IAgentInfoService> ().GetUserInfos(args);

            if (status == null)
            {
                return;
            }

            List <UUID> online  = new List <UUID> ();
            List <UUID> offline = new List <UUID> ();

            foreach (UserInfo pi in status)
            {
                UUID uuid = new UUID(pi.UserID);
                if (pi.IsOnline && !online.Contains(uuid))
                {
                    online.Add(uuid);
                }
                if (!pi.IsOnline && !offline.Contains(uuid))
                {
                    offline.Add(uuid);
                }
            }

            if (online.Count > 0)
            {
                client.SendAgentOnline(online.ToArray());
            }
            if (offline.Count > 0)
            {
                client.SendAgentOffline(offline.ToArray());
            }
        }
コード例 #8
0
        public void OnRequestOnlineNotification(Object sender, string method, List <String> args)
        {
            if (!(sender is IClientAPI))
            {
                return;
            }

            IClientAPI client = (IClientAPI)sender;

            m_log.DebugFormat("[PRESENCE MODULE]: OnlineNotification requested by {0}", client.Name);

            PresenceInfo[] status = PresenceService.GetAgents(args.ToArray());

            List <UUID> online  = new List <UUID>();
            List <UUID> offline = new List <UUID>();

            foreach (PresenceInfo pi in status)
            {
                UUID uuid = new UUID(pi.UserID);
                if (!online.Contains(uuid))
                {
                    online.Add(uuid);
                }
            }
            foreach (string s in args)
            {
                UUID uuid = new UUID(s);
                if (!online.Contains(uuid) && !offline.Contains(uuid))
                {
                    offline.Add(uuid);
                }
            }

            if (online.Count > 0)
            {
                client.SendAgentOnline(online.ToArray());
            }
            if (offline.Count > 0)
            {
                client.SendAgentOffline(offline.ToArray());
            }
        }
コード例 #9
0
        public void SendFriendsStatusMessage(UUID FriendToInformID, UUID userID, bool online)
        {
            // Try local
            IClientAPI friendClient = LocateClientObject(FriendToInformID);

            if (friendClient != null)
            {
                //MainConsole.Instance.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
                // the  friend in this sim as root agent
                if (online)
                {
                    friendClient.SendAgentOnline(new[] { userID });
                }
                else
                {
                    friendClient.SendAgentOffline(new[] { userID });
                }
                // we're done
                return;
            }
        }
コード例 #10
0
        public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
        {
            IClientAPI friendClient = LocateClientObject(friendID);

            if (friendClient != null)
            {
                //m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
                // the  friend in this sim as root agent
                if (online)
                {
                    friendClient.SendAgentOnline(new UUID[] { userID });
                }
                else
                {
                    friendClient.SendAgentOffline(new UUID[] { userID });
                }
                // we're done
                return(true);
            }

            return(false);
        }