private void TransferMemeberToRoom(Socket socket_member, QChatRoom room) { QMember member = m_socketMembers[socket_member]; member.Room = room; room.AddMember(socket_member); }
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; } }
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)); }
public QMember(string name, QChatRoom room) { this.m_name = name; this.m_chatRoom = room; }