remove e4u dependency as it supports Python 2 only

This commit is contained in:
Steffen Vogel 2019-04-25 21:23:19 +02:00
parent 71758d2b7c
commit d13c0205c8
6 changed files with 6 additions and 16 deletions

View file

@ -104,14 +104,12 @@ Install required dependencies:
:: ::
$ pip install --pre e4u protobuf python-dateutil yowsup2 $ pip install --pre protobuf python-dateutil yowsup2
- e4u_: is a simple emoji4unicode python bindings
- yowsup_: is a python library that enables you build application - yowsup_: is a python library that enables you build application
which use WhatsApp service. which use WhatsApp service.
.. _Spectrum 2: http://www.spectrum.im .. _Spectrum 2: http://www.spectrum.im
.. _Yowsup 2: https://github.com/tgalal/yowsup .. _Yowsup 3: https://github.com/tgalal/yowsup
.. _Github: https://github.com/hanzz/libtransport .. _Github: https://github.com/hanzz/libtransport
.. _yowsup: https://github.com/tgalal/yowsup .. _yowsup: https://github.com/tgalal/yowsup
.. _e4u: https://pypi.python.org/pypi/e4u

View file

@ -39,7 +39,6 @@ setup(name='transwhat',
install_requires=[ install_requires=[
'protobuf', 'protobuf',
'yowsup', 'yowsup',
'e4u',
'Pillow', 'Pillow',
'python-dateutil' 'python-dateutil'
], ],

View file

@ -114,7 +114,7 @@ class BuddyList(dict):
if status is None: if status is None:
buddy.statusMsg = "" buddy.statusMsg = ""
else: else:
buddy.statusMsg = utils.softToUni(status) buddy.statusMsg = status
self.updateSpectrum(buddy) self.updateSpectrum(buddy)
def load(self, buddies): def load(self, buddies):

View file

@ -141,7 +141,7 @@ class Session(YowsupApp):
if room not in self.groups: if room not in self.groups:
owner = group.getOwner().split('@')[0] owner = group.getOwner().split('@')[0]
subjectOwner = group.getSubjectOwner().split('@')[0] subjectOwner = group.getSubjectOwner().split('@')[0]
subject = utils.softToUni(group.getSubject()) subject = group.getSubject()
self.groups[room] = Group(room, owner, subject, subjectOwner, self.groups[room] = Group(room, owner, subject, subjectOwner,
self.backend, self.user) self.backend, self.user)
# add/update room participants # add/update room participants
@ -276,7 +276,7 @@ class Session(YowsupApp):
def onTextMessage(self, _id, _from, to, notify, timestamp, participant, def onTextMessage(self, _id, _from, to, notify, timestamp, participant,
offline, retry, body): offline, retry, body):
buddy = _from.split('@')[0] buddy = _from.split('@')[0]
messageContent = utils.softToUni(body) messageContent = body
self.sendReceipt(_id, _from, None, participant) self.sendReceipt(_id, _from, None, participant)
self.recvMsgIDs.append((_id, _from, participant, timestamp)) self.recvMsgIDs.append((_id, _from, participant, timestamp))
self.logger.info("Message received from %s to %s: %s (at ts=%s)" % self.logger.info("Message received from %s to %s: %s (at ts=%s)" %
@ -436,7 +436,7 @@ class Session(YowsupApp):
room = group.getGroupId() room = group.getGroupId()
owner = group.getCreatorJid(full = False) owner = group.getCreatorJid(full = False)
subjectOwner = group.getSubjectOwnerJid(full = False) subjectOwner = group.getSubjectOwnerJid(full = False)
subject = utils.softToUni(group.getSubject()) subject = group.getSubject()
self.groups[room] = Group(room, owner, subject, subjectOwner, self.backend, self.user) self.groups[room] = Group(room, owner, subject, subjectOwner, self.backend, self.user)
self.groups[room].addParticipants(group.getParticipants(), self.buddies, self.legacyName) self.groups[room].addParticipants(group.getParticipants(), self.buddies, self.legacyName)

View file

@ -28,7 +28,6 @@ import traceback
import logging import logging
import asyncore import asyncore
import sys, os import sys, os
import e4u
import Queue import Queue
import transWhat.threadutils import transWhat.threadutils
@ -79,8 +78,6 @@ def handleTransportData(data):
logger = logging.getLogger('transwhat') logger = logging.getLogger('transwhat')
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
e4u.load()
closed = False closed = False
def connectionClosed(): def connectionClosed():
global closed global closed

View file

@ -21,7 +21,6 @@ __email__ = "post@steffenvogel.de"
along with transWhat. If not, see <http://www.gnu.org/licenses/>. along with transWhat. If not, see <http://www.gnu.org/licenses/>.
""" """
import e4u
import base64 import base64
import hashlib import hashlib
@ -42,9 +41,6 @@ def ago(secs):
return "%d %s ago" % (diff, period) return "%d %s ago" % (diff, period)
def softToUni(message):
return e4u.translate(message.encode("utf-8"), reverse=False, **e4u.SOFTBANK_TRANSLATE_PROFILE)
def decodePassword(password): def decodePassword(password):
return base64.b64decode(bytes(password)) return base64.b64decode(bytes(password))