コード例 #1
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendAcceptChallenge(self, name):
     isFbaPresent = self.checkInstallation()
     isRomPresent = self.checkRom()
     if not isRomPresent or not isFbaPresent:
         return
     if name in self.challengers:
         self.sendAndRemember(Protocol.ACCEPT_CHALLENGE, Protocol.packTLV(name) + Protocol.packTLV(self.rom))
         self.challengers.remove(name)
コード例 #2
0
 def sendAcceptChallenge(self, name):
     isFbaPresent = self.checkInstallation()
     isRomPresent = self.checkRom()
     if not isRomPresent or not isFbaPresent:
         return
     if name in self.challengers:
         self.sendAndRemember(Protocol.ACCEPT_CHALLENGE, Protocol.packTLV(name) + Protocol.packTLV(self.rom))
         self.challengers.remove(name)
コード例 #3
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendAuth(self, username, password):
     self.username = username
     try:
         port = self.udpSock.getsockname()[1]
     except:
         port=6009
     authdata = Protocol.packTLV(username) + Protocol.packTLV(password) + Protocol.packInt(port) + Protocol.packInt(copyright.versionNum())
     self.sendAndRemember(Protocol.AUTH, authdata)
コード例 #4
0
 def sendAuth(self, username, password):
     self.username = username
     try:
         port = self.udpSock.getsockname()[1]
     except:
         port = 6009
     authdata = Protocol.packTLV(username) + Protocol.packTLV(
         password) + Protocol.packInt(port) + Protocol.packInt(
             copyright.versionNum())
     self.sendAndRemember(Protocol.AUTH, authdata)
コード例 #5
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendChallenge(self, name):
     self.sendCancelChallenge()
     isFbaPresent = self.checkInstallation()
     isRomPresent = self.checkRom()
     if not isRomPresent or not isFbaPresent:
         return
     if (name==self.username):
         self.runFBA(self.channel)
     else:
         self.sendAndRemember(Protocol.SEND_CHALLENGE, Protocol.packTLV(name) + Protocol.packTLV(self.rom))
         self.challenged = name
コード例 #6
0
 def sendChallenge(self, name):
     self.sendCancelChallenge()
     isFbaPresent = self.checkInstallation()
     isRomPresent = self.checkRom()
     if not isRomPresent or not isFbaPresent:
         return
     if (name==self.username):
         self.runFBA(self.channel)
     else:
         self.sigStatusMessage.emit("Challenging "+name)
         self.sendAndRemember(Protocol.SEND_CHALLENGE, Protocol.packTLV(name) + Protocol.packTLV(self.rom))
         self.challenged = name
コード例 #7
0
 def sendCancelChallenge(self, name=None):
     if (name is None and self.challenged) or (name
                                               and name == self.challenged):
         self.sigStatusMessage.emit("Cancelling challenge")
         self.sendAndRemember(Protocol.CANCEL_CHALLENGE,
                              Protocol.packTLV(self.challenged))
         self.challenged = None
コード例 #8
0
    def sendAuth(self, username, password):
        self.username = username
        try:
            port = self.udpSock.getsockname()[1]
        except:
            port=6009
            #raise

        # piggyback the OS and timezone onto the login request since there doesn't seem to be another convenient place to send it.
        authdata = Protocol.packTLV(username) + Protocol.packTLV(password) + Protocol.packInt(port) + \
                   Protocol.packInt(copyright.versionNum()) + \
                   Protocol.packInt(self.os) + \
                   Protocol.packTLV(str(self.utcoffset))  # There's a string conversion error here if packInt returns any
                   #Protocol.packInt(self.utcoffset)      # non-ascii bytes.  Send utcoffset as a string for now.

        self.sendAndRemember(Protocol.AUTH, authdata)
