X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fconnection.py;h=95638992589e01fa4a8189ecb8f8e4999c83846b;hp=2dce28abd85d4a845a2e0442a7a3f30af2aa8522;hb=c1299d00ddbb17aa0bf8826f9f6e98d0a756c16f;hpb=51beca2c54c6a5a5e8dd92f5df0d81fd67406a97;ds=sidebyside diff --git a/src/connection.py b/src/connection.py index 2dce28a..9563899 100644 --- a/src/connection.py +++ b/src/connection.py @@ -11,17 +11,26 @@ import channel_manager class TheOneRingConnection(telepathy.server.Connection): - _mandatory_parameters = { + MANDATORY_PARAMETERS = { 'account' : 's', 'password' : 's' } + OPTIONAL_PARAMETERS = { + } + PARAMETER_DEFAULTS = { + } def __init__(self, manager, parameters): try: self.check_parameters(parameters) account = unicode(parameters['account']) - telepathy.server.Connection.__init__(self, 'gvoice', account, 'theonering') + telepathy.server.Connection.__init__( + self, + constants._telepathy_protocol_name_, + account, + constants._telepathy_implementation_name_ + ) self._manager = weakref.proxy(manager) self._credentials = ( @@ -36,8 +45,6 @@ class TheOneRingConnection(telepathy.server.Connection): self.set_self_handle(handle.create_handle(self, 'self')) self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NONE_SPECIFIED - self._initial_presence = None - self._initial_personal_message = None logging.info("Connection to the account %s created" % account) except Exception, e: @@ -66,7 +73,10 @@ class TheOneRingConnection(telepathy.server.Connection): """ logging.info("Connecting") self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_NONE_SPECIFIED - self._backend.login(*self._credentials) + try: + self._backend.login(*self._credentials) + except RuntimeError: + self.__disconnect_reason = telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED def Disconnect(self): """