Simplify send_presence_subscription.
It is technically obsolete now, but remains because it set a default subscription type of 'subscribe'.
This commit is contained in:
parent
f70b49882f
commit
19f65c8510
@ -530,13 +530,16 @@ class BaseXMPP(XMLStream):
|
|||||||
:param pnick: Optional nickname of the presence's sender.
|
:param pnick: Optional nickname of the presence's sender.
|
||||||
"""
|
"""
|
||||||
# Python2.6 chokes on Unicode strings for dict keys.
|
# Python2.6 chokes on Unicode strings for dict keys.
|
||||||
args = {str('pto'): pto,
|
args = {str('ptype'): ptype,
|
||||||
str('ptype'): ptype,
|
|
||||||
str('pshow'): pshow,
|
str('pshow'): pshow,
|
||||||
str('pstatus'): pstatus,
|
str('pstatus'): pstatus,
|
||||||
str('ppriority'): ppriority,
|
str('ppriority'): ppriority,
|
||||||
str('pnick'): pnick}
|
str('pnick'): pnick}
|
||||||
|
|
||||||
|
if ptype in ('probe', 'subscribe', 'subscribed', \
|
||||||
|
'unsubscribe', 'unsubscribed'):
|
||||||
|
args[str('pto')] = pto.bare
|
||||||
|
|
||||||
if self.is_component:
|
if self.is_component:
|
||||||
self.roster[pfrom].send_presence(**args)
|
self.roster[pfrom].send_presence(**args)
|
||||||
else:
|
else:
|
||||||
@ -554,14 +557,10 @@ class BaseXMPP(XMLStream):
|
|||||||
:param ptype: The type of presence, such as ``'subscribe'``.
|
:param ptype: The type of presence, such as ``'subscribe'``.
|
||||||
:param pnick: Optional nickname of the presence's sender.
|
:param pnick: Optional nickname of the presence's sender.
|
||||||
"""
|
"""
|
||||||
presence = self.makePresence(ptype=ptype,
|
self.send_presence(pto=pto,
|
||||||
pfrom=pfrom,
|
pfrom=pfrom,
|
||||||
pto=self.getjidbare(pto))
|
ptype=ptype,
|
||||||
if pnick:
|
pnick=pnick)
|
||||||
nick = ET.Element('{http://jabber.org/protocol/nick}nick')
|
|
||||||
nick.text = pnick
|
|
||||||
presence.append(nick)
|
|
||||||
presence.send()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def jid(self):
|
def jid(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user