Ticket #127 (new enhancement)

Opened 5 years ago

Last modified 5 years ago

Better paste support

Reported by: melo Owned by:
Priority: normal Milestone: Future
Component: GUI Version: version 0.8
Keywords: Cc:

Description

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.

A solution

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.

Change History

Changed 5 years ago by dbcm

I like the first and last options. The last one is a bit problematic, you will be depending on other service the we don't control. We can implement the first one and see how is goes.

Changed 5 years ago by melo

Yes, the last one is tricky, but we would let the user choose from a couple of services.

Personally, I would like to host a paste service under SAPO brand with a std API :).

It could bring some page-views back to the Portal ;)

The middle option, the pill-shaped object, its just GUI stuff. It would show a light-blue pill like the one used in the SMS address box.

Changed 5 years ago by dbcm

SAPO having a pastebot is "easy". I already did something like it for Codebits. We can do a better one with colors and fancy things.

Note: See TracTickets for help on using tickets.