hoehermann / purple-gowhatsapp

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

[Question] Hiding/Disabling status@broadcast #122

Closed Penaz91 closed 2 years ago

Penaz91 commented 2 years ago

Greetings, first of all for making this plugin, it works like a charm.

There is a thing I'm not personally a fan of (but that's a Whatsapp thing), which is customizable user statuses.

Is there any way to disable the automatic retrieval and showing (which in pidgin comes up as "status@broadcast")?

Thanks in advance for your patience.

hoehermann commented 2 years ago

I saw these message exactly once in the entire time I developed this plug-in. I did not even realize what it was actually meant. Apparently, my contacts do not use status messages very often. I want to add an option for ignoring this sender.

hoehermann commented 2 years ago

@Penaz91 It seems I could use your help with this one. It looks like you need to use the camera to set a status. Unfortunately, none of my test devices has a working camera, so I cannot generate a status broadcast. If you could open Help → Debug Window, filter for whatsmeow. Wait for a status@broadcast message and copy the contents here. It should look like this:

[Handler] Received message: &events.Message{…}

Do not forget to remove any personal information. Or send the message verbatim at github@hehoe.de.

Penaz91 commented 2 years ago

I've got one:

(12:03:08) whatsmeow: [Client/Recv] <presence from="xxxxxxxxxxxx@s.whatsapp.net" last="1651485788" type="unavailable"/>
(12:03:08) whatsmeow: recieved presence (subtype 0) for account 0x55e658223820 remote xxxxxxxxxxxx@s.whatsapp.net (isGroup 0) sender (null) (alias (null), fromMe 0) sent 1651485788: (null)
(12:03:08) blist: Updating buddy status for xxxxxxxxxxxx@s.whatsapp.net (WhatsApp (whatsmeow))
(12:03:10) whatsmeow: [Client/Recv] <message from="status@broadcast" id="D7AEB6EC57A4689EF92BB0B8B43396B1" notify="<contact name>" participant="xxxxxxxxxxxx@s.whatsapp.net" t="1651485790" type="media"><enc type="pkmsg" v="2"><!-- 279 bytes --></enc><enc mediatype="image" type="skmsg" v="2"><!-- 1644 bytes --></enc></message>
(12:03:10) whatsmeow: [Client] Decrypting 2 messages from xxxxxxxxxxxx@s.whatsapp.net in status@broadcast
(12:03:10) whatsmeow: [Client/Send] <ack class="message" id="D7AEB6EC57A4689EF92BB0B8B43396B1" participant="xxxxxxxxxxxx@s.whatsapp.net" to="status@broadcast"/>
(12:03:10) whatsmeow: [Client] Processed sender key distribution message from xxxxxxxxxxxx:0 in status@broadcast
(12:03:10) whatsmeow: [Handler] Received message: &events.Message{Info:types.MessageInfo{MessageSource:types.MessageSource{Chat:types.JID{User:"status", Agent:0x0, Device:0x0, Server:"broadcast", AD:false}, Sender:types.JID{User:"xxxxxxxxxxxx", Agent:0x0, Device:0x0, Server:"s.whatsapp.net", AD:false}, IsFromMe:false, IsGroup:true, BroadcastListOwner:types.JID{User:"", Agent:0x0, Device:0x0, Server:"", AD:false}}, ID:"D7AEB6EC57A4689EF92BB0B8B43396B1", Type:"", PushName:"<contact name>", Timestamp:time.Date(2022, time.May, 2, 12, 3, 10, 0, time.Local), Category:"", Multicast:false, MediaType:"image", DeviceSentMeta:(*types.DeviceSentMeta)(nil)}, Message:(*proto.Message)(0xc0002f5800), IsEphemeral:false, IsViewOnce:false, RawMessage:(*proto.Message)(0xc0002f5800)}
(12:03:10) whatsmeow: [Handler] Received a message without any text.
(12:03:10) whatsmeow: [Handler] Received message: &events.Message{Info:types.MessageInfo{MessageSource:types.MessageSource{Chat:types.JID{User:"status", Agent:0x0, Device:0x0, Server:"broadcast", AD:false}, Sender:types.JID{User:"xxxxxxxxxxxx", Agent:0x0, Device:0x0, Server:"s.whatsapp.net", AD:false}, IsFromMe:false, IsGroup:true, BroadcastListOwner:types.JID{User:"", Agent:0x0, Device:0x0, Server:"", AD:false}}, ID:"D7AEB6EC57A4689EF92BB0B8B43396B1", Type:"", PushName:"<contact name>", Timestamp:time.Date(2022, time.May, 2, 12, 3, 10, 0, time.Local), Category:"", Multicast:false, MediaType:"image", DeviceSentMeta:(*types.DeviceSentMeta)(nil)}, Message:(*proto.Message)(0xc0002f5980), IsEphemeral:false, IsViewOnce:false, RawMessage:(*proto.Message)(0xc0002f5980)}
(12:03:10) whatsmeow: [Handler] Received a message without any text.
(12:03:11) whatsmeow: recieved attachment (subtype 1) for account 0x55e658223820 remote status@broadcast (isGroup 1) sender xxxxxxxxxxxx@s.whatsapp.net (alias xxxxxxxxxxxx_268321a9e28a5e2fc16f339993e95b0b2a2bd4b4bdf2d40aea6492f478ae0238.jpe, fromMe 0) sent 0: (null)
(12:03:11) whatsmeow: [Client/Send] <receipt id="D7AEB6EC57A4689EF92BB0B8B43396B1" participant="xxxxxxxxxxxx@s.whatsapp.net" to="status@broadcast"/>
(12:03:11) whatsmeow: [Client/Send] <iq id="32.192-478" to="g.us" type="get" xmlns="w:g2"><participating><participants/><description/></participating></iq>

Hope this helps!

hoehermann commented 2 years ago

Based on the info "Received a message without any text.", it looks like the plug-in cannot even display these status messages properly. I want to suppress them entirely.

Penaz91 commented 2 years ago

Based on the info "Received a message without any text.", it looks like the plug-in cannot even display these status messages properly. I want to suppress them entirely.

From what I can gather, Whatsapp status messages are just pictures, which also explains the "received attachment" message. I'm not sure if it's possible to filter by the from field, since all messages seem to arrive from "status@broadcast" (or are in a "status@broadcast" group of some sort)

vipincherian commented 2 years ago

@hoehermann, in case this is of any help. I have been able to weed out status broadcasts by closing conversations with title status@broadcast as soon as these are created (using a supplementary plugin).

static void
conversation_created_cb(PurpleConversation *conv, void *data)
{
    purple_debug_misc("signals test", "conversation-created (%s)\n",
        purple_conversation_get_name(conv));

    if(!strcmp(purple_conversation_get_name(conv), "status@broadcast"))
    {
        purple_debug_misc("signals test", "To be deleted\n");
        purple_conversation_destroy(conv);
    }

}