示例#1
0
        private void TransferMemeberToRoom(Socket socket_member, QChatRoom room)
        {
            QMember member = m_socketMembers[socket_member];

            member.Room = room;
            room.AddMember(socket_member);
        }
示例#2
0
        private void TransferMemberOutofRoom(Socket socket_member)
        {
            QMember   member = m_socketMembers[socket_member];
            QChatRoom room   = member.Room;

            room.RemoveMember(socket_member);
            member.Room = null;

            if (room.Members.Count == 0)
            {
                m_chatRooms[room.RoomId] = null;
            }
        }
示例#3
0
        private string Command_CREATEROOM()
        {
            CheckLogin();

            if (m_currentMember.Room != null)
            {
                return(string.Format("102 You have to leave this room first."));
            }

            int new_id = GetNewRoomID();

            if (new_id == -1)
            {
                throw new QNoMoreRoomExeption();
            }

            QChatRoom new_room = new QChatRoom(new_id);

            m_chatRooms[new_id] = new_room;
            TransferMemeberToRoom(m_currentSocket, new_room);

            return(string.Format("004 Room create successful. Room ID:{0}.", new_id));
        }
示例#4
0
 public QMember(string name, QChatRoom room)
 {
     this.m_name     = name;
     this.m_chatRoom = room;
 }