Fix zeroconf connection and prevent invalid stanzas from being sent.

This commit is contained in:
Emmanuel Gil Peyrot 2016-04-02 15:29:26 +01:00
parent e80b0ba9b3
commit 1bf8a35b64
2 changed files with 5 additions and 2 deletions

View File

@ -753,9 +753,12 @@ class ClientZeroconf:
def send(self, stanza, is_message=False, now=False, on_ok=None,
on_not_ok=None):
stanza.setFrom(self.roster.zeroconf.name)
to = stanza.getTo()
if to is None:
# Cant send undirected stanza over Zeroconf.
return -1
to = gajim.get_jid_without_resource(to)
stanza.setFrom(self.roster.zeroconf.name)
try:
item = self.roster[to]

View File

@ -144,7 +144,7 @@ class Zeroconf:
val += c
if val is None: # missing '='
val = ''
txt_dict[key] = val.decode('utf-8', 'ignore')
txt_dict[key] = val
return txt_dict
def service_resolved_callback(self, interface, protocol, name, stype, domain,