mention name and not hostanem when failing to connect to a account

This commit is contained in:
Nikos Kouremenos 2005-05-27 16:43:38 +00:00
parent dbdd89dd3f
commit 14985bf5d1
1 changed files with 19 additions and 19 deletions

View File

@ -545,33 +545,33 @@ class Connection:
con.RegisterDisconnectHandler(self._disconnectedCB) con.RegisterDisconnectHandler(self._disconnectedCB)
con_type = con.connect(proxy=proxy, tls=usetls) #FIXME: blocking con_type = con.connect(proxy=proxy, tls=usetls) #FIXME: blocking
if not con_type: if not con_type:
gajim.log.debug('Couldn\'t connect to %s' % hostname) gajim.log.debug("Couldn't connect to %s" % name)
self.connected = 0 self.connected = 0
self.dispatch('STATUS', 'offline') self.dispatch('STATUS', 'offline')
self.dispatch('ERROR', _('Couldn\'t connect to %s') % hostname) self.dispatch('ERROR', _("Couldn't connect to %s") % name)
return None return None
con.RegisterHandler('message', self._messageCB) con.RegisterHandler('message', self._messageCB)
con.RegisterHandler('presence', self._presenceCB) con.RegisterHandler('presence', self._presenceCB)
con.RegisterHandler('iq', self._vCardCB, 'result',\ con.RegisterHandler('iq', self._vCardCB, 'result',
common.xmpp.NS_VCARD) common.xmpp.NS_VCARD)
con.RegisterHandler('iq', self._rosterSetCB, 'set',\ con.RegisterHandler('iq', self._rosterSetCB, 'set',
common.xmpp.NS_ROSTER) common.xmpp.NS_ROSTER)
con.RegisterHandler('iq', self._BrowseResultCB, 'result',\ con.RegisterHandler('iq', self._BrowseResultCB, 'result',
common.xmpp.NS_BROWSE) common.xmpp.NS_BROWSE)
con.RegisterHandler('iq', self._DiscoverItemsCB, 'result',\ con.RegisterHandler('iq', self._DiscoverItemsCB, 'result',
common.xmpp.NS_DISCO_ITEMS) common.xmpp.NS_DISCO_ITEMS)
con.RegisterHandler('iq', self._DiscoverInfoCB, 'result',\ con.RegisterHandler('iq', self._DiscoverInfoCB, 'result',
common.xmpp.NS_DISCO_INFO) common.xmpp.NS_DISCO_INFO)
con.RegisterHandler('iq', self._DiscoverInfoErrorCB, 'error',\ con.RegisterHandler('iq', self._DiscoverInfoErrorCB, 'error',
common.xmpp.NS_DISCO_INFO) common.xmpp.NS_DISCO_INFO)
con.RegisterHandler('iq', self._VersionCB, 'get',\ con.RegisterHandler('iq', self._VersionCB, 'get',
common.xmpp.NS_VERSION) common.xmpp.NS_VERSION)
con.RegisterHandler('iq', self._VersionResultCB, 'result',\ con.RegisterHandler('iq', self._VersionResultCB, 'result',
common.xmpp.NS_VERSION) common.xmpp.NS_VERSION)
con.RegisterHandler('iq', self._MucOwnerCB, 'result',\ con.RegisterHandler('iq', self._MucOwnerCB, 'result',
common.xmpp.NS_MUC_OWNER) common.xmpp.NS_MUC_OWNER)
con.RegisterHandler('iq', self._getRosterCB, 'result',\ con.RegisterHandler('iq', self._getRosterCB, 'result',
common.xmpp.NS_ROSTER) common.xmpp.NS_ROSTER)
con.RegisterHandler('iq', self._ErrorCB, 'error') con.RegisterHandler('iq', self._ErrorCB, 'error')
@ -583,17 +583,17 @@ class Connection:
except IOError: #probably a timeout except IOError: #probably a timeout
self.connected = 0 self.connected = 0
self.dispatch('STATUS', 'offline') self.dispatch('STATUS', 'offline')
self.dispatch('ERROR', _('Couldn\'t connect to %s') % hostname) self.dispatch('ERROR', _("Couldn't connect to %s") % name)
return None return None
if auth: if auth:
con.initRoster() con.initRoster()
self.connected = 2 self.connected = 2
return con return con
else: else:
gajim.log.debug('Couldn\'t authenticate to %s' % hostname) gajim.log.debug("Couldn't authenticate to %s" % name)
self.connected = 0 self.connected = 0
self.dispatch('STATUS', 'offline') self.dispatch('STATUS', 'offline')
self.dispatch('ERROR', _('Authentication failed with %s, check your login and password') % hostname) self.dispatch('ERROR', _('Authentication failed with %s, check your login and password') % name)
return None return None
# END connect # END connect
@ -795,8 +795,8 @@ class Connection:
c = common.xmpp.Client(server = config['hostname'], debug = []) c = common.xmpp.Client(server = config['hostname'], debug = [])
con_type = c.connect(proxy = proxy) con_type = c.connect(proxy = proxy)
if not con_type: if not con_type:
gajim.log.debug('Couldn\'t connect to %s' % config['hostname']) gajim.log.debug("Couldn't connect to %s" % config['hostname'])
self.dispatch('ERROR', _('Couldn\'t connect to ') + config['hostname']) self.dispatch('ERROR', _("Couldn't connect to ") + config['hostname'])
return False return False
else: else:
gajim.log.debug('Connected to server') gajim.log.debug('Connected to server')
@ -886,7 +886,7 @@ class Connection:
self.connection.send(msg_iq) self.connection.send(msg_iq)
def request_gc_config(self, room_jid): def request_gc_config(self, room_jid):
iq = common.xmpp.Iq(typ = 'get', queryNS = common.xmpp.NS_MUC_OWNER,\ iq = common.xmpp.Iq(typ = 'get', queryNS = common.xmpp.NS_MUC_OWNER,
to = room_jid) to = room_jid)
self.connection.send(iq) self.connection.send(iq)
@ -898,7 +898,7 @@ class Connection:
show = None show = None
else: else:
ptype = 'available' ptype = 'available'
self.connection.send(common.xmpp.Presence(to = '%s/%s' % (jid, nick), \ self.connection.send(common.xmpp.Presence(to = '%s/%s' % (jid, nick),
typ = ptype, show = show, status = status)) typ = ptype, show = show, status = status))
def gc_set_role(self, room_jid, nick, role): def gc_set_role(self, room_jid, nick, role):