コード例 #9
0
    def sendJoinChannelRequest(self, channel=None):
        if channel:
            self.channel = channel
            Settings.setValue(Settings.SELECTED_CHANNEL, channel)
            if channel in self.channels:
                if channel != 'lobby':
                    self.rom = self.channels[channel]['rom']
                else:
                    self.rom = ''
            else:
                logdebug().error("Invalid channel {}".format(channel))

        if (int(self.channelport) != int(self.channels[channel]['port'])):
            self.switchingServer = True
            self.channelport = int(self.channels[channel]['port'])
            Settings.setValue(Settings.PORT, self.channelport)
            self.tcpSock.close()
            self.sequence = 0x1
            self.connectTcp()
            self.sendWelcome()
            self.sendAuth(self.username, self.password)
            if Settings.value(Settings.AWAY):
                self.sendToggleAFK(1)
        self.sendAndRemember(Protocol.JOIN_CHANNEL,
                             Protocol.packTLV(self.channel))
コード例 #10
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendJoinChannelRequest(self, channel=None):
     if channel:
         self.channel = channel
         Settings.setValue(Settings.SELECTED_CHANNEL, channel)
         if channel in self.channels:
             if channel != 'lobby':
                 self.rom = self.channels[channel]['rom']
         else:
             logdebug().error("Invalid channel {}".format(channel))
     self.sendAndRemember(Protocol.JOIN_CHANNEL, Protocol.packTLV(self.channel))
コード例 #11
0
 def sendJoinChannelRequest(self, channel=None):
     if channel:
         self.channel = channel
         Settings.setValue(Settings.SELECTED_CHANNEL, channel)
         if channel in self.channels:
             if channel != 'lobby':
                 self.rom = self.channels[channel]['rom']
         else:
             logdebug().error("Invalid channel {}".format(channel))
     self.sendAndRemember(Protocol.JOIN_CHANNEL,
                          Protocol.packTLV(self.channel))
コード例 #12
0
    def sendMessage(self, extID, prefix, params=None):
        """ Encode a message and send it to the server

        Args:
            extID: positive integer.  0 for internal messages, 1 for referee messages, otherwise is an extension ID
            prefix: extension-defined positive integer
            params: json-serializable python object
        """
        data = Protocol.packInt(extID) + Protocol.packInt(prefix) + json.dumps(
            params)
        self.controller.sendAndRemember(Protocol.EXTENSION_OUTBOUND,
                                        Protocol.packTLV(data))

        # DEBUG
        dispext = "Extension" if extID == 0 else _ExtensionDict[extID].__name__
        dispprefix = self._codeToString.get((extID, prefix), prefix)
        self.controller.sigStatusMessage.emit(
            "Ext Snd: ext=%s, prefix=%s, params=%s" %
            (dispext, dispprefix, params))
コード例 #13
0
ファイル: controller.py プロジェクト: TrueFocus/pyqtggpo
    def sendJoinChannelRequest(self, channel=None):
        if channel:
            self.channel = channel
            Settings.setValue(Settings.SELECTED_CHANNEL, channel)
            if channel in self.channels:
                if channel != 'lobby':
                    self.rom = self.channels[channel]['rom']
                else:
                    self.rom = ''
            else:
                logdebug().error("Invalid channel {}".format(channel))

        if (int(self.channelport)!=int(self.channels[channel]['port'])):
            self.switchingServer=True
            self.channelport = int(self.channels[channel]['port'])
            Settings.setValue(Settings.PORT, self.channelport)
            self.tcpSock.close()
            self.sequence = 0x1
            self.connectTcp()
            self.sendWelcome()
            self.sendAuth(self.username, self.password)
            if Settings.value(Settings.AWAY):
                self.sendToggleAFK(1)
        self.sendAndRemember(Protocol.JOIN_CHANNEL, Protocol.packTLV(self.channel))
コード例 #14
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendDeclineChallenge(self, name):
     self.sendAndRemember(Protocol.DECLINE_CHALLENGE, Protocol.packTLV(name))
     if name in self.challengers:
         self.challengers.remove(name)
コード例 #15
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendChat(self, line):
     if self.channel == 'unsupported' and self.unsupportedRom:
         line = '[' + self.unsupportedRom + '] ' + line
     line = line.encode('utf-8')
     self.sendAndRemember(Protocol.CHAT, Protocol.packTLV(line))
コード例 #16
0
 def sendAcceptChallenge(self, name):
     if name in self.challengers:
         self.sendAndRemember(
             Protocol.ACCEPT_CHALLENGE,
             Protocol.packTLV(name) + Protocol.packTLV(self.rom))
         self.challengers.remove(name)
