예제 #1
0
    def __handleConnectionStatus(self, stage, status, serverMsg, isAutoRegister):
        if self.__onLoggingTryingEndHdlr:
            self.__onLoggingTryingEndHdlr()
        STATUS_LOGGED_ON = "LOGGED_ON"
        LOG_DEBUG("__handleConnectionStatus %s %s %s" % (stage, status, isAutoRegister))
        if stage == 1:
            if status == STATUS_LOGGED_ON:
                handlerFunc = self.__logOnSuccess[status]
            elif isAutoRegister:
                handlerFunc = self.__logAutoRegisterHandlers.get(status, self.__logOnFailedDefaultHandler)
                if status == "DNS_LOOKUP_FAILED":
                    self.onLoginAppFailed(status, serverMsg)
            else:
                handlerFunc = self.__logOnFailedHandlers.get(status, self.__logOnFailedDefaultHandler)
                if status != "LOGIN_REJECTED_LOGIN_QUEUE":
                    self.__clearAutoLoginTimer()
                if status != "LOGIN_REJECTED_RATE_LIMITED":
                    self.__resetLgTimeout()
                self.onCancelQueue(False, False)
                if status not in ("LOGIN_REJECTED_INVALID_PASSWORD",):
                    g_preDefinedHosts.clearPeripheryTL()
            try:
                getattr(self, handlerFunc)(status, serverMsg)
            except:
                LOG_ERROR("Handle logon status error: status = %r, message = %r" % (status, serverMsg))
                LOG_CURRENT_EXCEPTION()
                Waiting.hide("login")

            if connectionManager.isUpdateClientSoftwareNeeded():
                self.onHandleUpdateClientSoftwareNeeded()
                if connectionManager.isConnected():
                    connectionManager.disconnect()
            elif status != STATUS_LOGGED_ON:
                connectionManager.disconnect()
        elif stage == 6:
            if not self.__kickedFromServer:
                self.onCancelQueue(False, False)
            msg = MENU.LOGIN_STATUS_DISCONNECTED
            if self.__kickPeripheryID is not None:
                if self.__kickPeripheryID == -1:
                    msg = MENU.LOGIN_STATUS_ACCOUNTNOTREADY
                elif self.__kickPeripheryID == -2:
                    msg = "#menu:login/status/centerRestart"
                elif self.__kickPeripheryID == -3:
                    msg = "#menu:login/status/versionMismatch"
            elif connectionManager.isVersionsDiffered:
                msg = ""
                self.onHandleUpdateClientSoftwareNeeded()
            localizedMessage = i18n.convert(i18n.makeString(msg))
            lastLoginType = Settings.g_instance.userPrefs[Settings.KEY_LOGIN_INFO].readString("lastLoginType", "basic")
            if lastLoginType != "basic" and not Settings.g_instance.userPrefs[Settings.KEY_LOGIN_INFO].readBool(
                "rememberPwd", False
            ):
                from gui.social_network_login import Bridge as socialNetworkLogin

                localizedMessage = socialNetworkLogin.getLogoutWarning(lastLoginType)
            self.onSetStatus(localizedMessage, self.ALL_VALID)
            connectionManager.disconnect()
        return
