some more encoding fixes
This commit is contained in:
parent
c8d6d95d9e
commit
47dd2a0bdf
|
@ -388,7 +388,7 @@ class SpectrumBackend:
|
|||
|
||||
|
||||
def handleDataRead(self, data):
|
||||
self.m_data += bytes(data)
|
||||
self.m_data += data
|
||||
while len(self.m_data) != 0:
|
||||
expected_size = 0
|
||||
if (len(self.m_data) >= 4):
|
||||
|
|
2
buddy.py
2
buddy.py
|
@ -39,7 +39,7 @@ class Buddy():
|
|||
def __init__(self, owner, number, nick, statusMsg, groups, image_hash):
|
||||
self.nick = nick
|
||||
self.owner = owner
|
||||
self.number = number
|
||||
self.number = "%s" % number
|
||||
self.groups = groups
|
||||
self.image_hash = image_hash if image_hash is not None else ""
|
||||
self.statusMsg = u""
|
||||
|
|
|
@ -36,7 +36,7 @@ class RegisterSession(YowsupApp):
|
|||
self.backend.handleMessage(self.user, 'bot',
|
||||
'Country code must be a number')
|
||||
else: # Succeded in decoding country code
|
||||
country_code = str(country_code)
|
||||
country_code = "%s" % country_code
|
||||
if country_code != self.number[:len(country_code)]:
|
||||
self.backend.handleMessage(self.user,
|
||||
'bot', 'Number does not start with provided country code')
|
||||
|
|
|
@ -181,7 +181,7 @@ class YowsupApp(object):
|
|||
- to: (xxxxxxxxxx@s.whatsapp.net) who to send the message to
|
||||
- message: (str) the body of the message
|
||||
"""
|
||||
messageEntity = TextMessageProtocolEntity(message, to = to)
|
||||
messageEntity = TextMessageProtocolEntity(message.encode('utf-8'), to = to)
|
||||
self.sendEntity(messageEntity)
|
||||
return messageEntity.getId()
|
||||
|
||||
|
@ -566,7 +566,7 @@ class YowsupApp(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
def onTextMessage(self, _id, _from, to, notify, timestamp, participant, offline, retry, body):
|
||||
def onTextMessage(self, _id, _from, to, notify, timestamp, participant, offline, retry, body):
|
||||
"""
|
||||
Called when text message is received
|
||||
|
||||
|
@ -709,7 +709,7 @@ class YowsupApp(object):
|
|||
def sendEntity(self, entity):
|
||||
"""Sends an entity down the stack (as if YowsupAppLayer called toLower)"""
|
||||
self.stack.broadcastEvent(YowLayerEvent(YowsupAppLayer.TO_LOWER_EVENT,
|
||||
entity = bytearray(entity)
|
||||
entity = entity
|
||||
))
|
||||
|
||||
def sendIq(self, iq, onSuccess = None, onError = None):
|
||||
|
|
Loading…
Reference in a new issue