Beispiel #1
0
        /// <summary>
        /// Marks the user as inactive
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public void LeaveRoom(string userID)
        {
            //deactivate user
            ChatUser user = this.GetUser(userID);

            if (user == null)
            {
                return;
            }
            user.IsActive = false;
            user.LastSeen = DateTime.Now;
            this.RoomUsers.Remove(userID);

            //Add leaving message
            Message msg = new Message(user.UserName, "", MsgType.Left);

            this.AddMsg(msg);

            if (IsEmpty())
            {
                ChatEngine.DeleteRoom(this.RoomID);
            }
        }
Beispiel #2
0
        //

        /// <summary>

        /// Marks the user as inactive

        /// </summary>

        /// <param name="userID"></param>

        /// <returns></returns>

        public string LeaveRoom(string userID)

        {
            //deactivate user

            ChatUser user = this.GetUser(userID);

            user.IsActive = false;

            user.LastSeen = DateTime.Now;


            //Add leaving message

            Message msg = new Message(user.UserName, "", MsgType.Left);

            this.AddMsg(msg);

            //Get all the messages to the user

            int lastMsgID;

            ArrayList previousMsgs = this.GetMessagesSince(user.LastMessageReceived, out lastMsgID);

            user.LastMessageReceived = lastMsgID;

            //return the messages to the user

            string str = GenerateMessagesString(previousMsgs);

            if (IsEmpty())
            {
                ChatEngine.DeleteRoom(this.RoomID);
            }

            return("");
        }