Browse Source

remove e4u dependency as it supports Python 2 only

yowsup-3
Steffen Vogel 3 years ago
parent
commit
d13c0205c8
  1. 6
      INSTALL.rst
  2. 1
      setup.py
  3. 2
      transWhat/buddy.py
  4. 6
      transWhat/session.py
  5. 3
      transWhat/transwhat.py
  6. 4
      transWhat/utils.py

6
INSTALL.rst

@ -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
which use WhatsApp service.
.. _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
.. _yowsup: https://github.com/tgalal/yowsup
.. _e4u: https://pypi.python.org/pypi/e4u

1
setup.py

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

2
transWhat/buddy.py

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

6
transWhat/session.py

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

3
transWhat/transwhat.py

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

4
transWhat/utils.py

@ -21,7 +21,6 @@ __email__ = "post@steffenvogel.de"
along with transWhat. If not, see <http://www.gnu.org/licenses/>.
"""
import e4u
import base64
import hashlib
@ -42,9 +41,6 @@ def ago(secs):
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):
return base64.b64decode(bytes(password))

Loading…
Cancel
Save