コード例 #17
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendCancelChallenge(self, name=None):
     if (name is None and self.challenged) or (name and name == self.challenged):
         self.sendAndRemember(Protocol.CANCEL_CHALLENGE, Protocol.packTLV(self.challenged))
         self.challenged = None
コード例 #18
0
 def sendChat(self, line):
     if self.channel == 'unsupported' and self.unsupportedRom:
         line = '[' + self.unsupportedRom + '] ' + line
     line = line.encode('utf-8')
     self.sendAndRemember(Protocol.CHAT, Protocol.packTLV(line))
コード例 #19
0
 def sendAuth(self, username, password):
     self.username = username
     authdata = Protocol.packTLV(username) + Protocol.packTLV(
         password) + "\x00\x00\x17\x79"
     self.sendAndRemember(Protocol.AUTH, authdata)
コード例 #20
0
ファイル: controller.py プロジェクト: marcelosjrp/pyqtggpo
 def sendAuth(self, username, password):
     self.username = username
     authdata = Protocol.packTLV(username) + Protocol.packTLV(password) + "\x00\x00\x17\x79"
     self.sendAndRemember(Protocol.AUTH, authdata)
コード例 #21
0
ファイル: controller.py プロジェクト: marcelosjrp/pyqtggpo
 def sendChallenge(self, name):
     self.sendCancelChallenge()
     self.sendAndRemember(Protocol.SEND_CHALLENGE, Protocol.packTLV(name) + Protocol.packTLV(self.rom))
     self.challenged = name
コード例 #22
0
 def sendChallenge(self, name):
     self.sendCancelChallenge()
     self.sendAndRemember(
         Protocol.SEND_CHALLENGE,
         Protocol.packTLV(name) + Protocol.packTLV(self.rom))
     self.challenged = name
コード例 #23
0
ファイル: controller.py プロジェクト: marcelosjrp/pyqtggpo
 def sendAcceptChallenge(self, name):
     if name in self.challengers:
         self.sendAndRemember(Protocol.ACCEPT_CHALLENGE, Protocol.packTLV(name) + Protocol.packTLV(self.rom))
         self.challengers.remove(name)
コード例 #24
0
 def sendSpectateRequest(self, name):
     isFbaPresent = self.checkInstallation()
     isRomPresent = self.checkRom()
     if not isRomPresent or not isFbaPresent:
         return
     self.sendAndRemember(Protocol.SPECTATE, Protocol.packTLV(name))
コード例 #25
0
 def sendSpectateRequest(self, name):
     self.sendAndRemember(Protocol.SPECTATE, Protocol.packTLV(name))
コード例 #26
0
 def sendDeclineChallenge(self, name):
     self.sendAndRemember(Protocol.DECLINE_CHALLENGE,
                          Protocol.packTLV(name))
     if name in self.challengers:
         self.challengers.remove(name)
コード例 #27
0
ファイル: controller.py プロジェクト: TrueFocus/pyqtggpo
 def sendCancelChallenge(self, name=None):
     if (name is None and self.challenged) or (name and name == self.challenged):
         self.sigStatusMessage.emit("Cancelling challenge")
         self.sendAndRemember(Protocol.CANCEL_CHALLENGE, Protocol.packTLV(self.challenged))
         self.challenged = None
コード例 #28
0
ファイル: controller.py プロジェクト: marcelosjrp/pyqtggpo
 def sendSpectateRequest(self, name):
     self.sendAndRemember(Protocol.SPECTATE, Protocol.packTLV(name))
コード例 #29
0
ファイル: controller.py プロジェクト: pond3r/pyqtggpo
 def sendSpectateRequest(self, name):
     isFbaPresent = self.checkInstallation()
     isRomPresent = self.checkRom()
     if not isRomPresent or not isFbaPresent:
         return
     self.sendAndRemember(Protocol.SPECTATE, Protocol.packTLV(name))
コード例 #30
0
 def sendCancelChallenge(self, name=None):
     if (name is None and self.challenged) or (name
                                               and name == self.challenged):
         self.sendAndRemember(Protocol.CANCEL_CHALLENGE,
                              Protocol.packTLV(self.challenged))
         self.challenged = None