From 476d76a53301f9da2ac7efa094e209b0607adfdc Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 16 Aug 2014 22:37:29 +0200 Subject: =?UTF-8?q?Remove=20threaded=20from=20examples=E2=80=99=20add=5Fev?= =?UTF-8?q?ent=5Fhandler.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/custom_stanzas/custom_stanza_provider.py | 7 +------ examples/custom_stanzas/custom_stanza_user.py | 2 +- examples/disco_browser.py | 2 +- examples/download_avatars.py | 2 +- examples/ibb_transfer/ibb_receiver.py | 2 +- examples/ping.py | 2 +- examples/pubsub_client.py | 2 +- examples/register_account.py | 4 ++-- examples/roster_browser.py | 6 ++---- examples/send_client.py | 2 +- examples/set_avatar.py | 2 +- examples/user_location.py | 2 +- 12 files changed, 14 insertions(+), 21 deletions(-) diff --git a/examples/custom_stanzas/custom_stanza_provider.py b/examples/custom_stanzas/custom_stanza_provider.py index 5782b671..b1b6e0a9 100755 --- a/examples/custom_stanzas/custom_stanza_provider.py +++ b/examples/custom_stanzas/custom_stanza_provider.py @@ -46,8 +46,7 @@ class ActionBot(slixmpp.ClientXMPP): self._handle_action)) self.add_event_handler('custom_action', - self._handle_action_event, - threaded=True) + self._handle_action_event) register_stanza_plugin(Iq, Action) @@ -77,10 +76,6 @@ class ActionBot(slixmpp.ClientXMPP): def _handle_action_event(self, iq): """ Respond to the custom action event. - - Since one of the actions is to disconnect, this - event handler needs to be run in threaded mode, by - using `threaded=True` in the `add_event_handler` call. """ method = iq['action']['method'] param = iq['action']['param'] diff --git a/examples/custom_stanzas/custom_stanza_user.py b/examples/custom_stanzas/custom_stanza_user.py index 21722196..af6bf9b3 100755 --- a/examples/custom_stanzas/custom_stanza_user.py +++ b/examples/custom_stanzas/custom_stanza_user.py @@ -38,7 +38,7 @@ class ActionUserBot(slixmpp.ClientXMPP): # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize # our roster. - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) self.add_event_handler("message", self.message) register_stanza_plugin(Iq, Action) diff --git a/examples/disco_browser.py b/examples/disco_browser.py index b088fdc0..11ea2e3c 100755 --- a/examples/disco_browser.py +++ b/examples/disco_browser.py @@ -51,7 +51,7 @@ class Disco(slixmpp.ClientXMPP): # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize # our roster. - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) def start(self, event): """ diff --git a/examples/download_avatars.py b/examples/download_avatars.py index dc35df80..fc893177 100755 --- a/examples/download_avatars.py +++ b/examples/download_avatars.py @@ -33,7 +33,7 @@ class AvatarDownloader(slixmpp.ClientXMPP): def __init__(self, jid, password): slixmpp.ClientXMPP.__init__(self, jid, password) - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) self.add_event_handler("changed_status", self.wait_for_presences) self.add_event_handler('vcard_avatar_update', self.on_vcard_avatar) diff --git a/examples/ibb_transfer/ibb_receiver.py b/examples/ibb_transfer/ibb_receiver.py index dd9171d2..d24e5003 100755 --- a/examples/ibb_transfer/ibb_receiver.py +++ b/examples/ibb_transfer/ibb_receiver.py @@ -37,7 +37,7 @@ class IBBReceiver(slixmpp.ClientXMPP): # our roster. self.add_event_handler("session_start", self.start) - self.add_event_handler("ibb_stream_start", self.stream_opened, threaded=True) + self.add_event_handler("ibb_stream_start", self.stream_opened) self.add_event_handler("ibb_stream_data", self.stream_data) def start(self, event): diff --git a/examples/ping.py b/examples/ping.py index 85cf722b..25aaf989 100755 --- a/examples/ping.py +++ b/examples/ping.py @@ -34,7 +34,7 @@ class PingTest(slixmpp.ClientXMPP): # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize # our roster. - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) def start(self, event): """ diff --git a/examples/pubsub_client.py b/examples/pubsub_client.py index 3b413e24..7fdd227b 100755 --- a/examples/pubsub_client.py +++ b/examples/pubsub_client.py @@ -28,7 +28,7 @@ class PubsubClient(slixmpp.ClientXMPP): self.data = data self.pubsub_server = server - self.add_event_handler('session_start', self.start, threaded=True) + self.add_event_handler('session_start', self.start) def start(self, event): self.get_roster() diff --git a/examples/register_account.py b/examples/register_account.py index 00bdfd0f..17f672ea 100755 --- a/examples/register_account.py +++ b/examples/register_account.py @@ -36,7 +36,7 @@ class RegisterBot(slixmpp.ClientXMPP): # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize # our roster. - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) # The register event provides an Iq result stanza with # a registration form from the server. This may include @@ -45,7 +45,7 @@ class RegisterBot(slixmpp.ClientXMPP): # cases, you will need to examine the fields provided # and respond accordingly. Slixmpp provides plugins # for data forms and OOB links that will make that easier. - self.add_event_handler("register", self.register, threaded=True) + self.add_event_handler("register", self.register) def start(self, event): """ diff --git a/examples/roster_browser.py b/examples/roster_browser.py index 785221da..6ca7ffe8 100755 --- a/examples/roster_browser.py +++ b/examples/roster_browser.py @@ -31,10 +31,8 @@ class RosterBrowser(slixmpp.ClientXMPP): # the bot establishes its connection with the server # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize - # our roster. We need threaded=True so that the - # session_start handler doesn't block event processing - # while we wait for presence stanzas to arrive. - self.add_event_handler("session_start", self.start, threaded=True) + # our roster. + self.add_event_handler("session_start", self.start) self.add_event_handler("changed_status", self.wait_for_presences) self.received = set() diff --git a/examples/send_client.py b/examples/send_client.py index 60c589e4..beecfac0 100755 --- a/examples/send_client.py +++ b/examples/send_client.py @@ -36,7 +36,7 @@ class SendMsgBot(slixmpp.ClientXMPP): # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize # our roster. - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) def start(self, event): """ diff --git a/examples/set_avatar.py b/examples/set_avatar.py index e687e6e0..12a79b3e 100755 --- a/examples/set_avatar.py +++ b/examples/set_avatar.py @@ -29,7 +29,7 @@ class AvatarSetter(slixmpp.ClientXMPP): def __init__(self, jid, password, filepath): slixmpp.ClientXMPP.__init__(self, jid, password) - self.add_event_handler("session_start", self.start, threaded=True) + self.add_event_handler("session_start", self.start) self.filepath = filepath diff --git a/examples/user_location.py b/examples/user_location.py index 5fa4f560..7fa77e68 100755 --- a/examples/user_location.py +++ b/examples/user_location.py @@ -24,7 +24,7 @@ class LocationBot(ClientXMPP): def __init__(self, jid, password): super(LocationBot, self).__init__(jid, password) - self.add_event_handler('session_start', self.start, threaded=True) + self.add_event_handler('session_start', self.start) self.add_event_handler('user_location_publish', self.user_location_publish) -- cgit v1.2.3