Ejemplo n.º 1
0
        /*
         * Returns false if password doesn't match or an error occurs
         */
        public override bool Logout(string nickname, string password)
        {
            if (!DBController.PasswordMatch(conn, nickname, password))
            {
                return(false);
            }

            IClient client = new LoggedClient(nickname, DBController.GetUserRealName(conn, nickname), null, 0);

            MyHandler?.Invoke(client);
            bool sessionEnded = DBController.EndSession(conn, nickname);

            return(sessionEnded);
        }
Ejemplo n.º 2
0
        /*
         * Returns false if password doesn't match or an error occurs
         */
        public override bool Login(string nickname, string password, string ip, int port)
        {
            if (!DBController.PasswordMatch(conn, nickname, password))
            {
                return(false);
            }

            bool sessionCreated = DBController.CreateUpdateSession(conn, nickname, ip, port);

            if (sessionCreated)
            {
                MyHandler?.Invoke(new LoggedClient(nickname, DBController.GetUserRealName(conn, nickname), ip, port));
            }
            return(sessionCreated);
        }