From 41030d5499b994a248053882aeb84abb70a942a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 6 Jan 2016 19:56:30 +0100 Subject: [PATCH 1/3] fix for messages only containing whitespaces --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 631d82a..2555fcb 100644 --- a/bot.py +++ b/bot.py @@ -45,7 +45,7 @@ class Bot(): args = message.strip().split(" ") cmd = args.pop(0) - if cmd[0] == '\\': + if len(cmd) > 0 and cmd[0] == '\\': try: self.call(cmd[1:], args) except KeyError: From dc3033c81195bae13cc622d65355c5f66fa78376 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 23 Feb 2016 09:09:27 +0100 Subject: [PATCH 2/3] added systemd unit --- contrib/spectrum@.service | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 contrib/spectrum@.service diff --git a/contrib/spectrum@.service b/contrib/spectrum@.service new file mode 100644 index 0000000..24f5806 --- /dev/null +++ b/contrib/spectrum@.service @@ -0,0 +1,11 @@ +[Unit] +description=spectrum2 whatsapp +After=network.target + +[Service] +ExecStart=/usr/bin/spectrum2 --no-daemonize -j whatsapp.example.com --config /etc/spectrum2/transports/whatsapp.cfg +Restart=always +User=spectrum2 + +[Install] +WantedBy=multi-user.target From 4643bb433d6201bcaf89e2c9a113a757a1e88efa Mon Sep 17 00:00:00 2001 From: moyamo Date: Thu, 24 Mar 2016 10:49:29 +0200 Subject: [PATCH 3/3] Patch YowAxoltolLayer to fix padding problems These changes should be reverted when yowsup updates. --- yowsupwrapper.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/yowsupwrapper.py b/yowsupwrapper.py index 048ba98..3a88938 100644 --- a/yowsupwrapper.py +++ b/yowsupwrapper.py @@ -45,9 +45,38 @@ from functools import partial #from session import MsgIDs +# Temporarily work around yowsup padding bugs with new protocol +class UpdatedYowAxolotlLayer(YowAxolotlLayer): + def decodeInt7bit(self, string): + idx = 0 + while ord(string[idx]) >= 128: + idx += 1 + consumedBytes = idx + 1 + value = 0 + while idx >= 0: + value <<= 7 + value += ord(string[idx]) % 128 + idx -= 1 + return value, consumedBytes + + def unpadV2Plaintext(self, v2plaintext): + end = -ord(v2plaintext[-1]) # length of the left padding + length,consumed = self.decodeInt7bit(v2plaintext[1:]) + return v2plaintext[1+consumed:end] + +# Temporary env until yowsup updates +class UpdatedS40YowsupEnv(env.S40YowsupEnv): + _VERSION = "2.13.39" + _OS_NAME= "S40" + _OS_VERSION = "14.26" + _DEVICE_NAME = "302" + _MANUFACTURER = "Nokia" + _TOKEN_STRING = "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk{phone}" + _AXOLOTL = True + class YowsupApp(object): def __init__(self): - env.CURRENT_ENV = env.S40YowsupEnv() + env.CURRENT_ENV = UpdatedS40YowsupEnv() layers = (YowsupAppLayer, YowParallelLayer((YowAuthenticationProtocolLayer, @@ -65,7 +94,7 @@ class YowsupApp(object): YowProfilesProtocolLayer, YowGroupsProtocolLayer, YowPresenceProtocolLayer)), - YowAxolotlLayer, + UpdatedYowAxolotlLayer, YowCoderLayer, YowCryptLayer, YowStanzaRegulator,