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
def __onAppStarted(self, event): if BattleReplay.g_replayCtrl.autoStartBattleReplay() or connectionManager.isConnected(): return if not self.__startVideoShown: self.__startVideoShown = True if self.showStartGameVideo(): return self.showLogin()
def AppStarted(event): #debug('AppStarted') app = g_windowsManager.window if app is not None: if BattleReplay.g_replayCtrl.autoStartBattleReplay() or connectionManager.isConnected(): app.loadView(_alias) else: BigWorld.callback(0, lambda: app.loadView(_alias))
def __handleDisconnect(self, reason, description): if connectionManager.isConnected(): for user in self.usersStorage.getList(BWFriendFindCriteria(True)): prevOnline = user.isOnline() user.update(isInXMPP=False) if prevOnline is not user.isOnline(): LOG_DEBUG("Player's status has been changed by XMPP", user) g_messengerEvents.users.onUserRosterStatusUpdated(user)
def __onAppStarted(self, event): if BattleReplay.g_replayCtrl.autoStartBattleReplay( ) or connectionManager.isConnected(): return if not self.__startVideoShown: self.__startVideoShown = True if self.showStartGameVideo(): return self.showLogin()
def AppStarted(event): #debug('AppStarted') app = g_windowsManager.window if app is not None: if BattleReplay.g_replayCtrl.autoStartBattleReplay( ) or connectionManager.isConnected(): app.loadView(_alias) else: BigWorld.callback(0, lambda: app.loadView(_alias))
def _getNextState(self): state = None if connectionManager.isConnected(): if g_lobbyContext.getServerSettings().roaming.isInRoaming(): state = ClanRoamingState(self._clanCtrl) elif not g_lobbyContext.getServerSettings().clanProfile.isEnabled(): state = ClanDisabledState(self._clanCtrl) else: state = ClanUndefinedState(self._clanCtrl) return state
def AppStarted(event): #debug('AppStarted') import BigWorld import BattleReplay from ConnectionManager import connectionManager global app if BattleReplay.g_replayCtrl.autoStartBattleReplay() or connectionManager.isConnected(): app.loadView(_alias) else: BigWorld.callback(0.001, lambda: app.loadView(_alias))
def onAccountShowGUI(self, ctx = None): if ctx is None: ctx = {} cursorMgr = self.window.cursorMgr if cursorMgr is not None: cursorMgr.attachCursor(True) else: Cursor.setAutoShow(True) if connectionManager.isConnected(): self.window.fireEvent(LoadViewEvent(VIEW_ALIAS.LOBBY, ctx=ctx)) else: LOG_WARNING('onAccountShowGUI: show lobby has been skipped, because client is not connected to server.') return
def isConnected(): return connectionManager.isConnected()
def isInGameServer(self): return connectionManager.isConnected()
def onAppStarted(args): yield lambda callback: callback(None) if not connectionManager.isConnected(): return
def isConnected(self): return connectionManager.isConnected()
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()