Example #1
0
 def _loadRoom(self):
     '''
     加载聊天室房间
     :param room_id:
     :return:
     '''
     horner_gear_handler = HornerGear().getHandler()
     if horner_gear_handler.exists(self.currentRoomKey()):
         self._loadSuccess = True
         self.ParticipantList = [ensureString(_talker) for _talker in horner_gear_handler.smembers(self.room_key)]
Example #2
0
 def createChatRoom(company_id, first_uuid, room_id=None):
     '''
     创建一个聊天室
     :param company_id string 公司编号
     :param first_uuid string 第一个进入聊天室的会话编号
     :return: string room_id
     '''
     room_id = str(uuid1()) if room_id is None else room_id
     horner_gear_handler = HornerGear().getHandler()
     room_key_label = ChatSupport.getRoomKey(company_id, room_id)
     if not horner_gear_handler.exists(room_key_label):
         if 1 == horner_gear_handler.sadd(room_key_label, first_uuid):
             return room_id
     return None
Example #3
0
 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)