Ticket #127 (new enhancement)
Better paste support
|Reported by:||melo||Owned by:|
The current situation
Right now, if a message contains a \n we assume its a paste and show that as pre-formatted text.
This causes problems with bots that send notifications, like Jaiku, Twitter, and Destakes.
Instead, we should tag pastes with a custom namespace, and only use the pre-formatted version if the message uses this new protocol.
It would work like this:
If a client pastes some code into the input area of a chat window, we would send the following:
<message to="contact@domain" type="chat"> <body>full text of the input area, including the paste, compatible with any client out there</body> <paste xmlns="pt.sapo.leapfrog.paste" /> </message>
This would signal other clients supporting the pt.sapo.leapfrog.paste protocol to show the message as a pre-formatted text.
A slight improvement
Instead of pasting the full text in the input chat window, insert a pill-shaped object like the ones Mail.app uses for email addresses in the To/Cc box. This pill-shaped object represents the paste content.
This alllows us to send a message like this:
<message to="contact@domain" type="chat"> <body>full text of the input area, including the paste, compatible with any client out there</body> <p:paste xmlns:p="pt.sapo.leapfrog.paste"> <p:message>user typed message</p:message> <p:content>paste content</p:content> </p:paste> </message>
An excellent improvement
Not quite happy with that, we can do better.
Create a preference pane option, with a number of URLs for paste services like the Pastie.
A checkbox would mark the paste as automatic, but right-click on the pill-box would have a checkbox "Paste to 'service name'". Other options could be "Paste now and preview", and "Send only URL" which would paste to the webservice and send only the URL via SAPO Messenger.
In terms of protocol, it would become like this:
<message to="contact@domain" type="chat"> <body>just the part the user typed: http://pastie.caboo.se/139518 </body> <p:paste xmlns:p="pt.sapo.leapfrog.paste"> <p:message>user typed message</p:message> </p:paste> <x xmlns='jabber:x:oob'> <url>http://pastie.caboo.se/139518</url> <desc>Paste available at Pastie service</desc> </x> </message>
Notice the lack of <p:content />. The user, via rigth-click the pill-box and choosing "Send only URL" (or a preference pane setting the max paste amount), choose not to include the paste in the message. Note the standard <body /> also does not include the full paste text.
The jabber:x:oob is the standard XEP-0066 protocol.