EionRobb / purple-mattermost

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

Pidgin shows Mattermost users offline #49

Open barthel opened 7 years ago

barthel commented 7 years ago

The Mattermost plugin shows the online status of all Mattermost user as offline but the Mattermost Web-UI shows different online status.

Pidgin 2.10.12 (libpurple 2.10.12)
Plugin Information
Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.06.30.git.2d04e44
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes
buchty commented 7 years ago

Same here (1.1.2017.06.12) -- only one user is shown online, others offline despite being online (and signaled so via the official client).

jaroslawp commented 7 years ago

please run pidgin with --debug option: the debug log could show us more information about messages received from MM server.

barthel commented 7 years ago

@jaroslawp Hm. There A LOT of sensitive data. :-( Did you have a pattern you are looking for?

barthel commented 7 years ago

My environment:

Linux XXXXXXX 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

That's strange:

(07:57:09) log: Failed to open log file "/home/XXXXX/.purple/logs/XXXXX.log" for reading: No such file or directory
(07:57:09) Trillian log list: Reading /mnt/windows/Program Files/Trillian/users/default/logs/MATTERMOST/XXXXX.log
(07:57:09) Trillian log list: Reading /mnt/windows/Program Files/Trillian/users/default/logs/MATTERMOST/Query/XXXXX.log

/home/XXXXX/.purple/logs/XXXXX.log isn't the right place for MM conversation logs. It is /home/XXXXX/.purple/logs/mattermost/XXXXXXX/XXXXXX/XXXXX.log instead.

barthel commented 7 years ago

It seems I'm online: 474 (08:06:56) mattermost: got frame data: {"event":"status_change","data":{"status":"online","user_id":"daik1r7o1fy7byu18zarh8fgrc"},"broadcast":{"omit_users":null,"user_id":"daik1r7o1fy7byu18zarh8fgrc","channel_id":"","team_id":""}

If I go offline there is no request to MM server for signaling this status change.

   1224 (08:20:10) account: Disconnecting account XXXXX (0x559a533668e0)
   1225 (08:20:10) connection: Disconnecting connection 0x559a5417f6b0
...
   1287 (08:20:10) connection: Destroying connection 0x559a5417f6b0
   1289 (08:20:10) pidgin-libnotify: Updating status set from pidgin to 'offline'
jaroslawp commented 7 years ago

The message above is one you receive from MM server, indeed we do not signal it going offline - but the server notices it anyway.

As for other users statuses: buddy/chat client/server has been reworked in the code (merged on 26.06: https://github.com/EionRobb/purple-mattermost/pull/42) so may not work for @buchty (please rebuild new version from current code) but it should for @barthel (also: could you please rebuild new version from current code).

I would suggest stopping pidgin, moving away blist.xml (~/.purple/blist.xml usually on linux ) and starting it again with new plugin version to see if the problem still happens (note: if you use multiple accounts: buddies/chats for these accounts will 'disappear' since all info is stored in blist.xml)

barthel commented 7 years ago

The issue persists with:

Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.07.06.git.90dc0ea
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes

I cleaned all mattermost entries from blist.xml but it doesn't change anything.

barthel commented 7 years ago

@jaroslawp May I have to explain my environment a bit deeper.

I'm not root on my Linux machine and I've no rights to install the plugin globally.

The mattermost .so file is copied into my local plugin directory (~/.purple/plugins/). But the protocol image I can't copy into /usr/share/pixmaps/pidgin/protocols/. Every time I interact with mattermost users the following error is thrown:

(11:32:05) gtkutils: gdk_pixbuf_new_from_file() returned nothing for file /usr/share/pixmaps/pidgin/protocols/16/mattermost.png: Failed to open file '/usr/share/pixmaps/pidgin/protocols/16/mattermost.png': No such file or directory
(11:32:05) GLib-GObject: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
(11:32:05) GLib-GObject: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
(11:32:05) GLib-GObject: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
(11:32:05) GLib-GObject: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
(11:32:05) GLib-GObject: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
(11:32:05) GLib-GObject: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
(11:32:05) Gdk: IA__gdk_window_set_icon_list: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(11:32:05) GdkPixbuf: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(11:32:05) GdkPixbuf: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(11:32:05) GdkPixbuf: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(11:32:05) GdkPixbuf: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(11:32:05) GdkPixbuf: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(11:32:05) GdkPixbuf: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

Maybe the wrong status is a aftereffect of the missing image?

barthel commented 7 years ago

@jaroslawp @EionRobb Could I provide some more information to bring this issue on the way?

barthel commented 7 years ago

This issue persists with:

Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.08.09.git.4524538
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes

after merged #58 (Multi team).

robertwbrandt commented 7 years ago

I'm very eager to help with this project! And from what I've seem so far you have done amazing work! Mattermost is itself just IM on steroids (which I'm sure someone will have issue with) but one glaring oversight is that they don't support native XMPP which would be the ideal solution. However, the Mattermost Web and Mobile App take care of those platforms, leaving only the desktop, which your project does cover. I am testing with both a Ubuntu 16.04 and Windows 7 Desktops. I have the latest Pidgin on each and downloaded the latest purple-mattermost I could for each client. However here is where I have my first problem my Ubuntu is slightly newer then my windows client. Does anyone know how to update my windows client with the latest and greatest release (preferably without compiling the code on Windows)?

On Ubuntu 16:

Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.08.22.git.4524538
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes

On Windows 7:

Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.04.28.git.r89+........
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes

And I'm still having the problem where the status of Mattermost users in Pidgin show as offline. I also found that if I have both Ubuntu and Windows clients (logged in with the same user) the pidgin user shows up as away in Mattermost. However if I have just one client running, it reports fine in Mattermost.

I've noticed a number of other little things which either already have tickets raised or I will create one. Is there a forum for feature requests? Or should I just raise a ticket for those?

Anyway, great work!!!

barthel commented 7 years ago

This issue persists with:

Pidgin 2.10.12 (libpurple 2.10.12)

on Ubuntu Linux and:

Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.10.20.git.d6aa4dd
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes

@jaroslawp @EionRobb I would like to support this project. Which information could I provide information to solve this issue?

jaroslawp commented 7 years ago

the debug log should show us the full communication between server and client: but yes it does contain a lot o private data ... so before posting it here you should try care of sanitizing it: user status is read from server on pidgin startup then will be updated via the websocket messages if changed.

It can be that you have lot of users/channels in your list and when client starts we hammer the server too much and our requests are throttled down: currently we did not implement retries or throttling handling ... if this is the case you should see in debug log messages alike these ones: https://api.mattermost.com/#tag/rate-limiting

barthel commented 7 years ago

I've 5 active/subscribed channels and in these channels are around 60 unique users.

I'll generate a log file but it takes a while to pseudonymised the personal data.

The first search for "https://api.mattermost.com/#tag/rate-limiting" found no results.

Jellyfrog commented 7 years ago

Same problem here. hard to send logdata, but i've checked the json return data and none of them return any status, as far as i know only /v3/users/status returns this info, but I cant find any calls to it.

Mattermost: Version: 4.2.0
Pidgin: 2.12.0 (libpurple 2.12.0)
Mattermost
    Author: Eion Robb <eion@robbmob.com>
    Version: 1.1.2017.10.26.git.d6aa4dd
    Website: https://github.com/EionRobb/mattermost-libpurple
    ID String: prpl-eionrobb-mattermost
    Loadable: Yes
    Loaded: Yes
cmeerw commented 6 years ago

My understanding is that mattermost doesn't have any presence update notifications (the web UI seems to periodically refresh the status), see a89c12b52c1fabb73267223d2f761f8d261d8814 for some a simple way to periodically updating the status.

Jellyfrog commented 6 years ago

Maybe @jaroslawp could chip in now that he ported to api v4, seems there is no calls to /v4/users/status, where the webclient reads status from at least.

jaroslawp commented 6 years ago

User statuses are requested from server via websocket: that should already work for current V3 implementation as well as ongoing V4 ( in mm_refresh_statuses)

Jellyfrog commented 6 years ago

User statuses are requested from server via websocket: that should already work for current V3 implementation as well as ongoing V4 ( in mm_refresh_statuses)

I've never seen this work in that case, all users are always offline in the contact list. The official client checks periodically here; https://github.com/mattermost/mattermost-webapp/blob/03f611c4fe3c05eca1cd10b26a6b386b9fa035ae/actions/status_actions.jsx#L112

matterhorn does the same; https://github.com/matterhorn-chat/matterhorn/blob/b3c2abbd4e43afed2ea9e110e2767241d76ec312/src/State/Setup/Threads.hs#L46-L72

jaroslawp commented 6 years ago

OK, I have added now periodic check (every 270 seconds when we refresh our own status): https://github.com/EionRobb/purple-mattermost/commit/477159bfa10190a100f41978408cde15f8767715 (disclaimer: this is really untested code, works for me with libpurple2, have not tried with 3 ...).

Jellyfrog commented 6 years ago

Thanks for your great work! I've tested the latest commit (c33c2d8), and sadly they are all still marked as offline: image I can see the request to POST /api/v4/users/status/ids HTTP/1.1 And the response:

[
  {
    "user_id": "djrcmfu4cjr1zkq8aep5xv5zje",
    "status": "away",
    "manual": false,
    "last_activity_at": 1537370043342
  },
  {
    "user_id": "t582bbid578iu6tbga5g3cs25y",
    "status": "online",
    "manual": false,
    "last_activity_at": 1537425578717
  },
  ..........
]

Using Pidgin 2.13.0 (libpurple 2.13.0)

jaroslawp commented 6 years ago

I'm really little bit lost here .. we obviously receive replies for status updates not sure why it does not work for you: just an idea - since I have been changing information in ~/.purple/blist.xml -while experimenting .. there is a chance you have a broken data there: can you move away the blist.xml file and try again with lastest master ?

Jellyfrog commented 6 years ago

@jaroslawp moved ~/.purple/blist.xml, no change. I've checked a couple of users and their User ID is also in the response from the server, but still offline.

Pidgin 2.13.0 (libpurple 2.13.0)

Mattermost Version: 1.1.2018.09.24.git.c457d9c

Info for Mattermost Server Server Version: 4.10.0