Bug 15449

Summary: HTML: finish formatted text support
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-specAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: low CC: 84yelo3, david.regev, niya, tgpraveen89
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard: research needed
i915 platform: i915 features:

Description Guillaume Desmottes 2008-04-11 05:25:10 UTC
We need an interface on text channel to support formatted text.
I guess we'll implement it in Gabble using http://www.xmpp.org/extensions/xep-0071.html

The Empathy bug requesting this feature: http://bugzilla.gnome.org/show_bug.cgi?id=513176
Comment 1 Simon McVittie 2008-06-27 04:10:41 UTC
The Messages API draft and the TpMessageMixin branch implement a framework within which we can provide this feature. Capability discovery (finding out what subset of HTML we support) still needs writing.
Comment 2 Simon McVittie 2009-11-05 03:55:58 UTC
Since capability discovery is what's missing, the next step for this bug is to research various IM protocols and describe the subsets of HTML that they support. libpurple has an enum listing various subsets, which would be a good start.

This isn't currently being worked on, but would be great to have; if anyone reading this bug wants it to happen sooner, doing the research would be a great help.
Comment 3 Nicole Borrelli 2011-10-26 17:35:04 UTC
<i>This isn't currently being worked on, but would be great to have; if anyone
reading this bug wants it to happen sooner, doing the research would be a great
help.</i>

I dove into libpurple a little and I've discovered the following tags are supported:

a -- only "href" attribute
b -- converted to span style="font-weight: bold"
blockquote
body -- with "bgcolor=$BC" rewritten as [body][span style="background:$BC"]
bold -- converted to span style="font-weight: bold"
br
cite
div
em
font -- with "back=$BC", "color=$C", "face=$F", "size=$S" -- Only supports {xx-small, small, medium, large, x-large, xx-large} with values 1, 2, 3, 4, 5, 6&7 mapped respectively to those, as span style="background:$BC; color:$C font-family:$F; font-size:$S"
h1 through h6
hr -- Mapped automatically to "br"
html
i -- mapped to "em"
img -- with "src", "alt"
italic -- mapped to "em"
li
ol
p
pre
q
s -- converted to span style='text-decoration: line-through;'
script -- completely removed
span
strike -- converted to span style='text-decoration: line-through;'
strong -- converted to span style="font-weight: bold"
style -- completely removed
sub -- as span style='vertical-align:sub;'
sup -- as span style='vertical-align:super;'
td -- converted to a single tab
tr -- converted to '\n'
u -- converted to span style='text-decoration: underline;'
ul
underline -- converted to span style='text-decoration: underline;'

HTML comment is also supported.

Let me know if I can clarify anything here, or if I misunderstood what is needed.  The supported tags are most easily identified in the function libpurple/util.c:purple_markup_html_to_xhtml
Comment 4 Simon McVittie 2011-10-31 05:22:33 UTC
(In reply to comment #3)
> I dove into libpurple a little and I've discovered the following tags are
> supported
[...]

Most of the protocols supported by libpurple support a small subset of those tags (e.g. IRC can only do bold, underline and colours; and if I remember correctly, ICQ can only change foreground/background colour for an entire message at a time, but not for e.g. individual words or sentences). We need each connection manager to be able to describe what its protocol supports, so that UIs can hide or disable controls for formatting that doesn't exist in that protocol, to avoid misleading 

To describe those capabilities, someone will need to research what levels of support exist in real-world protocols, and someone (not necessarily the same someone) will need to design a way to represent those levels of support. I believe libpurple has a system of relatively simple flags, and each protocol has some of those flags - "can do bold", "can do colours for entire messages", "can do all of XHTML-IM"? We can probably do something similar.

The HTML interface also needs to discuss security considerations, I think (whitelist-based filtering for "safe" HTML is needed).
Comment 5 big.smile 2015-09-05 12:14:03 UTC
What is the actual status of formatted text support?
Comment 6 GitLab Migration User 2019-12-03 20:17:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-spec/issues/8.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.