hoehermann / purple-gowhatsapp

Pidgin/libpurple plugin for WhatsApp Web.
GNU General Public License v3.0
276 stars 34 forks source link

Pidgin opening multiple windows after being disconnected for a while #163

Closed 82MHz closed 10 months ago

82MHz commented 1 year ago

When I start pidgin with purple-gowhatsapp after a few days of not using it, it loads all the messages that my phone received in the meantime, which results in startup taking quite a while and pidgin opening multiple windows (including dozens of dialog boxes for voice notifications, received videos etc.).

Is this desired behaviour or a bug, or do I simply have it misconfigured?

hoehermann commented 1 year ago

This is intentional. The client (Pidgin) is supposed do display all the messages your account has received.

Maybe there is a flag somewhere which means "message has already been seen on another device". If we can find it, I could add an option to ignore seen messages.

82MHz commented 1 year ago

That's a lot of methods! The closest I found with a few minutes of looking through it is this:

https://pkg.go.dev/go.mau.fi/whatsmeow@v0.0.0-20230603164718-6ce745d7990a/binary/proto#WebMessageInfo.GetStatusAlreadyViewed

There you could check if a message was already viewed. Don't know if this is of use though, I'm not familiar enough with your code or pidgins code...

hoehermann commented 1 year ago

I am not familiar with my code either. Thank you for looking up the field. I want to find out how to access it and give it a try. :)

82MHz commented 1 year ago

I've been a developer for 15 years, I know what you mean ;)

Thanks for giving it a shot!

hoehermann commented 1 year ago

It looks like WebMessageInfo.GetStatusAlreadyViewed is not something we can use for this feature. The WhatsApp protocol makes a difference between "historical messages" (sent before scanning the QR code) and "real-time messages" (sent after scanning the QR code). WebMessageInfo is only used for historical messages. Real-time messages (even those received delayed) are of type Message which do not contain that method. :(

How about a filter that discards all messages older than a configurable amount of minutes?

82MHz commented 11 months ago

Oh damn, I thought I answered you... in fact I'm pretty sure, but the answer doesn't show up here, so apparently it wasn't sent? Anyway, sorry for the silence! What I said in my answer was a filter would be great, but don't feel obligated to put one in just for me! If it fits your vision for the software, then great, if not then that's fine too, I'm still happily using the plugin regardless ;)