From 6175cbcd99f917b08646d130770a132458056249 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 16 Aug 2014 22:37:29 +0200 Subject: Reintroduce XMLStream.process, making it run the asyncio event loop. --- examples/adhoc_provider.py | 14 ++------------ examples/adhoc_user.py | 14 ++------------ examples/admin_commands.py | 14 ++------------ examples/custom_stanzas/custom_stanza_provider.py | 14 ++------------ examples/custom_stanzas/custom_stanza_user.py | 14 ++------------ examples/disco_browser.py | 13 ++----------- examples/download_avatars.py | 13 ++----------- examples/echo_client.py | 14 ++------------ examples/echo_component.py | 7 ++----- examples/gtalk_custom_domain.py | 14 ++------------ examples/ibb_transfer/ibb_receiver.py | 14 ++------------ examples/ibb_transfer/ibb_sender.py | 14 ++------------ examples/muc.py | 14 ++------------ examples/ping.py | 14 ++------------ examples/proxy_echo_client.py | 14 ++------------ examples/pubsub_client.py | 13 ++----------- examples/pubsub_events.py | 14 ++------------ examples/register_account.py | 14 ++------------ examples/roster_browser.py | 14 ++------------ examples/send_client.py | 14 ++------------ examples/set_avatar.py | 13 ++----------- examples/thirdparty_auth.py | 14 ++------------ examples/user_location.py | 14 ++------------ examples/user_tune.py | 14 ++------------ 24 files changed, 48 insertions(+), 277 deletions(-) (limited to 'examples') diff --git a/examples/adhoc_provider.py b/examples/adhoc_provider.py index e0a7effd..e4a8fc04 100755 --- a/examples/adhoc_provider.py +++ b/examples/adhoc_provider.py @@ -179,15 +179,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/adhoc_user.py b/examples/adhoc_user.py index 646b41ac..4aa2a236 100755 --- a/examples/adhoc_user.py +++ b/examples/adhoc_user.py @@ -185,15 +185,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/admin_commands.py b/examples/admin_commands.py index e6415a45..97708cd8 100755 --- a/examples/admin_commands.py +++ b/examples/admin_commands.py @@ -153,15 +153,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/custom_stanzas/custom_stanza_provider.py b/examples/custom_stanzas/custom_stanza_provider.py index b1b6e0a9..cfc8335d 100755 --- a/examples/custom_stanzas/custom_stanza_provider.py +++ b/examples/custom_stanzas/custom_stanza_provider.py @@ -143,15 +143,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/custom_stanzas/custom_stanza_user.py b/examples/custom_stanzas/custom_stanza_user.py index af6bf9b3..891eb72b 100755 --- a/examples/custom_stanzas/custom_stanza_user.py +++ b/examples/custom_stanzas/custom_stanza_user.py @@ -150,15 +150,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/disco_browser.py b/examples/disco_browser.py index 11ea2e3c..2f926687 100755 --- a/examples/disco_browser.py +++ b/examples/disco_browser.py @@ -179,14 +179,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/download_avatars.py b/examples/download_avatars.py index fc893177..61b07c58 100755 --- a/examples/download_avatars.py +++ b/examples/download_avatars.py @@ -159,14 +159,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/echo_client.py b/examples/echo_client.py index 733b541d..de649eb6 100755 --- a/examples/echo_client.py +++ b/examples/echo_client.py @@ -132,15 +132,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/echo_component.py b/examples/echo_component.py index d56935f8..0512f37c 100755 --- a/examples/echo_component.py +++ b/examples/echo_component.py @@ -104,8 +104,5 @@ if __name__ == '__main__': xmpp.registerPlugin('xep_0199') # XMPP Ping # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/gtalk_custom_domain.py b/examples/gtalk_custom_domain.py index 92d9fea3..8c280ac4 100755 --- a/examples/gtalk_custom_domain.py +++ b/examples/gtalk_custom_domain.py @@ -139,15 +139,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/ibb_transfer/ibb_receiver.py b/examples/ibb_transfer/ibb_receiver.py index d24e5003..02c899eb 100755 --- a/examples/ibb_transfer/ibb_receiver.py +++ b/examples/ibb_transfer/ibb_receiver.py @@ -122,15 +122,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/ibb_transfer/ibb_sender.py b/examples/ibb_transfer/ibb_sender.py index 2d88d4ce..f5e44fb7 100755 --- a/examples/ibb_transfer/ibb_sender.py +++ b/examples/ibb_transfer/ibb_sender.py @@ -120,15 +120,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/muc.py b/examples/muc.py index 08a71a44..b609cefe 100755 --- a/examples/muc.py +++ b/examples/muc.py @@ -168,15 +168,5 @@ if __name__ == '__main__': xmpp.register_plugin('xep_0199') # XMPP Ping # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/ping.py b/examples/ping.py index 25aaf989..8ecb8cff 100755 --- a/examples/ping.py +++ b/examples/ping.py @@ -118,15 +118,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/proxy_echo_client.py b/examples/proxy_echo_client.py index b4b4dab4..e1eab19f 100755 --- a/examples/proxy_echo_client.py +++ b/examples/proxy_echo_client.py @@ -143,15 +143,5 @@ if __name__ == '__main__': 'password': opts.proxy_pass} # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/pubsub_client.py b/examples/pubsub_client.py index 7fdd227b..1e24dbd8 100755 --- a/examples/pubsub_client.py +++ b/examples/pubsub_client.py @@ -176,14 +176,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/pubsub_events.py b/examples/pubsub_events.py index f2384db8..f4be2d6c 100755 --- a/examples/pubsub_events.py +++ b/examples/pubsub_events.py @@ -128,15 +128,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/register_account.py b/examples/register_account.py index 17f672ea..396b23c6 100755 --- a/examples/register_account.py +++ b/examples/register_account.py @@ -154,15 +154,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/roster_browser.py b/examples/roster_browser.py index 6ca7ffe8..0bdc7c18 100755 --- a/examples/roster_browser.py +++ b/examples/roster_browser.py @@ -144,15 +144,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - else: - print("Unable to connect.") - + xmpp.connect() + xmpp.process() diff --git a/examples/send_client.py b/examples/send_client.py index beecfac0..17dffcaa 100755 --- a/examples/send_client.py +++ b/examples/send_client.py @@ -118,15 +118,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/set_avatar.py b/examples/set_avatar.py index 12a79b3e..452363b7 100755 --- a/examples/set_avatar.py +++ b/examples/set_avatar.py @@ -149,14 +149,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/thirdparty_auth.py b/examples/thirdparty_auth.py index fbe49f8b..504048a9 100755 --- a/examples/thirdparty_auth.py +++ b/examples/thirdparty_auth.py @@ -223,15 +223,5 @@ if __name__ == '__main__': # Connect to the XMPP server and start processing XMPP stanzas. # Google only allows one SASL attempt per connection, so in order to # enable the X-GOOGLE-TOKEN mechanism, we'll disable TLS. - if xmpp.connect(use_tls=False): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/user_location.py b/examples/user_location.py index 7fa77e68..3e484d72 100755 --- a/examples/user_location.py +++ b/examples/user_location.py @@ -111,15 +111,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() diff --git a/examples/user_tune.py b/examples/user_tune.py index 96548514..4ecfdb7d 100755 --- a/examples/user_tune.py +++ b/examples/user_tune.py @@ -123,15 +123,5 @@ if __name__ == '__main__': # xmpp.ca_certs = "path/to/ca/cert" # Connect to the XMPP server and start processing XMPP stanzas. - if xmpp.connect(): - # If you do not have the dnspython library installed, you will need - # to manually specify the name of the server if it does not match - # the one in the JID. For example, to use Google Talk you would - # need to use: - # - # if xmpp.connect(('talk.google.com', 5222)): - # ... - xmpp.process(block=True) - print("Done") - else: - print("Unable to connect.") + xmpp.connect() + xmpp.process() -- cgit v1.2.3