stv0g / transwhat

A gateway between the XMPP and the WhatsApp IM networks
https://dev.0l.de/wiki/projects/transwhat/
GNU General Public License v3.0
122 stars 25 forks source link

Messages are not sent to groups #81

Open Megver83 opened 7 years ago

Megver83 commented 7 years ago

Hi, when I send a message to a group, no one receives it. From my client, it looks like it was sent, but no one receives it (as I said). However, I can see messages, so IDK what could be the issue and the solution.

afish commented 6 years ago

I have the same issue. I tried two clients (Pidgin and Miranda NG), both of them can join the chat room and receive messages in it, but my messages do not get delivered to other Whatsapp users. Below is a piece of XML communication:

Joining chatroom:

<presence to="48123123123-1231231231@whatsapp.server/resource">
<priority>5</priority>
<x xmlns="http://jabber.org/protocol/muc" />
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://miranda-ng.org/caps" ver="FRVQ6yERuJWzsxqnSCHGbLH3pLA=" ext="x86 mood activity mir_notes" />
<x xmlns="vcard-temp:x:update">
<photo />
</x>
<status></status>
</presence>
­
<presence from="48123123123-1231231231@whatsapp.server/resource" to="resource2@server/Miranda">
<status>14147682475</status>
<x xmlns="http://jabber.org/protocol/muc#user">
<status code="110" />
<item affiliation="member" role="participant" />
</x>
</presence>
­
<presence from="48123123123-1231231231@whatsapp.server/48123123123" to="resource2@server/Miranda">
<status>48123123123</status>
<x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="admin" role="moderator" />
</x>
</presence>
­
<message from="48123123123-1231231231@whatsapp.server/48123123123" to="resource2@server/Miranda" type="groupchat">
<subject>RoomName</subject>
</message>
­
<message from="48123123123-1231231231@whatsapp.server/ " to="resource2@server/Miranda" type="groupchat">
<composing xmlns="http://jabber.org/protocol/chatstates" />
</message>
­
<presence from="48123123123-1231231231@whatsapp.server/48123123123" to="resource2@server/Miranda">
<status>48123123123</status>
<x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="admin" role="moderator" />
</x>
</presence>

Message sent from Whatsapp client on Android (received correctly via transwhat):

<message from="48123123123-1231231231@whatsapp.server/John doe" to="resource2@server/Miranda" type="groupchat">
<body>From WA</body>
<delay xmlns="urn:xmpp:delay" stamp="2017-11-19T15:34:06Z" />
</message>

Message sent from Miranda to transhwat - doesn't appear on Whatsapp client:

<message id="z3ql8s3eo" to="48123123123-1231231231@whatsapp.server" type="groupchat">
<body>To WA</body>
</message>
­
<message from="48123123123-1231231231@whatsapp.server/resource" to="resource2@server/Miranda" type="groupchat">
<body>To WA</body>
</message>

Help would be very appreciated. Also if you could just dump the correct XML requests to send message to any group chat I would be happy because I am writing my own bot so I can hardcode them directly instead of relying on XMPP library.

vitalyster commented 6 years ago

missing <x xmlns="http://jabber.org/protocol/muc" /> in outgoing message?

afish commented 6 years ago

Didn't help, this doesn't work:

<message id="fevcx51cxf" to="48123123123-1231231231@whatsapp.server" type="groupchat">
<body>To WA</body>
<x xmlns="http://jabber.org/protocol/muc" />
</message>
vitalyster commented 6 years ago

what is in backend.log?

Megver83 commented 6 years ago

what is in backend.log?

My account is in a public node (jabjab.de) which looks like the admin disabled, or removed, transwhat :S https://jabjab.de/status.php

afish commented 6 years ago

The log is below. Are you able to dump some correct XML communication? I can test it in Miranda to see whether this is client related.

2017-11-19 15:34:09,526 INFO Session: Message sent from 14147682475 to 48123123123-1231231231: To WA (xhtml=)
2017-11-19 15:34:09,699 ERROR transwhat: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/transwhat-0.2.2-py2.7.egg/transWhat/transwhat.py", line 107, in main
    asyncore.loop(timeout=1.0, count=10, use_poll = True)
  File "/usr/local/lib/python2.7/asyncore.py", line 220, in loop
    poll_fun(timeout, map)
  File "/usr/local/lib/python2.7/asyncore.py", line 201, in poll2
    readwrite(obj, flags)
  File "/usr/local/lib/python2.7/asyncore.py", line 123, in readwrite
    obj.handle_error()
  File "/usr/local/lib/python2.7/asyncore.py", line 108, in readwrite
    obj.handle_read_event()
  File "/usr/local/lib/python2.7/asyncore.py", line 449, in handle_read_event
    self.handle_read()
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/network/layer.py", line 102, in handle_read
    self.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/network/layer.py", line 110, in receive
    self.toUpper(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 29, in receive
    self.processReceived()
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived
    self.toUpper(oneMessageData)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/auth/layer_crypt.py", line 65, in receive
    self.toUpper(payload)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/coder/layer.py", line 35, in receive
    self.toUpper(node)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/logger/layer.py", line 14, in receive
    self.toUpper(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/axolotl/layer_control.py", line 44, in receive
    self.toUpper(protocolTreeNode)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 79, in toUpper
    self.__upper.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 194, in receive
    s.receive(data)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/axolotl/layer_send.py", line 64, in receive
    if not self.processIqRegistry(protocolTreeNode):
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/__init__.py", line 161, in processIqRegistry
    successClbk(protocolTreeNode, originalIq)
  File "/usr/local/lib/python2.7/site-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/axolotl/layer_send.py", line 215, in sendToGroup
    jids.remove(ownJid)
ValueError: list.remove(x): x not in list
vitalyster commented 6 years ago

So, transwhat is crashing and that is why message not sent

afish commented 6 years ago

Cool. Any idea why it crashes?

nicolas-it commented 6 years ago

Maybe this https://github.com/tgalal/yowsup/pull/2084 helps...

afish commented 6 years ago

It did help, thanks!