Fix examples relying on the changed API
This commit is contained in:
parent
bf5d7c83af
commit
83d00a5913
4 changed files with 8 additions and 10 deletions
|
@ -82,15 +82,13 @@ class Disco(slixmpp.ClientXMPP):
|
|||
# for the disco_info event, or passing a handler
|
||||
# function using the callback parameter.
|
||||
info = yield from self['xep_0030'].get_info(jid=self.target_jid,
|
||||
node=self.target_node,
|
||||
coroutine=True)
|
||||
node=self.target_node)
|
||||
if self.get in self.items_types:
|
||||
# The same applies from above. Listen for the
|
||||
# disco_items event or pass a callback function
|
||||
# if you need to process a non-blocking request.
|
||||
items = yield from self['xep_0030'].get_items(jid=self.target_jid,
|
||||
node=self.target_node,
|
||||
coroutine=True)
|
||||
node=self.target_node)
|
||||
if self.get not in self.info_types and self.get not in self.items_types:
|
||||
logging.error("Invalid disco request type.")
|
||||
return
|
||||
|
|
|
@ -75,7 +75,7 @@ class AvatarDownloader(slixmpp.ClientXMPP):
|
|||
print("Received vCard avatar update from %s" % pres['from'].bare)
|
||||
try:
|
||||
result = yield from self['xep_0054'].get_vcard(pres['from'].bare, cached=True,
|
||||
coroutine=True, timeout=5)
|
||||
timeout=5)
|
||||
except XMPPError:
|
||||
print("Error retrieving avatar for %s" % pres['from'])
|
||||
return
|
||||
|
@ -97,7 +97,7 @@ class AvatarDownloader(slixmpp.ClientXMPP):
|
|||
if not info['url']:
|
||||
try:
|
||||
result = yield from self['xep_0084'].retrieve_avatar(msg['from'].bare, info['id'],
|
||||
coroutine=True, timeout=5)
|
||||
timeout=5)
|
||||
except XMPPError:
|
||||
print("Error retrieving avatar for %s" % msg['from'])
|
||||
return
|
||||
|
|
|
@ -90,7 +90,7 @@ class RegisterBot(slixmpp.ClientXMPP):
|
|||
resp['register']['password'] = self.password
|
||||
|
||||
try:
|
||||
yield from resp.send_coroutine()
|
||||
yield from resp.send()
|
||||
logging.info("Account created for %s!" % self.boundjid)
|
||||
except IqError as e:
|
||||
logging.error("Could not register account: %s" %
|
||||
|
|
|
@ -68,14 +68,14 @@ class AvatarSetter(slixmpp.ClientXMPP):
|
|||
used_xep84 = False
|
||||
|
||||
print('Publish XEP-0084 avatar data')
|
||||
result = yield from self['xep_0084'].publish_avatar(avatar, coroutine=True)
|
||||
result = yield from self['xep_0084'].publish_avatar(avatar)
|
||||
if isinstance(result, XMPPError):
|
||||
print('Could not publish XEP-0084 avatar')
|
||||
else:
|
||||
used_xep84 = True
|
||||
|
||||
print('Update vCard with avatar')
|
||||
result = yield from self['xep_0153'].set_avatar(avatar=avatar, mtype=avatar_type, coroutine=True)
|
||||
result = yield from self['xep_0153'].set_avatar(avatar=avatar, mtype=avatar_type)
|
||||
if isinstance(result, XMPPError):
|
||||
print('Could not set vCard avatar')
|
||||
|
||||
|
@ -89,7 +89,7 @@ class AvatarSetter(slixmpp.ClientXMPP):
|
|||
# options in image type, source (HTTP vs pubsub),
|
||||
# size, etc.
|
||||
# {'id': ....}
|
||||
], coroutine=True)
|
||||
])
|
||||
if isinstance(result, XMPPError):
|
||||
print('Could not publish XEP-0084 metadata')
|
||||
|
||||
|
|
Loading…
Reference in a new issue