public virtual void SetLoggedIn(string userID, bool loggingIn, bool fireLoggedInEvent, UUID enteringRegion)
        {
            object remoteValue = DoRemote(userID, loggingIn, fireLoggedInEvent, enteringRegion);

            if (remoteValue != null || m_doRemoteOnly)
            {
                return;
            }

            UserInfo userInfo = GetUserInfo(userID, false); //We are changing the status, so don't look

            if (userInfo == null)
            {
                Save(new UserInfo
                {
                    IsOnline        = loggingIn,
                    UserID          = userID,
                    CurrentLookAt   = Vector3.Zero,
                    CurrentPosition = Vector3.Zero,
                    CurrentRegionID = enteringRegion,
                    HomeLookAt      = Vector3.Zero,
                    HomePosition    = Vector3.Zero,
                    HomeRegionID    = UUID.Zero,
                    Info            = new OSDMap(),
                    LastLogin       = DateTime.Now.ToUniversalTime(),
                    LastLogout      = DateTime.Now.ToUniversalTime(),
                });
            }
            if (m_lockedUsers.Contains(userID))
            {
                return; //User is locked, leave them alone
            }

            Dictionary <string, object> agentUpdateValues = new Dictionary <string, object>();

            agentUpdateValues["IsOnline"] = loggingIn ? 1 : 0;
            if (loggingIn)
            {
                agentUpdateValues["LastLogin"] = Util.ToUnixTime(DateTime.Now.ToUniversalTime());
                if (enteringRegion != UUID.Zero)
                {
                    agentUpdateValues["CurrentRegionID"] = enteringRegion;
                }
            }
            else
            {
                agentUpdateValues["LastLogout"] = Util.ToUnixTime(DateTime.Now.ToUniversalTime());
            }
            agentUpdateValues["LastSeen"] = Util.ToUnixTime(DateTime.Now.ToUniversalTime());
            m_agentInfoConnector.Update(userID, agentUpdateValues);

            if (fireLoggedInEvent)
            {
                //Trigger an event so listeners know
                m_registry.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler(
                    "UserStatusChange", new object[] { userID, loggingIn, enteringRegion });
            }
        }
        public virtual void SetLoggedIn(string userID, bool loggingIn, UUID enteringRegion, string enteringRegionURI)
        {
            UserInfo userInfo = GetUserInfo(userID, false); //We are changing the status, so don't look

            if (userInfo == null)
            {
                Save(new UserInfo
                {
                    IsOnline         = loggingIn,
                    UserID           = userID,
                    CurrentLookAt    = Vector3.Zero,
                    CurrentPosition  = Vector3.Zero,
                    CurrentRegionID  = enteringRegion,
                    CurrentRegionURI = enteringRegionURI,
                    HomeLookAt       = Vector3.Zero,
                    HomePosition     = Vector3.Zero,
                    HomeRegionID     = UUID.Zero,
                    Info             = new OSDMap(),
                    LastLogin        = DateTime.Now.ToUniversalTime(),
                    LastLogout       = DateTime.Now.ToUniversalTime(),
                });
                return;
            }

            Dictionary <string, object> agentUpdateValues = new Dictionary <string, object>();

            agentUpdateValues["IsOnline"] = loggingIn ? 1 : 0;
            if (loggingIn)
            {
                agentUpdateValues["LastLogin"] = Util.ToUnixTime(DateTime.Now.ToUniversalTime());
                if (enteringRegion != UUID.Zero)
                {
                    agentUpdateValues["CurrentRegionID"]  = enteringRegion;
                    agentUpdateValues["CurrentRegionURI"] = enteringRegionURI;
                }
            }
            else
            {
                agentUpdateValues["LastLogout"] = Util.ToUnixTime(DateTime.Now.ToUniversalTime());
            }
            agentUpdateValues["LastSeen"] = Util.ToUnixTime(DateTime.Now.ToUniversalTime());
            m_agentInfoConnector.Update(userID, agentUpdateValues);
        }
Beispiel #3
0
        public virtual void SetLoggedIn(string userID, bool loggingIn, bool fireLoggedInEvent, UUID enteringRegion)
        {
            UserInfo userInfo = GetUserInfo(userID, false); //We are changing the status, so don't look

            if (userInfo == null)
            {
                Save(new UserInfo
                {
                    IsOnline        = loggingIn,
                    UserID          = userID,
                    CurrentLookAt   = Vector3.Zero,
                    CurrentPosition = Vector3.Zero,
                    CurrentRegionID = enteringRegion,
                    HomeLookAt      = Vector3.Zero,
                    HomePosition    = Vector3.Zero,
                    HomeRegionID    = UUID.Zero,
                    Info            = new OSDMap(),
                    LastLogin       = DateTime.Now.ToUniversalTime(),
                    LastLogout      = DateTime.Now.ToUniversalTime(),
                });
            }
            if (m_lockedUsers.Contains(userID))
            {
                return; //User is locked, leave them alone
            }
            if (loggingIn)
            {
                if (enteringRegion == UUID.Zero)
                {
                    m_agentInfoConnector.Update(userID, new[] { "IsOnline", "LastLogin", "LastSeen" },
                                                new object[]
                    {
                        loggingIn ? 1 : 0, Util.ToUnixTime(DateTime.Now.ToUniversalTime()),
                        Util.ToUnixTime(DateTime.Now.ToUniversalTime())
                    });
                }
                else
                {
                    m_agentInfoConnector.Update(userID,
                                                new[] { "IsOnline", "LastLogin", "CurrentRegionID", "LastSeen" },
                                                new object[]
                    {
                        loggingIn ? 1 : 0, Util.ToUnixTime(DateTime.Now.ToUniversalTime()),
                        enteringRegion, Util.ToUnixTime(DateTime.Now.ToUniversalTime())
                    });
                }
            }
            else
            {
                m_agentInfoConnector.Update(userID, new[] { "IsOnline", "LastLogout", "LastSeen" },
                                            new object[]
                {
                    loggingIn ? 1 : 0, Util.ToUnixTime(DateTime.Now.ToUniversalTime()),
                    Util.ToUnixTime(DateTime.Now.ToUniversalTime())
                });
            }

            if (fireLoggedInEvent)
            {
                //Trigger an event so listeners know
                m_registry.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler(
                    "UserStatusChange", new object[] { userID, loggingIn, enteringRegion });
            }
        }