yowsup icon indicating copy to clipboard operation
yowsup copied to clipboard

Missing arguments on Axolotl's layer.py

Open Dl0tt opened this issue 11 years ago • 4 comments

in /layers/axolotl/layer.py on line 116:

    def onEncryptNotification(self, protocolTreeNode):
        entity = EncryptNotification.fromProtocolTreeNode(protocolTreeNode)
        ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification", protocolTreeNode["type"]) #<-- Here
        self.toLower(ack.toProtocolTreeNode())
        self.sendKeys(fresh=False, countPreKeys = self.__class__._COUNT_PREKEYS - entity.getCount())

The ack appears to be missing the _to argument as specified in layers/protocol_acks/protocolentities/ack_outgoing.py's init:

    def __init__(self, _id, _class, _type, _to, _participant = None):
        super(OutgoingAckProtocolEntity, self).__init__(_id, _class)
        self.setOutgoingData(_type, _to, _participant)

So, when I get this:

DEBUG:yowsup.layers.logger.layer:rx:
<notification retry="1" from="s.whatsapp.net" t="1438887707" offline="1" type="encrypt" id="1359230797">
<count value="0">
</count>
</notification>

It crashes with:

Traceback (most recent call last):
  File "run.py", line 113, in start
    stack.loop( timeout = 0.5, discrete = 0.5 )
  File "build/bdist.linux-i686/egg/yowsup/stacks/yowstack.py", line 167, in loop
    asyncore.loop(*args, **kwargs)
  File "/usr/lib/python2.7/asyncore.py", line 216, in loop
    poll_fun(timeout, map)
  File "/usr/lib/python2.7/asyncore.py", line 156, in poll
    read(obj)
  File "/usr/lib/python2.7/asyncore.py", line 87, in read
    obj.handle_error()
  File "/usr/lib/python2.7/asyncore.py", line 83, in read
    obj.handle_read_event()
  File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
    self.handle_read()
  File "build/bdist.linux-i686/egg/yowsup/layers/network/layer.py", line 73, in handle_read
    self.receive(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/network/layer.py", line 80, in receive
    self.toUpper(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/__init__.py", line 55, in toUpper
    self.__upper.receive(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/stanzaregulator/layer.py", line 28, in receive
    self.processReceived()
  File "build/bdist.linux-i686/egg/yowsup/layers/stanzaregulator/layer.py", line 48, in processReceived
    self.toUpper(oneMessageData)
  File "build/bdist.linux-i686/egg/yowsup/layers/__init__.py", line 55, in toUpper
    self.__upper.receive(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/auth/layer_crypt.py", line 63, in receive
    self.toUpper(payload)
  File "build/bdist.linux-i686/egg/yowsup/layers/__init__.py", line 55, in toUpper
    self.__upper.receive(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/coder/layer.py", line 35, in receive
    self.toUpper(node)
  File "build/bdist.linux-i686/egg/yowsup/layers/__init__.py", line 55, in toUpper
    self.__upper.receive(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/logger/layer.py", line 14, in receive
    self.toUpper(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/__init__.py", line 55, in toUpper
    self.__upper.receive(data)
  File "build/bdist.linux-i686/egg/yowsup/layers/axolotl/layer.py", line 106, in receive
    self.onEncryptNotification(protocolTreeNode)
  File "build/bdist.linux-i686/egg/yowsup/layers/axolotl/layer.py", line 118, in onEncryptNotification
    ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification", protocolTreeNode["type"])
TypeError: __init__() takes at least 5 arguments (4 given)

It also happens with yowsup-cli with --moxie argument

Dl0tt avatar Aug 07 '15 02:08 Dl0tt

I received the same errors. Furthermore i changed the line 116 in yowsup/layers/axolotl/layer.py

to: ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification", protocolTreeNode["type"], entity.getFrom())

This seems to work, but i am not quite sure if i did the right thing

janboll avatar Aug 07 '15 05:08 janboll

I did the same, but with protocolTreeNode["from"] and it also seems to be working, still not sure if its the right thing to do.

-------- Original Message -------- From:janboll [email protected] Sent:Fri, 07 Aug 2015 02:26:43 -0300 To:tgalal/yowsup [email protected] Cc:Daniel [email protected] Subject:Re: [yowsup] Missing arguments on Axolotl's layer.py (#987)

I received the same errors. Furthermore i changed the line 116 in yowsup/layers/axolotl/layer.py

to: ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification", protocolTreeNode["type"], entity.getFrom())

This seems to work, but i am not quite sure if i did the right thing

— Reply to this email directly or view it on GitHub.

Dl0tt avatar Aug 07 '15 11:08 Dl0tt

@Dl0tt @janboll both are correct, would you like to submit a pull request?

tgalal avatar Aug 07 '15 12:08 tgalal

Fixed in 77330b81b3e16304bafb0a95e0c7ea4b5a70ce6a

tgalal avatar Aug 08 '15 16:08 tgalal