davidgfnet / whatsapp-purple

WhatsApp protocol implementation for libpurple (pidgin)
855 stars 211 forks source link

Received a message twice in groupchat #212

Closed dequis closed 9 years ago

dequis commented 9 years ago

It was the first message after connecting, so it's possible there was some lag.

I was running it with the debug output from PR #190 (which also means this is a whatsapp-purple from december, didn't reinstall since then) so I got this:

DEBUG prpl-whatsapp: processIncomingData: begin ------------------
DEBUG prpl-whatsapp: tag[message] attr_cnt=7 child_cnt=1 data=''
DEBUG prpl-whatsapp:   attr[from]=[otherphone-1422002497@g.us]
DEBUG prpl-whatsapp:   attr[id]=[1421896448-6]
DEBUG prpl-whatsapp:   attr[notify]=[dx]
DEBUG prpl-whatsapp:   attr[participant]=[otherphone@s.whatsapp.net]
DEBUG prpl-whatsapp:   attr[phash]=[1:g2Nf8gzY]
DEBUG prpl-whatsapp:   attr[t]=[1422003908]
DEBUG prpl-whatsapp:   attr[type]=[text]
DEBUG prpl-whatsapp:     tag[body] attr_cnt=0 child_cnt=0 data='eh'
DEBUG prpl-whatsapp: processIncomingData: end   ------------------
DEBUG prpl-whatsapp: Received message stanza...
DEBUG prpl-whatsapp: Received message type 0 from otherphone-1422002497 at 1422003908
DEBUG prpl-whatsapp: generateResponse: begin ------------------
DEBUG prpl-whatsapp: tag[receipt] attr_cnt=4 child_cnt=0 data=''
DEBUG prpl-whatsapp:   attr[id]=[1421896448-6]
DEBUG prpl-whatsapp:   attr[t]=[1]
DEBUG prpl-whatsapp:   attr[to]=[otherphone-1422002497@g.us]
DEBUG prpl-whatsapp:   attr[type]=[read]
DEBUG prpl-whatsapp: generateResponse: end   ------------------
DEBUG prpl-whatsapp: Got chat message from otherphone-1422002497: eh
DEBUG prpl-whatsapp: joining group group
DEBUG prpl-whatsapp: group info ID(otherphone-1422002497) SUBJECT(group) OWNER(otherphone)
DEBUG prpl-whatsapp: processIncomingData: begin ------------------
DEBUG prpl-whatsapp: tag[ack] attr_cnt=4 child_cnt=0 data=''
DEBUG prpl-whatsapp:   attr[class]=[receipt]
DEBUG prpl-whatsapp:   attr[from]=[otherphone-1422002497@g.us]
DEBUG prpl-whatsapp:   attr[id]=[1421896448-6]
DEBUG prpl-whatsapp:   attr[type]=[read]
DEBUG prpl-whatsapp: processIncomingData: end   ------------------
DEBUG prpl-whatsapp: processIncomingData: begin ------------------
DEBUG prpl-whatsapp: tag[message] attr_cnt=7 child_cnt=1 data=''
DEBUG prpl-whatsapp:   attr[from]=[otherphone-1422002497@g.us]
DEBUG prpl-whatsapp:   attr[id]=[1421896448-6]
DEBUG prpl-whatsapp:   attr[notify]=[dx]
DEBUG prpl-whatsapp:   attr[participant]=[otherphone@s.whatsapp.net]
DEBUG prpl-whatsapp:   attr[phash]=[1:g2Nf8gzY]
DEBUG prpl-whatsapp:   attr[t]=[1422003911]
DEBUG prpl-whatsapp:   attr[type]=[text]
DEBUG prpl-whatsapp:     tag[body] attr_cnt=0 child_cnt=0 data='eh'
DEBUG prpl-whatsapp: processIncomingData: end   ------------------
DEBUG prpl-whatsapp: Received message stanza...
DEBUG prpl-whatsapp: Received message type 0 from otherphone-1422002497 at 1422003911
DEBUG prpl-whatsapp: generateResponse: begin ------------------
DEBUG prpl-whatsapp: tag[receipt] attr_cnt=4 child_cnt=0 data=''
DEBUG prpl-whatsapp:   attr[id]=[1421896448-6]
DEBUG prpl-whatsapp:   attr[t]=[1]
DEBUG prpl-whatsapp:   attr[to]=[otherphone-1422002497@g.us]
DEBUG prpl-whatsapp:   attr[type]=[read]
DEBUG prpl-whatsapp: generateResponse: end   ------------------
DEBUG prpl-whatsapp: Got chat message from otherphone-1422002497: eh

(Replaced phone number of the other phone with "otherphone". The message body is indeed just "eh")

Dunno, does this help?

edit: needless to say, ultra minor bug.

davidgfnet commented 9 years ago

This happens to me on Official Whatsapp for android from time to time. I mean, once a week or so... And from what I see in the dump the message is actually sent twice. Of course the ID for that message is the same so I guess we should discard dup'ed messages, but in any case... BTW it happens to me in regular chats (not groups)

dequis commented 9 years ago

Oh, if it happens to the official client then meh, you can close this if you want.

(also pls apply the debug output pr, it's great to have it)

davidgfnet commented 9 years ago

Ok I'm closing this as we are not 100% sure whether this was a bug or not. The ID seems to be the same although the timestamp differs by 3 seconds. I'm not sure whether this is "a feature" or a bug in the whatsapp server.