diff --git a/astron/config/astrond.yml b/astron/config/astrond.yml index 59cc14f..822a092 100644 --- a/astron/config/astrond.yml +++ b/astron/config/astrond.yml @@ -35,6 +35,10 @@ uberdogs: id: 4695 anonymous: false + - class: AstronLoginManager + id: 4670 + anonymous: true + roles: - type: clientagent bind: 0.0.0.0:7198 diff --git a/etc/otp.dc b/etc/otp.dc index fb29384..7d1139f 100755 --- a/etc/otp.dc +++ b/etc/otp.dc @@ -27,6 +27,7 @@ from otp.distributed import CentralLogger/AI/UD from otp.web import SettingsMgr/AI/UD from otp.status import StatusDatabase/UD from otp.avatar import AvatarHandle +from otp.login import AstronLoginManager/UD typedef uint8 bool; @@ -509,3 +510,8 @@ dclass StatusDatabase : DistributedObject { dclass CallbackObject { callback(uint32, bool, uint8); }; + +dclass AstronLoginManager : DistributedObject { + requestLogin(string) clsend; + loginResponse(blob); +}; diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index f51553e..9c272f5 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -424,6 +424,8 @@ class OTPClientRepository(ClientRepositoryBase): self.wantSwitchboard = config.GetBool('want-switchboard', 0) self.wantSwitchboardHacks = base.config.GetBool('want-switchboard-hacks', 0) self.centralLogger = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_CENTRAL_LOGGER, 'CentralLogger') + if self.astronSupport: + self.astronLoginManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_ASTRON_LOGIN_MANAGER, 'AstronLoginManager') def startLeakDetector(self): if hasattr(self, 'leakDetector'): diff --git a/otp/distributed/OtpDoGlobals.py b/otp/distributed/OtpDoGlobals.py index f8dbac3..c456edf 100644 --- a/otp/distributed/OtpDoGlobals.py +++ b/otp/distributed/OtpDoGlobals.py @@ -20,6 +20,7 @@ OTP_DO_ID_AVATARS = 4630 OTP_DO_ID_FRIENDS = 4640 OTP_DO_ID_GUILDS = 4650 OTP_DO_ID_ESCROW = 4660 +OTP_DO_ID_ASTRON_LOGIN_MANAGER = 4670 OTP_DO_ID_PIRATES_AVATAR_MANAGER = 4674 OTP_DO_ID_PIRATES_CREW_MANAGER = 4675 OTP_DO_ID_PIRATES_INVENTORY_MANAGER = 4677 diff --git a/otp/login/AstronLoginManager.py b/otp/login/AstronLoginManager.py new file mode 100644 index 0000000..5eac322 --- /dev/null +++ b/otp/login/AstronLoginManager.py @@ -0,0 +1,17 @@ +from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal +from direct.directnotify import DirectNotifyGlobal + +class AstronLoginManager(DistributedObjectGlobal): + notify = DirectNotifyGlobal.directNotify.newCategory('AstronLoginManager') + + def __init__(self, cr): + DistributedObjectGlobal.__init__(self, cr) + self.doneEvent = None + + def handleRequestLogin(self, doneEvent): + self.doneEvent = doneEvent + playToken = self.cr.playToken or 'dev' + self.sendRequestLogin(playToken) + + def sendRequestLogin(self, playToken): + self.sendUpdate('requestLogin', [playToken]) diff --git a/otp/login/AstronLoginManagerUD.py b/otp/login/AstronLoginManagerUD.py new file mode 100644 index 0000000..e69de29 diff --git a/otp/login/AstronLoginScreen.py b/otp/login/AstronLoginScreen.py index 135315a..f663f43 100644 --- a/otp/login/AstronLoginScreen.py +++ b/otp/login/AstronLoginScreen.py @@ -3,9 +3,11 @@ from otp.login.LoginScreen import LoginScreen from direct.distributed.MsgTypes import * class AstronLoginScreen(LoginScreen): + def handleWaitForLoginResponse(self, msgType, di): if msgType == CLIENT_HELLO_RESP: # Now we can start the heartbeat: self.cr.startHeartbeat() + self.cr.astronLoginManager.handleRequestLogin(self.doneEvent) else: self.cr.handleMessageType(msgType, di)