EionRobb / purple-mattermost

A libpurple/Pidgin plugin for Mattermost
GNU General Public License v3.0
93 stars 23 forks source link

room/channel history lost #76

Open AlexeyGusev opened 6 years ago

AlexeyGusev commented 6 years ago

It is possible to write to a subscribed channel and see responses while the window is open. Closing the channel (chat) window and reopening it again will end up in lost history — this is obviously not as desired, contents should be automatically filled in when the room is open (either full history or some period/size, perhaps adjustable in settings). The same happens after pidgin restart - room history is lost.

jaroslawp commented 6 years ago

This should be fixed in upcoming V4 API version (https://github.com/EionRobb/purple-mattermost/tree/v4api_try1 - still needs some bugs to be fixed before release..)

EionRobb commented 6 years ago

Have you also tried adding the chat to your buddy list and marking it as "persistent" and/or "auto-join"?

AlexeyGusev commented 6 years ago

yes, chats are marked as persistent and auto-join, but this doesn't help. Closing the window kills chat history, reopening that chat results in empty window.

jaroslawp commented 6 years ago

Please retry with v4api_try1 branch again and let me know if that is fixed now ?

AlexeyGusev commented 6 years ago

no, this is not fixed at least in 0e126dd68264ed5ad489dbb99bcd3da317e986f2 history is still often not displayed on startup and is always not displayed after chat has been closed/reopen

AlexeyGusev commented 6 years ago

might be useful: I see this in logs (pidgin --debug):

(12:21:31) mattermost: Fetching url https://<HOST_NAME>/api/v4/channels/zubx5o6ek7g9zgrjqffyhmahco
(12:21:31) util: requesting to fetch a URL
(12:21:31) dnsquery: Performing DNS lookup for <HOST_NAME>
(12:21:31) g_log: purple_conversation_get_chat_data: assertion 'conv != NULL' failed
(12:21:31) g_log: serv_got_joined_chat: assertion 'name != NULL' failed
(12:21:31) g_log: purple_conversation_get_chat_data: assertion 'conv != NULL' failed
(12:21:31) g_log: purple_conversation_set_data: assertion 'conv != NULL' failed
<previous line repeated 5 times>
(12:21:31) g_log: purple_conversation_present: assertion 'conv != NULL' failed
jaroslawp commented 6 years ago

OK, I've made some cleanup in that part of code, can you try this branch ? :

https://github.com/EionRobb/purple-mattermost/tree/cleanup-1

(please move away ~/.purple/blist.xml again before trying)

This branch seems to work for me: for auto-joined channels I get the history automatically, for other: I get it when I open a channel: that is read once - still only 60 first posts since last time client viewed, then it should be saved in pidgin logs.

AlexeyGusev commented 6 years ago

tried version b9bcf62876a0c0f548c347af7934e559ff9bfe5f

open any public or private room - and you get a virgin white empty window for that channel :( I don't understand why this happens but sometimes – after a relatively long period of pidgin being down – the channels come open full of recent history, but only immediately after pidgin startup. If the room window is closed and open again, it's empty. Could this actually be some setting on the server side…

another annoyance is that if someone writes to a channel, that channel's chat window will pop up with the written message (but no previous history) – this, IMHO, should not happen, but the message sent to the channel by someone should be displayed when the user opens that channel window. Closing this window and opening it later will render a white empty chat window again.

jaroslawp commented 6 years ago

Thanks for testing !

History:

Yes on initial startup without a ~/.purple/blist.xml the plugin assumes that all channels have been read 'now' so there is no history to fetch.

On subsequent startups plugin reads last time channel was viewed from blist.xml and fetches (only 60) messages on the channel starting at that time.

If you close the conversation window and open it again within same pidgin session it should show all conversations in that window.

If you exit pidgin and open it again the conversation window will be empty (if no new messages appeared on channel in mean time) but you can access past messages via Conversation -> View Log menu. .. this is how it seems to work for me now ?

The window popping up when somebody writes to the channel: Yes, I guess this could be implemented differently than it is now (also we seem to have additional bug somewhere in there: if a chat is marked as non-persistent and window is closed it will not reopen on new messages as expected but for some reason when reopened manually history which is read from server is not displayed in it ...).

AlexeyGusev commented 6 years ago

On subsequent startups plugin reads last time channel was viewed from blist.xml and fetches (only 60) messages on the channel starting at that time.

Yes, it seems to be so.

If you close the conversation window and open it again within same pidgin session it should show all conversations in that window.

Not for rooms/channels, those are reopened empty, no conversations at all.

If you exit pidgin and open it again the conversation window will be empty (if no new messages appeared on channel in mean time) but you can access past messages via Conversation -> View Log menu. .. this is how it seems to work for me now ?

Correct, but I can only access history for buddy conversations; for rooms, neither channel name, channel ID nor team ID fits search criteria for «Buddies → View User Log…» menu. Even more interesting, by right-clicking on a room and selecting «View Log» from appearing menu, I only see some history until Aug 16, and for channels that were created later, there is no history. Is this because some newer plugin versions stopped writing history for rooms?

AlexeyGusev commented 4 years ago

any chance this isuue will be fixed at some point? 021d1990d76c26a5a0bff231717b45f7e5aab337 still does not retrieve history from server.

JacenBoy commented 3 years ago

Still seems to be an issue; messages sent since the last time the client was online seem to be pulled in, but the rest of the channel history is not.