-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature-Request Allow pasting of clipboard images #210
Comments
Thank you for the suggestion. Indeed, it is possible to support this feature. Occasionally, I am annoyed by its absence, too. However, it is not as trivial to implement as one might think. Pidgin natively supports "rich" (styled) messages like just Teams does (and some other protocols including – but not limited to – ICQ). The images are actually in-lined into the message text like this:
WhatsApp (and other mobile messenger protocols including Signal and Telegram) can only send messages consisting of plain text (maybe with some styling applied). An image can be sent as an attachment that is being displayed next to the text, but not actually in-lined. When you send multiple images (with an optional caption), then the first message contains the text and one image. The other images are sent in subsequent text-less messages. I had a naive implementation which daftly extracted the images from the message and sent them in separate messages. On the receiver, the sample above ended up looking like this:
As you can see, the images were transferred, but displayed out of order. With a naive implementation that tries to send everything in one go, this can happen due to the asynchronous nature of the whatsmeow library. Also, the connection of which image is "this" or "that" is lost. Now don't get me wrong – it is totally possible to implement this in a reasonable manner. I could break up the text into a sequence of parts containing either a piece of the text or an image. Then I transfer the parts one by one, waiting for server-side acknowledgement each time, using a call-back to check the progress… Allowing only one image to be added to the text would alleviate the issue to some degree, but I do not know whether that is possible. Keep in mind that this would need to work for Spectrum and bitlbee, too. As you can see, it is rather involved to make the message appear to the receiver at least similar to how the sender prepared it. If we don't ensure that, the possibilities of misunderstandings are manifold. Instead of offering a problematic feature, I would rather not offer it at all. Rigorous testing is necessary. Maybe some day someone comes along and implements this. I will not do this for the foreseeable future. As always: Contributions are welcome. 🙂 On a side-note: The receiving end has pretty much the same issues, too: #209. |
Oh my! I didn't realize there was a kind of "impedence mismatch" there with the design of the way messages and images were sent. That is interesting, and working in IT (but with only script-hacking required in day-to-day programming tasks) I have grown accustomed to no easy solutions for things! Thanks for looking into it and feel free to close this if you don't want to leave open. |
EionRobb has a great plugin which works with his Teams plugin, that enables direct pasting of images into Pidgin: https://github.com/EionRobb/pidgin-paste-image
Was wondering if this could be made to work for WhatsApp conversations too?
The text was updated successfully, but these errors were encountered: