hoehermann / purple-gowhatsapp

Pidgin/libpurple plug-in for WhatsApp Web.
GNU General Public License v3.0
283 stars 35 forks source link

No groupchats shown in Bitlbee #77

Closed jumper047 closed 2 years ago

jumper047 commented 3 years ago

I have an issue with groupchats in Btilbee - I don't see no messages coming from groupchats. As far as I understand they are just regular chats from purple perspective, so I supposed they should work as one-to-one chats. Groupchat messages presents in whatsapp/logs though.

jumper047 commented 3 years ago

Some more info - groupchats are listed in my contacts, i can send message to it (and it appears in chat), but I don't see any replies

hoehermann commented 3 years ago

So it is working in Pidgin? I do not use bitlbee myself. Maybe someone of the other bitlbee users can help out.

yourealwaysbe commented 3 years ago

I am running into the same error. I have a running theory that it's because the group chats appear to be modelled as contacts. Perhaps we can only see our own messages in these chats because the other messages are from people who are not the group chat contact (or in the room)?

At any rate, if i mangle libgowhatsapp.c and set on line 340 (in the gowhatsapp_display_message function)

    flags |= PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_REMOTE_SEND | PURPLE_MESSAGE_DELAYED;

then the missing messages do arrive through bitlbee. They don't come through in the group chat though, but in the private chat with the user who sent them or in the main bitlbee control channel.

Will continue to faff in the coming days, will let you know if i make any progress. Let me know if there's any useful info that might guide me.

hoehermann commented 3 years ago

Let me know if there's any useful info that might guide me.

https://github.com/fancypantalons/ added proper group chats for the signald plug-in: https://github.com/hoehermann/libpurple-signald/blob/master/groups.c Allegedly, it works for bitlbee. It is close to 1000 lines of code. I was like "nah, not worth the effort for whatsapp". I won't do it, but pull requests are welcome. :)

yourealwaysbe commented 3 years ago

It is close to 1000 lines of code.

Ouch!

yourealwaysbe commented 3 years ago

I've been playing with groupchats in a "work in progress" branch.

Fortunately groupchats are not 1000 lines, at least in their current basic form. When delivering a message, I am checking the remoteJid. If it ends in "@g.us", then a new method gowhatsapp_find_group_chat is called instead of gowhatsapp_find_conversation. This is a fairly short method that creates a PurpleConvChat and adds the sending user to it. Then there is a little adjustment to the logic in gowhatsapp_display_message.

It broadly works in BitlBee. I am having issues with messages being delivered before the conversation exists (so they appear in the control channel). This is both for individual and group messages. It is either because i'm not calling something properly or there's some concurrency issues. So, still a work in progress, but looks promising so far. I'll keep picking away at it, but am not going to rush to have it completed.

hoehermann commented 2 years ago

Your code has been, with changes, found its way into the whatsmeow re-write and is working fine. :)

In case the problem pops up again, feel free to re-open this issue.