summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0231
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0231')
-rw-r--r--sleekxmpp/plugins/xep_0231/bob.py4
-rw-r--r--sleekxmpp/plugins/xep_0231/stanza.py7
2 files changed, 7 insertions, 4 deletions
diff --git a/sleekxmpp/plugins/xep_0231/bob.py b/sleekxmpp/plugins/xep_0231/bob.py
index d86a5ddf..5e1f590b 100644
--- a/sleekxmpp/plugins/xep_0231/bob.py
+++ b/sleekxmpp/plugins/xep_0231/bob.py
@@ -10,7 +10,7 @@
import logging
import hashlib
-from sleekxmpp.stanza import Iq
+from sleekxmpp.stanza import Iq, Message, Presence
from sleekxmpp.exceptions import XMPPError
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import StanzaPath
@@ -36,6 +36,8 @@ class XEP_0231(BasePlugin):
self._cids = {}
register_stanza_plugin(Iq, BitsOfBinary)
+ register_stanza_plugin(Message, BitsOfBinary)
+ register_stanza_plugin(Presence, BitsOfBinary)
self.xmpp.register_handler(
Callback('Bits of Binary - Iq',
diff --git a/sleekxmpp/plugins/xep_0231/stanza.py b/sleekxmpp/plugins/xep_0231/stanza.py
index a51f5a03..8bf0d6ee 100644
--- a/sleekxmpp/plugins/xep_0231/stanza.py
+++ b/sleekxmpp/plugins/xep_0231/stanza.py
@@ -7,9 +7,10 @@
See the file LICENSE for copying permission.
"""
+import base64
-from base64 import b64encode, b64decode
+from sleekxmpp.util import bytes
from sleekxmpp.xmlstream import ElementBase
@@ -26,10 +27,10 @@ class BitsOfBinary(ElementBase):
self._set_attr('max-age', value)
def get_data(self):
- return b64decode(self.xml.text)
+ return base64.b64decode(bytes(self.xml.text))
def set_data(self, value):
- self.xml.text = b64encode(value)
+ self.xml.text = bytes(base64.b64encode(value)).decode('utf-8')
def del_data(self):
self.xml.text = ''