summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/adhoc_provider.py4
-rwxr-xr-xexamples/adhoc_user.py6
-rwxr-xr-xexamples/admin_commands.py4
-rwxr-xr-xexamples/disco_browser.py2
-rwxr-xr-xexamples/download_avatars.py2
-rwxr-xr-xexamples/echo_client.py4
-rwxr-xr-xexamples/gtalk_custom_domain.py4
-rwxr-xr-xexamples/markup.py4
-rwxr-xr-xexamples/migrate_roster.py2
-rwxr-xr-xexamples/muc.py4
-rwxr-xr-xexamples/ping.py4
-rwxr-xr-xexamples/proxy_echo_client.py4
-rwxr-xr-xexamples/pubsub_client.py2
-rwxr-xr-xexamples/pubsub_events.py4
-rwxr-xr-xexamples/register_account.py4
-rwxr-xr-xexamples/roster_browser.py8
-rwxr-xr-xexamples/send_client.py6
-rwxr-xr-xexamples/set_avatar.py4
-rwxr-xr-xexamples/thirdparty_auth.py4
-rwxr-xr-xexamples/user_location.py4
-rwxr-xr-xexamples/user_tune.py4
21 files changed, 40 insertions, 44 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..931ef71c 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
@@ -176,4 +176,4 @@ if __name__ == '__main__':
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
- xmpp.process()
+ xmpp.process(forever=False)
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/download_avatars.py b/examples/download_avatars.py
index 02591e3e..37733b01 100755
--- a/examples/download_avatars.py
+++ b/examples/download_avatars.py
@@ -159,4 +159,4 @@ if __name__ == '__main__':
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
- xmpp.process()
+ xmpp.process(forever=False)
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/migrate_roster.py b/examples/migrate_roster.py
index d599b10c..be457fb3 100755
--- a/examples/migrate_roster.py
+++ b/examples/migrate_roster.py
@@ -104,4 +104,4 @@ def on_session2(event):
new_xmpp.add_event_handler('session_start', on_session2)
new_xmpp.connect()
-new_xmpp.process()
+new_xmpp.process(forever=False)
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..7870715c 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,
@@ -109,4 +109,4 @@ if __name__ == '__main__':
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
- xmpp.process()
+ xmpp.process(forever=False)
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..e9365d09 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:
@@ -138,4 +134,4 @@ if __name__ == '__main__':
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
- xmpp.process()
+ xmpp.process(forever=False)
diff --git a/examples/send_client.py b/examples/send_client.py
index 6e3e5865..5d5fb810 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,
@@ -107,4 +107,4 @@ if __name__ == '__main__':
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
- xmpp.process()
+ xmpp.process(forever=False)
diff --git a/examples/set_avatar.py b/examples/set_avatar.py
index 6579b2e7..3188e9d8 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:
@@ -137,4 +137,4 @@ if __name__ == '__main__':
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
- xmpp.process()
+ xmpp.process(forever=False)
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):