tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.07k stars 2.23k forks source link

Contacts notifications some times don't contains "add" child node #389

Closed aesedepece closed 8 years ago

aesedepece commented 9 years ago

The following exception occurs when a notification with type="contacts" is received and it doesn't contain a "add" child node:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/data/waapi-api/Yowsup/connectionmanager.py", line 1077, in run
    contactJid = contactNode.getAttributeValue("jid")
AttributeError: 'NoneType' object has no attribute 'getAttributeValue'

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

aesedepece commented 9 years ago

The following stanza is OK because contains "add":

<notification type="contacts" offline="0" from="XXXXXXXXXXX@s.whatsapp.net" id="2503128210" t="1413157578">
    <add jid="XXXXXXXXXXX@s.whatsapp.net">
    </add>
</notification>

But this one isn't because contains "remove":

<notification type="contacts" offline="0" from="XXXXXXXXXXX@s.whatsapp.net" id="3659144665" t="1416268195">
    <remove jid="XXXXXXXXXXX@s.whatsapp.net">
    </remove>
</notification>
aesedepece commented 9 years ago

In addition, we still need to guess what we should answer to these notifications in order to acknowledge them and not been dropped from WhatsApp servers after a while with a TWO READER THREADS ON BOARD!! exception (this happens after notifications acks were disabled by 7fabc76956c7a653a58785c7fbb01597a2c8d4df)

Am I right, @tgalal ?