hoehermann / purple-gowhatsapp

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

no whatsapp notification sound on my phone when pidgin is run #188

Open jeremyp3 opened 7 months ago

jeremyp3 commented 7 months ago

using whatsapp more these days with the plugin for pidgin, I've noticed that I don't get any sound in whatsapp notifications when pidgin is launched.

Is this something whatsapp wants to happen, and can it be fixed?

I'd like to point out that I do receive the notifications on my phone, just that there's no sound.

hoehermann commented 7 months ago

Another user reported similar issues. We suspect that WhatsApp tones down the "intensity" of notifications if there is another session active. The behaviour has changed from version to version and is different on iOS and Android. Can you set Pidgins state to "away" and check how that changes the behaviour for your setup?

jeremyp3 commented 7 months ago

I don't notice any change when switching to status away, except for the loss of contact refreshes. But notifications are still soundless on my phone :(

I deactivated / reactivated the plugin after setting pidgin to status away but nothing.

my phone runs on android :)

hoehermann commented 7 months ago

I, too, use Android devices. However, I cannot reproduce the behaviour. I am sorry. I am using WhatsApp 2.24.3.79 on my main phone and in the emulator for testing purposes. This is what happens for me:

The behaviour is consistent with having WhatsApp Web open instead of Pidgin. I assume this is by design and henceforth working as intended.

Please note that in Pidgin you can set an individual status for every account via the "saved status" feature.
Also, you may write ?presenceunavailable in any chat window to enable a special "hidden state" mode. It is a hack included specifically for a similar situation.

brianjmurrell commented 7 months ago

I'm seeing this same behavior. Even when I set pidgin to away explicitly I still get no notifications on my phone. Even with WhatsApp Web running on the same machine (with this plug-in disabled) I still get notifications on my phone when the computer session is idle so WhatsApp Web seems to be detecting idle state and enabling the notifications on the phone.

Does this plug-in do anything positive in terms of notifying WhatsApp that it's away when it gets the away event from pidgin? If not then it doesn't seem surprising that WhatsApp always considers the pidgin instance as active and suppresses the notifications elsewhere. Just a thought for investigation.

jeremyp3 commented 7 months ago

Hello,

to be more precise, in the module options in pidgin I checked: "send-receipt" as "on-interact".

so when I receive a message, the notification (without sound) is displayed on my phone, and disappears when I open the relevant conversation on pidgin

hoehermann commented 7 months ago

@brianjmurrell

Even when I set pidgin to away explicitly I still get no notifications on my phone.

That is indeed not intended behaviour, but I cannot reproduce the issue. It simply does not happen with my set-up, I am sorry. 😕

Does this plug-in do anything positive in terms of notifying WhatsApp that it's away when it gets the away event from pidgin?

Yes, that happens in gowhatsapp_set_presence. Save for the hack mentioned above, it is a simple forward.

@jeremyp3

when I receive a message, the notification (without sound) is displayed on my phone, and disappears when I open the relevant conversation on pidgin

That however is indeed the intended behaviour. The general idea is that you want to read a message only once: Either on the phone or Pidgin (WhatsApp Web), not both. Maybe one of the other send-receipt modes is more suitable for you? I like on-answer. 🙂

brianjmurrell commented 4 months ago

What is send-receipts exactly?

With native WhatsApp, there seems to be two receipts. One for when the message was delivered and one for when it was read.

[How] does send-receipts interact with either of those [exactly]?

jeremyp3 commented 4 months ago

in purple-go-whatsapp, "send-receipts" is used to change the message from distributed to read on the recipient's side

In my case, the "send-receipts" is set to "interaction with the conversation", so as long as I haven't opened the pidgin conversation, the message isn't marked as read by my recipient. That's why I don't understand why I don't have sound on my phone, but maybe that's normal whatsapp behavior...

brianjmurrell commented 4 months ago

What is the result of keeping a conversation tab open (but perhaps not focused because another tab is in focus) in the conversations window on Pidgin while, say, the screen is locked?

There are many different permutations here in fact:

I would suggest that the only time a conversation is marked read is when the conversation is open, focused and the screen is not locked. All other times the read flag is not set.

Perhaps When interacting with the conversation, or Never even are the only sane options for Send receipts.

I've set it to Never for the moment to see if I can get any sane behaviour from leaving the WhatsApp account logged into Pidgin[1] and still getting notifications elsewhere when away from my computer.

[1] At the moment, I have a hacky dbus monitoring script that actually completely logs me out of WhatsApp in Pidgin when my session goes idle. This seems to be the only reliable way of getting notifications on my phone when I am away from the computer. Granted I have not tried all of the Send receipts options yet, which is why I have swung the pendulum to the entire opposite direction with using Never.

hoehermann commented 4 months ago

I think we are talking about different things here:

Presence

WhatsApp presence corresponds to a Pidgin status:

I mapped AVAILABLE to available, AWAY to unavailable and OFFLINE to a disconnect function.

Presence is what controls whether you get a notification on your phone or not. For an extreme solution, you may configure Pidgin to disconnect from WhatsApp when your computer is idle (Settings → State/Idle).

Receipts

By default, Pidgin has no mechanism for receipts at all. There is some kind of "this conversation has a new message which you did not see yet" mechanism which I use for the on-interact option. From my experience, it tends to behave erratically. on-answer is more reliable since a message will only be marked as read when you actually reply.

If a message was marked as read, it will not be considered for a notification on your phone. I am quite sure it even removes a notification that is currently shown, but it will not "un-play" a sound. Other messages might still trigger a notification.