def sendUserListMovieRoom(self, movie_room): # send the Packet of usersList in a movie room to the user user_chat_room_dict = self.getUserChatRoomDict() update_user_list_packet = Packet(18, -1, 0, []) update_user_list_packet.data.append( len(user_chat_room_dict[movie_room])) update_user_list_packet.packet_format = "!LH" update_user_list_packet.packet_length = 2 for user_chat_room in user_chat_room_dict[movie_room]: update_user_list_packet.packet_format += "B" + str( len(user_chat_room)) + "s" update_user_list_packet.packet_length += 1 + len(user_chat_room) update_user_list_packet.data.append(len(user_chat_room)) update_user_list_packet.data.append(user_chat_room.encode("utf8")) print("user list movie", update_user_list_packet) self.sendPacket(update_user_list_packet)
def sendUserListMovieRoom(self, user, movie_room): #send the Packet of usersList in a movie room to the user user_chat_room_dict = self.getUserChatRoomDict() update_user_list_packet = Packet(18, self.num_seq[user.userName], 0, []) update_user_list_packet.data.append( len(user_chat_room_dict[movie_room])) update_user_list_packet.packet_format = "!LH" update_user_list_packet.packet_length = 2 for user_chat_room in user_chat_room_dict[movie_room]: update_user_list_packet.packet_format += "B" + str( len(user_chat_room)) + "s" update_user_list_packet.packet_length += 1 + len(user_chat_room) update_user_list_packet.data.append(len(user_chat_room)) update_user_list_packet.data.append(user_chat_room.encode("utf8")) self.sendPacket(update_user_list_packet, user.userAddress)