EionRobb / purple-mattermost

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

no pasted images in chat #77

Open AlexeyGusev opened 6 years ago

AlexeyGusev commented 6 years ago

this might be a pidgin-issue and not a mattermost-plugin issue, but I will report it here anyway.

You can see pasted images with mattermost' own client in a chat, but pidgin displays only empty line followed by another line containing <a href=". Pasted graphics is not displayed.

jaroslawp commented 5 years ago

it is likely plugin issue: the code tries to put in the URL of the file but seems to fail: does it happen to all pasted files in your setup or only some ?

AlexeyGusev commented 5 years ago

No, I just see this in chat:

(12:28:35) some-buddy:  
(12:28:35) some-buddy: <a href="

when somebody sends me a image, gif or jpeg – doesn't matter.

jaroslawp commented 5 years ago

It looks like we get (not properly handled) empty reply from MM server: does your server allow public file links ?.

I just got image handling reimplemented (plugin allows now to send/receive images) here: https://github.com/EionRobb/purple-mattermost/commit/ea49f1c0507bc0c4e48b8146dc5e411531a1526c (disclaimer: this is really untested code, works for me with libpurple2, have not tried with 3 ...).

AlexeyGusev commented 5 years ago

It looks like we get (not properly handled) empty reply from MM server: does your server allow public file links ?

Don't really know how to answer :) What is a public file link? In browser chat, however, image URL looks like this: https://<MM_SERVER_HOSTNAME>/api/v4/files/hn6hzafszig7ukj73eghhqashe/preview, right-clicked on image to copy image URL in firefox.

jaroslawp commented 5 years ago

The public links are a way of getting file contents while not using MM client - do not require authentication or any specific protocol (just plain http): https://docs.mattermost.com/administration/config-settings.html#public-links (that feature is disabled by default on MM server)

I have implemented checking for public links server capability (plus server info, slash commands capability) here: https://github.com/EionRobb/purple-mattermost/commit/a64a9b475ae821900323f5e4020fee9b9590d2fd this could tell us more about the problem: you should see error and in 'Accounts' -> 'your account' -> 'Server info' some detailed information about MM server and enabled features.

AlexeyGusev commented 5 years ago

downloaded, built and installed https://github.com/EionRobb/purple-mattermost/commit/a64a9b475ae821900323f5e4020fee9b9590d2fd

'Accounts' -> 'your account' -> 'Server info' shows:

Server Version: 5.2.0 (we upgraded yesterday from 4 to 5) Slash commands: enabled Public file links: enabled Build number: 5.2.2

still no images in pidgin chat window (wonder if pidgin can display images at all?), but instead of

(12:28:35) some-buddy:  
(12:28:35) some-buddy: <a href="

I see just

(12:28:35) some-buddy:  
(12:28:35) some-buddy:

now. In logs, this might be of interest (from pidgin --debug output):

(10:05:31) GLib-GObject: value "-1777675255" of type 'gint' is invalid or out of range for property 'weight' of type 'gint'

(10:06:04) mattermost: got errno 11, read_len 0 from websocket thread

next one is slightly offtopic, but I will report it here anyway:

(10:05:31) log: Failed to open log file "/home/<USER>/.purple/logs/some-buddy.log" for reading: No such file or directory

in fact, logs are placed into /home/\<USER>/.purple/logs/mattermost//some-buddy/\<TIMESTAMP>.html