def closeRoomNotice(self, live_request_list): ''' 关闭(解散)房间通知 :return: ''' from business.logic.noticer.app_response import ConchSystemNoticer from business.logic.protocol import HornerPacketHandler evt_close_room = ConchSystemNoticer(HornerPacketHandler.COMMUNICATION_EVENT, HornerPacketHandler.EVT_CMD_SYSTEM, ConchSystemNoticer.SYSTEM_EVT_TYPE_CLOSE_CHATROOM) evt_close_room.setRoomId(self.room_id) evt_close_room.changeSuccess() self.broadcast(live_request_list, evt_close_room.toString()) # 清理房间资源 horner_gear_handler = HornerGear().getHandler() room_key_label = ChatSupport.getRoomKey(self.company_id, self.room_id) if horner_gear_handler.exists(room_key_label): horner_gear_handler.delete(room_key_label)
def _notice_room_created(self, recver, room_id, client_information): ''' 通知对话房间建立 :param recver: :param room_id: :param client_information: :return: ''' noticer_room_created = ConchSystemNoticer(HornerPacketHandler.COMMUNICATION_EVENT, HornerPacketHandler.EVT_CMD_SYSTEM, ConchSystemNoticer.SYSTEM_EVT_TYPE_CREATE_CHATROOM) noticer_room_created.setRoomID(room_id) noticer_room_created.setSessId(self.sess_id) account = str(random.randint(0000, 9999)) if MODE_DEBUG else '' name = random.choice(['刘德华', '郭德纲', '梁朝伟', '路人甲', '周星驰', '李商隐', '刘禹锡']) if MODE_DEBUG else '' noticer_room_created.setClientGeoInfor(client_information['remote_ip'], client_information['province'], client_information['city'], client_information['net'], account, name, self.sess_id) noticer_room_created.changeSuccess() noticer_room_created.sendNoticer(self.live_request_list, [recver])