EionRobb / purple-googlechat

A Google Chat protocol plugin for libpurple/Pidgin/bitlbee/whatever
GNU General Public License v3.0
112 stars 13 forks source link

Only mark conversations as seen when they have focus #17

Closed zyphlar closed 3 years ago

zyphlar commented 3 years ago

It looks like googlechat_mark_conversation_seen() is intended to mainly be called on line 372 of googlechat_events.c inside an if(purple_conversation_has_focus()) test, however that code path doesn't seem to be getting hit for me and instead it's primarily called via line 401 of libgooglechat.c as a direct callback of the conversation-updated event where there is no test for focus.

Unsure what the intent is (and weirdly conversation-updated doesn't seem to fire on sending a message, just receiving, so with this patch our user is often shown as not having seen their own last message) but this at least prevents the current behavior of overzealously marking everything as seen.

EionRobb commented 3 years ago

Excellent write-up :)

The conversation-updated signal was initially targeted for when the 'unseen' status from the UI is updated on the conversation (i.e. when you click on the tab/window then Pidgin/Finch/whatever will unset the PURPLE_CONVERSATION_UPDATE_UNSEEN)

So the intent is definitely to only trigger this code when you focus the tab/window after previously not having it focused.