Fix zeroconf connection and prevent invalid stanzas from being sent.
This commit is contained in:
parent
e80b0ba9b3
commit
1bf8a35b64
2 changed files with 5 additions and 2 deletions
|
@ -753,9 +753,12 @@ class ClientZeroconf:
|
||||||
|
|
||||||
def send(self, stanza, is_message=False, now=False, on_ok=None,
|
def send(self, stanza, is_message=False, now=False, on_ok=None,
|
||||||
on_not_ok=None):
|
on_not_ok=None):
|
||||||
stanza.setFrom(self.roster.zeroconf.name)
|
|
||||||
to = stanza.getTo()
|
to = stanza.getTo()
|
||||||
|
if to is None:
|
||||||
|
# Can’t send undirected stanza over Zeroconf.
|
||||||
|
return -1
|
||||||
to = gajim.get_jid_without_resource(to)
|
to = gajim.get_jid_without_resource(to)
|
||||||
|
stanza.setFrom(self.roster.zeroconf.name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
item = self.roster[to]
|
item = self.roster[to]
|
||||||
|
|
|
@ -144,7 +144,7 @@ class Zeroconf:
|
||||||
val += c
|
val += c
|
||||||
if val is None: # missing '='
|
if val is None: # missing '='
|
||||||
val = ''
|
val = ''
|
||||||
txt_dict[key] = val.decode('utf-8', 'ignore')
|
txt_dict[key] = val
|
||||||
return txt_dict
|
return txt_dict
|
||||||
|
|
||||||
def service_resolved_callback(self, interface, protocol, name, stype, domain,
|
def service_resolved_callback(self, interface, protocol, name, stype, domain,
|
||||||
|
|
Loading…
Add table
Reference in a new issue