예제 #2
0
    def __handleConnectionStatus(self, stage, status, serverMsg, isAutoRegister):
        if self.__onLoggingTryingEndHdlr:
            self.__onLoggingTryingEndHdlr()
        STATUS_LOGGED_ON = 'LOGGED_ON'
        LOG_DEBUG('__handleConnectionStatus %s %s %s' % (stage, status, isAutoRegister))
        if stage == 1:
            if status == STATUS_LOGGED_ON:
                handlerFunc = self.__logOnSuccess[status]
            elif isAutoRegister:
                handlerFunc = self.__logAutoRegisterHandlers.get(status, self.__logOnFailedDefaultHandler)
                if status == 'DNS_LOOKUP_FAILED':
                    self.onLoginAppFailed(status, serverMsg)
            else:
                handlerFunc = self.__logOnFailedHandlers.get(status, self.__logOnFailedDefaultHandler)
                if status != 'LOGIN_REJECTED_LOGIN_QUEUE':
                    self.__clearAutoLoginTimer()
                if status != 'LOGIN_REJECTED_RATE_LIMITED':
                    self.__resetLgTimeout()
                self.onCancelQueue(False, False)
                if status not in ('LOGIN_REJECTED_INVALID_PASSWORD',):
                    g_preDefinedHosts.clearPeripheryTL()
            try:
                getattr(self, handlerFunc)(status, serverMsg)
            except:
                LOG_ERROR('Handle logon status error: status = %r, message = %r' % (status, serverMsg))
                LOG_CURRENT_EXCEPTION()
                Waiting.hide('login')

            if connectionManager.isUpdateClientSoftwareNeeded():
                self.onHandleUpdateClientSoftwareNeeded()
            elif status != STATUS_LOGGED_ON:
                connectionManager.disconnect()
        elif stage == 6:
            if not self.__kickedFromServer:
                self.onCancelQueue(False, False)
            msg = MENU.LOGIN_STATUS_DISCONNECTED
            if self.__kickPeripheryID is not None:
                if self.__kickPeripheryID == -1:
                    msg = MENU.LOGIN_STATUS_ACCOUNTNOTREADY
                elif self.__kickPeripheryID == -2:
                    msg = '#menu:login/status/centerRestart'
                elif self.__kickPeripheryID == -3:
                    msg = '#menu:login/status/versionMismatch'
            elif connectionManager.isVersionsDiffered:
                msg = ''
                self.onHandleUpdateClientSoftwareNeeded()
            self.onSetStatus(i18n.convert(i18n.makeString(msg)), self.ALL_VALID)
            connectionManager.disconnect()
예제 #3
0
    def __handleConnectionStatus(self, stage, status, serverMsg,
                                 isAutoRegister):
        if self.__onLoggingTryingEndHdlr:
            self.__onLoggingTryingEndHdlr()
        STATUS_LOGGED_ON = 'LOGGED_ON'
        LOG_DEBUG('__handleConnectionStatus %s %s %s' %
                  (stage, status, isAutoRegister))
        if stage == 1:
            if status == STATUS_LOGGED_ON:
                handlerFunc = self.__logOnSuccess[status]
            elif isAutoRegister:
                handlerFunc = self.__logAutoRegisterHandlers.get(
                    status, self.__logOnFailedDefaultHandler)
                if status == 'DNS_LOOKUP_FAILED':
                    self.onLoginAppFailed(status, serverMsg)
            else:
                handlerFunc = self.__logOnFailedHandlers.get(
                    status, self.__logOnFailedDefaultHandler)
                if status != 'LOGIN_REJECTED_LOGIN_QUEUE':
                    self.__clearAutoLoginTimer()
                if status != 'LOGIN_REJECTED_RATE_LIMITED':
                    self.__resetLgTimeout()
                self.onCancelQueue(False, False)
                g_preDefinedHosts.clearPeripheryTL()
            try:
                getattr(self, handlerFunc)(status, serverMsg)
            except:
                LOG_ERROR(
                    'Handle logon status error: status = %r, message = %r' %
                    (status, serverMsg))
                LOG_CURRENT_EXCEPTION()
                Waiting.hide('login')

            if connectionManager.isUpdateClientSoftwareNeeded():
                self.onHandleUpdateClientSoftwareNeeded()
            elif status != STATUS_LOGGED_ON:
                connectionManager.disconnect()
        elif stage == 6:
            if not self.__kickedFromServer:
                self.onCancelQueue(False, False)
            msg = MENU.LOGIN_STATUS_DISCONNECTED
            if self.__accNotReady:
                msg = MENU.LOGIN_STATUS_ACCOUNTNOTREADY
                self.__accNotReady = False
            self.onSetStatus(i18n.convert(i18n.makeString(msg)),
                             self.ALL_VALID)
            connectionManager.disconnect()
