Beispiel #1
0
        protected virtual void StatusNotify(List <FriendInfo> friendList, UUID userID, bool online)
        {
            //m_log.DebugFormat("[FRIENDS]: Entering StatusNotify for {0}", userID);

            List <string> friendStringIds       = friendList.ConvertAll <string>(friend => friend.Friend);
            List <string> remoteFriendStringIds = new List <string>();

            foreach (string friendStringId in friendStringIds)
            {
                UUID friendUuid;
                if (UUID.TryParse(friendStringId, out friendUuid))
                {
                    if (LocalStatusNotification(userID, friendUuid, online))
                    {
                        continue;
                    }

                    remoteFriendStringIds.Add(friendStringId);
                }
                else
                {
                    m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friendStringId);
                }
            }

            // We do this regrouping so that we can efficiently send a single request rather than one for each
            // friend in what may be a very large friends list.
            PresenceInfo[] friendSessions = PresenceService.GetAgents(remoteFriendStringIds.ToArray());
            if (friendSessions == null)
            {
                return;
            }

            foreach (PresenceInfo friendSession in friendSessions)
            {
                // let's guard against sessions-gone-bad
                if (friendSession != null && friendSession.RegionID != UUID.Zero)
                {
                    //m_log.DebugFormat("[FRIENDS]: Get region {0}", friendSession.RegionID);
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    if (region != null)
                    {
                        m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online);
                    }
                }
                //else
                //    m_log.DebugFormat("[FRIENDS]: friend session is null or the region is UUID.Zero");
            }
        }
Beispiel #2
0
        protected virtual void StatusNotify(List <FriendInfo> friendList, UUID userID, bool online)
        {
            foreach (FriendInfo friend in friendList)
            {
                UUID friendID;
                if (UUID.TryParse(friend.Friend, out friendID))
                {
                    // Try local
                    if (LocalStatusNotification(userID, friendID, online))
                    {
                        return;
                    }

                    // The friend is not here [as root]. Let's forward.
                    PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
                    if (friendSessions != null && friendSessions.Length > 0)
                    {
                        PresenceInfo friendSession = null;
                        foreach (PresenceInfo pinfo in friendSessions)
                        {
                            if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
                            {
                                friendSession = pinfo;
                                break;
                            }
                        }

                        if (friendSession != null)
                        {
                            GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                            //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
                            m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
                        }
                    }

                    // Friend is not online. Ignore.
                }
                else
                {
                    m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
                }
            }
        }
Beispiel #3
0
        protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
        {
            UUID userID;

            if (UUID.TryParse(user, out userID))
            {
                if (m_FriendsLocalSimConnector != null)
                {
                    m_log.DebugFormat("[USER AGENT SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline"));
                    m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online);
                }
                else
                {
                    GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID);
                    if (region != null)
                    {
                        m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
                        m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID.ToString(), online);
                    }
                }
            }
        }