[Telepathy] Showing actual image in chat window

Xavier Claessens xclaesse at gmail.com
Wed Jun 27 03:24:27 PDT 2012


Le mercredi 27 juin 2012 à 15:26 +0530, Mithun Shitole a écrit :
> On Wed, May 2, 2012 at 1:12 PM, Danielle Madeley
> <danielle.madeley at collabora.co.uk> wrote:
> > On Wed, 2012-05-02 at 09:38 +0200, Guillaume Desmottes wrote:
> >
> >> If you just want to play with the code and try a quick hack, this
> >> shouldn't be hard to do by hacking the Adium theme code
> >> libempathy-gtk/empathy-theme-adium.c
> >> But of course you'll have to use an Adium theme to test.
> >
> > You could probably do this in Javascript in an Adium theme. Although
> > I've never tried to hit the network from an Adium theme.
> >
> 
> Thanks for the suggestion. I have successfully modified a adium theme
> to show images. It works great.
> You can find code here https://gist.github.com/3003033 .

That's an amazing idea! I've a few comments though:

1) Empathy ships a default template but each theme could ship their own.
So adding custom JS into the template is not a good idea, it won't apply
to all themes. The same idea is totally doable as C code in
empathy-theme-adium.c. We already have there code that parses messaege
to detect URL and transform them with a <a> tag. Must be trivial to
check if the URL already detected has ".jpg" suffix and then add an
<img> tag. The magic happens in empathy_string_replace_link() in
empathy-webkit-utils.c and empathy-string-parser.c.

2) You should add <a> tag as well, so clicking the image still open the
URL for full size.

3) max-width depends on the size of the chat window.

4) For video shouldn't you put <video> tag instead of <embed> ? I don't
know how that works...

5) Bonus point for supporting embedding youtube player!!!

6) I guess enabling that should be an option in empathy preferences.

Regards,
Xavier Claessens.



More information about the telepathy mailing list