diff options
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/adhoc_provider.py | 4 | ||||
-rwxr-xr-x | examples/adhoc_user.py | 4 | ||||
-rwxr-xr-x | examples/admin_commands.py | 4 | ||||
-rwxr-xr-x | examples/disco_browser.py | 2 | ||||
-rwxr-xr-x | examples/echo_client.py | 4 | ||||
-rwxr-xr-x | examples/gtalk_custom_domain.py | 4 | ||||
-rwxr-xr-x | examples/markup.py | 4 | ||||
-rwxr-xr-x | examples/muc.py | 4 | ||||
-rwxr-xr-x | examples/ping.py | 2 | ||||
-rwxr-xr-x | examples/proxy_echo_client.py | 4 | ||||
-rwxr-xr-x | examples/pubsub_client.py | 2 | ||||
-rwxr-xr-x | examples/pubsub_events.py | 4 | ||||
-rwxr-xr-x | examples/register_account.py | 4 | ||||
-rwxr-xr-x | examples/roster_browser.py | 6 | ||||
-rwxr-xr-x | examples/send_client.py | 4 | ||||
-rwxr-xr-x | examples/set_avatar.py | 2 | ||||
-rwxr-xr-x | examples/thirdparty_auth.py | 4 | ||||
-rwxr-xr-x | examples/user_location.py | 4 | ||||
-rwxr-xr-x | examples/user_tune.py | 4 |
19 files changed, 33 insertions, 37 deletions
diff --git a/examples/adhoc_provider.py b/examples/adhoc_provider.py index 2bab2f46..d2c3afd6 100755 --- a/examples/adhoc_provider.py +++ b/examples/adhoc_provider.py @@ -33,7 +33,7 @@ class CommandBot(slixmpp.ClientXMPP): # our roster. self.add_event_handler("session_start", self.start) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -47,7 +47,7 @@ class CommandBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() # We add the command after session_start has fired # to ensure that the correct full JID is used. diff --git a/examples/adhoc_user.py b/examples/adhoc_user.py index 8bdb675b..d86dc679 100755 --- a/examples/adhoc_user.py +++ b/examples/adhoc_user.py @@ -37,7 +37,7 @@ class CommandUserBot(slixmpp.ClientXMPP): self.add_event_handler("session_start", self.start) self.add_event_handler("message", self.message) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -51,7 +51,7 @@ class CommandUserBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() # We first create a session dictionary containing: # 'next' -- the handler to execute on a successful response diff --git a/examples/admin_commands.py b/examples/admin_commands.py index 72577f87..64c48913 100755 --- a/examples/admin_commands.py +++ b/examples/admin_commands.py @@ -30,7 +30,7 @@ class AdminCommands(slixmpp.ClientXMPP): self.add_event_handler("session_start", self.start) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -44,7 +44,7 @@ class AdminCommands(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() def command_success(iq, session): print('Command completed') diff --git a/examples/disco_browser.py b/examples/disco_browser.py index f0ece32d..02d51259 100755 --- a/examples/disco_browser.py +++ b/examples/disco_browser.py @@ -69,7 +69,7 @@ class Disco(slixmpp.ClientXMPP): event does not provide any additional data. """ - self.get_roster() + await self.get_roster() self.send_presence() try: diff --git a/examples/echo_client.py b/examples/echo_client.py index 820ca014..2a3337a5 100755 --- a/examples/echo_client.py +++ b/examples/echo_client.py @@ -38,7 +38,7 @@ class EchoBot(slixmpp.ClientXMPP): # MUC messages and error messages. self.add_event_handler("message", self.message) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -52,7 +52,7 @@ class EchoBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() def message(self, msg): """ diff --git a/examples/gtalk_custom_domain.py b/examples/gtalk_custom_domain.py index f055159b..c8d80e96 100755 --- a/examples/gtalk_custom_domain.py +++ b/examples/gtalk_custom_domain.py @@ -58,7 +58,7 @@ class GTalkBot(slixmpp.ClientXMPP): logging.error(err.message) self.disconnect() - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -72,7 +72,7 @@ class GTalkBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() def message(self, msg): """ diff --git a/examples/markup.py b/examples/markup.py index a72cbdb8..4c850ec8 100755 --- a/examples/markup.py +++ b/examples/markup.py @@ -39,7 +39,7 @@ class EchoBot(slixmpp.ClientXMPP): # MUC messages and error messages. self.add_event_handler("message", self.message) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -53,7 +53,7 @@ class EchoBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() def message(self, msg): """ diff --git a/examples/muc.py b/examples/muc.py index 469e8f49..e3433b8f 100755 --- a/examples/muc.py +++ b/examples/muc.py @@ -52,7 +52,7 @@ class MUCBot(slixmpp.ClientXMPP): self.muc_online) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -65,7 +65,7 @@ class MUCBot(slixmpp.ClientXMPP): event does not provide any additional data. """ - self.get_roster() + await self.get_roster() self.send_presence() self.plugin['xep_0045'].join_muc(self.room, self.nick, diff --git a/examples/ping.py b/examples/ping.py index cb1bb968..4492d4e0 100755 --- a/examples/ping.py +++ b/examples/ping.py @@ -51,7 +51,7 @@ class PingTest(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() try: rtt = await self['xep_0199'].ping(self.pingjid, diff --git a/examples/proxy_echo_client.py b/examples/proxy_echo_client.py index b149de31..566f5957 100755 --- a/examples/proxy_echo_client.py +++ b/examples/proxy_echo_client.py @@ -38,7 +38,7 @@ class EchoBot(slixmpp.ClientXMPP): # MUC messages and error messages. self.add_event_handler("message", self.message) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -52,7 +52,7 @@ class EchoBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() def message(self, msg): """ diff --git a/examples/pubsub_client.py b/examples/pubsub_client.py index 480c7d89..e285dfc8 100755 --- a/examples/pubsub_client.py +++ b/examples/pubsub_client.py @@ -32,7 +32,7 @@ class PubsubClient(slixmpp.ClientXMPP): self.add_event_handler('session_start', self.start) async def start(self, event): - self.get_roster() + await self.get_roster() self.send_presence() try: diff --git a/examples/pubsub_events.py b/examples/pubsub_events.py index e2fdc9cf..2b3a1e65 100755 --- a/examples/pubsub_events.py +++ b/examples/pubsub_events.py @@ -38,8 +38,8 @@ class PubsubEvents(slixmpp.ClientXMPP): # self.add_event_handler('event_prefix_purge', handler) # self.add_event_handler('event_prefix_delete', handler) - def start(self, event): - self.get_roster() + async def start(self, event): + await self.get_roster() self.send_presence() def _publish(self, msg): diff --git a/examples/register_account.py b/examples/register_account.py index 76b5fcfc..9ab0c664 100755 --- a/examples/register_account.py +++ b/examples/register_account.py @@ -47,7 +47,7 @@ class RegisterBot(slixmpp.ClientXMPP): # for data forms and OOB links that will make that easier. self.add_event_handler("register", self.register) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -61,7 +61,7 @@ class RegisterBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() # We're only concerned about registering, so nothing more to do here. self.disconnect() diff --git a/examples/roster_browser.py b/examples/roster_browser.py index 6ad8b2a4..5e27e9a2 100755 --- a/examples/roster_browser.py +++ b/examples/roster_browser.py @@ -51,12 +51,8 @@ class RosterBrowser(slixmpp.ClientXMPP): event does not provide any additional data. """ - future = asyncio.Future() - def callback(result): - future.set_result(None) try: - self.get_roster(callback=callback) - await future + await self.get_roster() except IqError as err: print('Error: %s' % err.iq['error']['condition']) except IqTimeout: diff --git a/examples/send_client.py b/examples/send_client.py index 6e3e5865..4ec33cfa 100755 --- a/examples/send_client.py +++ b/examples/send_client.py @@ -38,7 +38,7 @@ class SendMsgBot(slixmpp.ClientXMPP): # our roster. self.add_event_handler("session_start", self.start) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -52,7 +52,7 @@ class SendMsgBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() self.send_message(mto=self.recipient, mbody=self.msg, diff --git a/examples/set_avatar.py b/examples/set_avatar.py index 6579b2e7..c356290d 100755 --- a/examples/set_avatar.py +++ b/examples/set_avatar.py @@ -46,7 +46,7 @@ class AvatarSetter(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() avatar_file = None try: diff --git a/examples/thirdparty_auth.py b/examples/thirdparty_auth.py index 4129fa91..b2623972 100755 --- a/examples/thirdparty_auth.py +++ b/examples/thirdparty_auth.py @@ -60,7 +60,7 @@ class ThirdPartyAuthBot(slixmpp.ClientXMPP): # MUC messages and error messages. self.add_event_handler("message", self.message) - def start(self, event): + async def start(self, event): """ Process the session_start event. @@ -74,7 +74,7 @@ class ThirdPartyAuthBot(slixmpp.ClientXMPP): data. """ self.send_presence() - self.get_roster() + await self.get_roster() def message(self, msg): """ diff --git a/examples/user_location.py b/examples/user_location.py index 7edbeabb..2d473678 100755 --- a/examples/user_location.py +++ b/examples/user_location.py @@ -38,9 +38,9 @@ class LocationBot(ClientXMPP): self.current_tune = None - def start(self, event): + async def start(self, event): self.send_presence() - self.get_roster() + await self.get_roster() self['xep_0115'].update_caps() print("Using freegeoip.net to get geolocation.") diff --git a/examples/user_tune.py b/examples/user_tune.py index 6aa0da8e..2ce29c1d 100755 --- a/examples/user_tune.py +++ b/examples/user_tune.py @@ -35,9 +35,9 @@ class TuneBot(ClientXMPP): self.current_tune = None - def start(self, event): + async def start(self, event): self.send_presence() - self.get_roster() + await self.get_roster() self['xep_0115'].update_caps() def _update_tune(self): |