diff options
Diffstat (limited to 'examples/custom_stanzas')
-rwxr-xr-x | examples/custom_stanzas/custom_stanza_provider.py | 10 | ||||
-rwxr-xr-x | examples/custom_stanzas/custom_stanza_user.py | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/custom_stanzas/custom_stanza_provider.py b/examples/custom_stanzas/custom_stanza_provider.py index b532c17c..0ebdb77e 100755 --- a/examples/custom_stanzas/custom_stanza_provider.py +++ b/examples/custom_stanzas/custom_stanza_provider.py @@ -28,8 +28,8 @@ from stanza import Action # throughout SleekXMPP, we will set the default encoding # ourselves to UTF-8. if sys.version_info < (3, 0): - reload(sys) - sys.setdefaultencoding('utf8') + from sleekxmpp.util.misc_ops import setdefaultencoding + setdefaultencoding('utf8') else: raw_input = input @@ -51,13 +51,13 @@ class ActionBot(sleekxmpp.ClientXMPP): # our roster. self.add_event_handler("session_start", self.start) - self.registerHandler( + self.register_handler( Callback('Some custom iq', StanzaPath('iq@type=set/action'), self._handle_action)) - self.add_event_handler('custom_action', - self._handle_action_event, + self.add_event_handler('custom_action', + self._handle_action_event, threaded=True) register_stanza_plugin(Iq, Action) diff --git a/examples/custom_stanzas/custom_stanza_user.py b/examples/custom_stanzas/custom_stanza_user.py index 5b5042c7..418e3218 100755 --- a/examples/custom_stanzas/custom_stanza_user.py +++ b/examples/custom_stanzas/custom_stanza_user.py @@ -26,8 +26,8 @@ from stanza import Action # throughout SleekXMPP, we will set the default encoding # ourselves to UTF-8. if sys.version_info < (3, 0): - reload(sys) - sys.setdefaultencoding('utf8') + from sleekxmpp.util.misc_ops import setdefaultencoding + setdefaultencoding('utf8') else: raw_input = input |