Aragur / yowsup

The python WhatsApp library
https://discord.gg/Wa7QSxZ
GNU General Public License v3.0
56 stars 22 forks source link

Broadcast not working #60

Open maus007 opened 6 years ago

maus007 commented 6 years ago

When try send broadcast message Some times ago in android env its work in s40 env not work What different beetwen s40 and android send ?


<iq xmlns="encrypt" id="27" to="s.whatsapp.net" type="get">
<key>
<user jid="1517259198585@broadcast">
</user>
</key>
</iq>

[connected]:DEBUG:yowsup.layers.logger.layer:rx:
<iq from="s.whatsapp.net" id="27" type="error">
<error code="406" text="not-acceptable">
</error>
</iq>

Traceback (most recent call last):
  File "/usr/local/bin/yowsup-cli", line 4, in <module>
    __import__('pkg_resources').run_script('yowsup2==2.5.2', 'yowsup-cli')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1504, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 384, in <module>
    if not parser.process():
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 284, in process
    self.startCmdline()
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/EGG-INFO/scripts/yowsup-cli", line 313, in startCmdline
    stack.start()
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/demos/cli/stack.py", line 27, in start
    self.stack.loop(timeout = 0.5, discrete = 0.5)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/stacks/yowstack.py", line 188, in loop
    asyncore.loop(*args, **kwargs)
  File "/usr/lib/python3.5/asyncore.py", line 203, in loop
    poll_fun(timeout, map)
  File "/usr/lib/python3.5/asyncore.py", line 150, in poll
    read(obj)
  File "/usr/lib/python3.5/asyncore.py", line 87, in read
    obj.handle_error()
  File "/usr/lib/python3.5/asyncore.py", line 83, in read
    obj.handle_read_event()
  File "/usr/lib/python3.5/asyncore.py", line 423, in handle_read_event
    self.handle_read()
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/network/layer.py", line 102, in handle_read
    self.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/network/layer.py", line 110, in receive
    self.toUpper(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/stanzaregulator/layer.py", line 29, in receive
    self.processReceived()
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived
    self.toUpper(oneMessageData)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/auth/layer_crypt.py", line 65, in receive
    self.toUpper(payload)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/coder/layer.py", line 35, in receive
    self.toUpper(node)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/logger/layer.py", line 14, in receive
    self.toUpper(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/axolotl/layer_control.py", line 44, in receive
    self.toUpper(protocolTreeNode)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 194, in receive
    s.receive(data)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/axolotl/layer_send.py", line 126, in receive
    if not self.processIqRegistry(protocolTreeNode):
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/__init__.py", line 163, in processIqRegistry
    errorClbk(protocolTreeNode, originalIq)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/axolotl/layer_base.py", line 81, in onError
    errorClbk(errorNode, getKeysEntity)
TypeError: <lambda>() takes 0 positional arguments but 2 were given```
pabloruan0710 commented 6 years ago

Hi @maus007 changed you file yowsup/layers/axolotl/layer_base.py, and rebuild you yowsup

Line 81:

def onError(errorNode, getKeysEntity):
        if errorClbk:
              # errorClbk(errorNode, getKeysEntity)
              errorClbk()

        entity = GetKeysIqProtocolEntity(jids)
        self._sendIq(entity, onSuccess, onError=onError)
Aragur commented 6 years ago

@pabloruan0710 Nice fix, but the problem is that the broadcast layer handles the callback wrongly.. So you aren't fixing the problem with your changes you are only moving the problem to another layer.