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 = (
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:
"""
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):
"""