From: <Blu...@us...> - 2010-04-19 19:44:47
|
Revision: 335 http://virtplayground.svn.sourceforge.net/virtplayground/?rev=335&view=rev Author: BlueWolf_ Date: 2010-04-19 19:44:41 +0000 (Mon, 19 Apr 2010) Log Message: ----------- Some small modifications. sh['login_after_connection'] => sh['auto_login']. Will remember auto_login regardless of login being called before or after receiving the rsa-key Modified Paths: -------------- trunk/client/core/client.py trunk/client/core/parser.py Modified: trunk/client/core/client.py =================================================================== --- trunk/client/core/client.py 2010-01-08 23:44:25 UTC (rev 334) +++ trunk/client/core/client.py 2010-04-19 19:44:41 UTC (rev 335) @@ -79,7 +79,7 @@ self.__do_connect.clear() # Auto log in after connecting. - self.__sh['login_after_connecting'] = () + self.__sh['auto_login'] = () # RSA self.__sh['rsakey'] = None @@ -190,12 +190,12 @@ if self.cid != None: raise LoginError("You are already logged in") - if not self.__sh['rsakey']: - # Save this - self.__sh['login_after_connecting'] = (self.login, - (usr, pwd)) - return + # Save this + self.__sh['auto_login'] = (self.login, (usr, pwd)) + # Wait for the rsa-key to arrive + if not self.__sh['rsakey']: return + if not self.__sock: raise ConnectionError("You are not connected!") @@ -229,12 +229,13 @@ if self.cid != None: raise LoginError("You are already logged in") - if not self.__sh['rsakey']: - # Save this - self.__sh['login_after_connecting'] = (self.login_bot, + # Save this + self.__sh['auto_login'] = (self.login_bot, \ (owner, pwd, screenname)) - return + # Wait for the rsa-key to arrive + if not self.__sh['rsakey']: return + if not self.__sock: raise ConnectionError("You are not connected!") @@ -274,7 +275,7 @@ def close(self, reason = "manual"): """ - Will close the connection to the server. If the connection in + Will close the connection to the server. If the connection is already down, it will raise an exception. This will trigger the callback `disconnected`. It may reconnect, depending on the callback. If not, you can reuse this class by calling `connect`. @@ -311,7 +312,7 @@ self.__do_connect.set() else: # Remove auto-login - self.__sh['login_after_connecting'] = () + self.__sh['auto_login'] = () class __Pinger(): Modified: trunk/client/core/parser.py =================================================================== --- trunk/client/core/parser.py 2010-01-08 23:44:25 UTC (rev 334) +++ trunk/client/core/parser.py 2010-04-19 19:44:41 UTC (rev 335) @@ -44,7 +44,6 @@ "crash" - The server-parser has made a crash "gone offline" - Server has just shutdown """ - # reason - Why it's going to disconnect us self.core.close(msg["reason"]) @@ -59,8 +58,9 @@ self.call.received_rsa(msg['public']) - if self.sh['login_after_connecting'] != (): - login = self.sh['login_after_connecting'] + if self.core.cid == None and \ + self.sh['auto_login'] != (): + login = self.sh['auto_login'] login[0](*login[1]) @@ -125,7 +125,17 @@ pass + def useroffline(self, msg): + """ + Some user has gone offline + * cid - The connection-id for this client + """ + + # TODO + + pass + def error(self, msg): """ Called when we did something wrong! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |