Exemplo n.º 1
0
    def __connecting_httpcookieinitcnf(self, container):
        self.log.trace()

        getplayerstatusUrl = ApiInfo.createGetplayerstatusUrl(
            self.__live["liveId"])
        result = self.send_message(UnitId.HTTPCTRL,
                                   EventId.HTTPGETPLAYERSTATUSREQ,
                                   getplayerstatusUrl)

        self.state = self.__StateId.CONNECTING
        return True
Exemplo n.º 2
0
    def __chatsending_chatresultnotify(self, container):
        self.log.trace()

        status = int(container.message.attrs["status"])
        if status == 0:
            self.__cleanupSendDataStore()

            result = self.send_message(UnitId.UNITCTRL, EventId.SENDCNF, None)

            data = self.__restoreSendDataStore()
            if data != None:
                chatTag = self.__create_chat_tag(data)

                result = self.send_message(
                    UnitId.SOCKETCTRL, EventId.SOCKETSENDREQ,
                    SocketSendReq(destination=self.__main_socket,
                                  data=chatTag))

                self.state = self.__StateId.CHATSENDING
                return True

            else:
                self.state = self.__StateId.IDLE
                return True

        elif status == 1:
            self.log.warning("chat_result fail[failure] (%s)",
                             container.message)

            self.__cleanupSendDataStore()

            self.state = self.__StateId.IDLE
            return True

        elif status == 2:
            self.log.warning("chat_result fail[thread id error] (%s)",
                             container.message)

            url = ApiInfo.createGetplayerstatusUrl(self.__live["liveId"])
            result = self.send_message(UnitId.HTTPCTRL,
                                       EventId.HTTPGETPLAYERSTATUSREQ, url)

            # TODO 再送処理は未実装
            # 状態をIDLEに戻す
            self.__cleanupSendDataStore()
            self.state = self.__StateId.IDLE
            return True

        elif status == 3:
            self.log.warning("chat_result fail[ticket error] (%s)",
                             container.message)

            threadTag = ApiInfo.createThreadTag(
                self.__live["playerstatus"]["thread"])
            result = self.send_message(
                UnitId.SOCKETCTRL, EventId.SOCKETSENDREQ,
                SocketSendReq(destination=self.__main_socket, data=threadTag))

            # TODO 再送処理は未実装
            # 状態をIDLEに戻す
            self.__cleanupSendDataStore()
            self.state = self.__StateId.IDLE
            return True

        elif status == 4:
            self.log.warning("chat_result fail[postkey error] (%s)",
                             container.message.attrs)

            self.__live["block_no"] = ApiInfo.calculateBlockNo(
                no=container.message.attrs["no"])
            url = ApiInfo.createGetpostkeyUrl(
                thread=self.__live["playerstatus"]["thread"],
                block_no=self.__live["block_no"])
            result = self.send_message(UnitId.HTTPCTRL,
                                       EventId.HTTPGETPOSTKEYREQ, url)

            self.state = self.__StateId.CHATSENDING
            return True

        elif status == 5:
            self.log.warning("chat_result fail[lock comment] (%s)",
                             container.message)

            self.__cleanupSendDataStore()

            self.state = self.__StateId.IDLE
            return True

        elif status == 8:
            self.log.warning("chat_result fail[long comment] (%s)",
                             container.message)

            self.__cleanupSendDataStore()

            self.state = self.__StateId.IDLE
            return True

        else:
            self.log.warning("chat_result fail[unknown error] (%s)",
                             container.message)

            self.__cleanupSendDataStore()

            self.state = self.__StateId.IDLE
            return True