Merge branch 'yowsup-2' into develop
This commit is contained in:
commit
22e5419cda
2
bot.py
2
bot.py
|
@ -45,7 +45,7 @@ class Bot():
|
||||||
args = message.strip().split(" ")
|
args = message.strip().split(" ")
|
||||||
cmd = args.pop(0)
|
cmd = args.pop(0)
|
||||||
|
|
||||||
if cmd[0] == '\\':
|
if len(cmd) > 0 and cmd[0] == '\\':
|
||||||
try:
|
try:
|
||||||
self.call(cmd[1:], args)
|
self.call(cmd[1:], args)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
11
contrib/spectrum@.service
Normal file
11
contrib/spectrum@.service
Normal file
|
@ -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
|
|
@ -55,6 +55,25 @@ from functools import partial
|
||||||
|
|
||||||
#from session import MsgIDs
|
#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
|
# Temporary env until yowsup updates
|
||||||
class UpdatedS40YowsupEnv(env.S40YowsupEnv):
|
class UpdatedS40YowsupEnv(env.S40YowsupEnv):
|
||||||
_VERSION = "2.13.39"
|
_VERSION = "2.13.39"
|
||||||
|
@ -85,7 +104,7 @@ class YowsupApp(object):
|
||||||
YowProfilesProtocolLayer,
|
YowProfilesProtocolLayer,
|
||||||
YowGroupsProtocolLayer,
|
YowGroupsProtocolLayer,
|
||||||
YowPresenceProtocolLayer)),
|
YowPresenceProtocolLayer)),
|
||||||
YowAxolotlLayer,
|
UpdatedYowAxolotlLayer,
|
||||||
YowCoderLayer,
|
YowCoderLayer,
|
||||||
YowCryptLayer,
|
YowCryptLayer,
|
||||||
YowStanzaRegulator,
|
YowStanzaRegulator,
|
||||||
|
|
Loading…
Reference in a new issue