dnspython target returns with dot in the end. catch and fix that; thanks della for helping me and reporting this

This commit is contained in:
Nikos Kouremenos 2005-12-06 17:37:54 +00:00
parent 9f2a002351
commit 5868901824
1 changed files with 6 additions and 1 deletions

View File

@ -159,6 +159,7 @@ class Connection:
self.vcard_shas = {} # sha of contacts
self.status = ''
self.old_show = ''
# holds the actual hostname to which we are connected
self.connected_hostname = None
self.time_to_reconnect = None
self.new_account_info = None
@ -1583,7 +1584,11 @@ class Connection:
answers = [x for x in dns.resolver.query(query, 'SRV')]
if answers:
for a in answers:
hosts.append({'host': str(a.target),
target = str(a.target)
if target.endswith('.'):
# target is f.e. talk.google.com. remove last dot
target = target[:-1]
hosts.append({'host': target,
'port': int(a.port),
'prio': int(a.priority),
'weight': int(a.weight)})