예제 #4
0
    def __handleConnectionStatus(self, stage, status, serverMsg, isAutoRegister):
        if self.__onLoggingTryingEndHdlr:
            self.__onLoggingTryingEndHdlr()
        STATUS_LOGGED_ON = "LOGGED_ON"
        LOG_DEBUG("__handleConnectionStatus %s %s %s" % (stage, status, isAutoRegister))
        if stage == 1:
            if status == STATUS_LOGGED_ON:
                handlerFunc = self.__logOnSuccess[status]
            elif isAutoRegister:
                handlerFunc = self.__logAutoRegisterHandlers.get(status, self.__logOnFailedDefaultHandler)
                if status == "DNS_LOOKUP_FAILED":
                    self.onLoginAppFailed(status, serverMsg)
            else:
                handlerFunc = self.__logOnFailedHandlers.get(status, self.__logOnFailedDefaultHandler)
                if status != "LOGIN_REJECTED_LOGIN_QUEUE":
                    self.__clearAutoLoginTimer()
                if status != "LOGIN_REJECTED_RATE_LIMITED":
                    self.__resetLgTimeout()
                self.onCancelQueue(False, False)
                g_preDefinedHosts.clearPeripheryTL()
            try:
                getattr(self, handlerFunc)(status, serverMsg)
            except:
                LOG_ERROR("Handle logon status error: status = %r, message = %r" % (status, serverMsg))
                LOG_CURRENT_EXCEPTION()
                Waiting.hide("login")

            if connectionManager.isUpdateClientSoftwareNeeded():
                self.onHandleUpdateClientSoftwareNeeded()
            elif status != STATUS_LOGGED_ON:
                connectionManager.disconnect()
        elif stage == 6:
            if not self.__kickedFromServer:
                self.onCancelQueue(False, False)
            msg = MENU.LOGIN_STATUS_DISCONNECTED
            if self.__accNotReady:
                msg = MENU.LOGIN_STATUS_ACCOUNTNOTREADY
                self.__accNotReady = False
            self.onSetStatus(i18n.convert(i18n.makeString(msg)), self.ALL_VALID)
            connectionManager.disconnect()
예제 #5
0
    def __handleConnectionStatus(self, stage, status, serverMsg,
                                 isAutoRegister):
        if self.__onLoggingTryingEndHdlr:
            self.__onLoggingTryingEndHdlr()
        STATUS_LOGGED_ON = 'LOGGED_ON'
        LOG_DEBUG('__handleConnectionStatus %s %s %s' %
                  (stage, status, isAutoRegister))
        if stage == 1:
            if status == STATUS_LOGGED_ON:
                handlerFunc = self.__logOnSuccess[status]
            elif isAutoRegister:
                handlerFunc = self.__logAutoRegisterHandlers.get(
                    status, self.__logOnFailedDefaultHandler)
                if status == 'DNS_LOOKUP_FAILED':
                    self.onLoginAppFailed(status, serverMsg)
            else:
                handlerFunc = self.__logOnFailedHandlers.get(
                    status, self.__logOnFailedDefaultHandler)
                if status != 'LOGIN_REJECTED_LOGIN_QUEUE':
                    self.__clearAutoLoginTimer()
                if status != 'LOGIN_REJECTED_RATE_LIMITED':
                    self.__resetLgTimeout()
                self.onCancelQueue(False, False)
                if status not in ('LOGIN_REJECTED_INVALID_PASSWORD', ):
                    g_preDefinedHosts.clearPeripheryTL()
            try:
                getattr(self, handlerFunc)(status, serverMsg)
            except:
                LOG_ERROR(
                    'Handle logon status error: status = %r, message = %r' %
                    (status, serverMsg))
                LOG_CURRENT_EXCEPTION()
                Waiting.hide('login')

            if connectionManager.isUpdateClientSoftwareNeeded():
                self.onHandleUpdateClientSoftwareNeeded()
                if connectionManager.isConnected():
                    connectionManager.disconnect()
            elif status != STATUS_LOGGED_ON:
                connectionManager.disconnect()
        elif stage == 6:
            if not self.__kickedFromServer:
                self.onCancelQueue(False, False)
            msg = MENU.LOGIN_STATUS_DISCONNECTED
            if self.__kickPeripheryID is not None:
                if self.__kickPeripheryID == -1:
                    msg = MENU.LOGIN_STATUS_ACCOUNTNOTREADY
                elif self.__kickPeripheryID == -2:
                    msg = '#menu:login/status/centerRestart'
                elif self.__kickPeripheryID == -3:
                    msg = '#menu:login/status/versionMismatch'
            elif connectionManager.isVersionsDiffered:
                msg = ''
                self.onHandleUpdateClientSoftwareNeeded()
            localizedMessage = i18n.convert(i18n.makeString(msg))
            lastLoginType = Settings.g_instance.userPrefs[
                Settings.KEY_LOGIN_INFO].readString('lastLoginType', 'basic')
            if lastLoginType != 'basic' and not Settings.g_instance.userPrefs[
                    Settings.KEY_LOGIN_INFO].readBool('rememberPwd', False):
                from gui.social_network_login import Bridge as socialNetworkLogin
                localizedMessage = socialNetworkLogin.getLogoutWarning(
                    lastLoginType)
            self.onSetStatus(localizedMessage, self.ALL_VALID)
            connectionManager.disconnect()