[jitsi-dev] [PATCH] Support message correction for messages with smilies and newlines


#1

Hey devs, Yana,

I've attached a small patch to add support for proper editing of messages
with smilies and newline characters, and a couple of small refactorings.
It's implemented as we discussed off-list - by saving the original message
as an attribute to the div tag and then simply retrieving it.

It also fixes the positioning of the cursor when editing a message - now
it's displayed after the last character.

Sorry for the huge delay, but I kept finding some small but annoying and
hard to fix bugs.

I hope most things work fine now.

Cheers,
Ivan

smilies.patch (16.8 KB)


#2

Hi Ivan,

Hey devs, Yana,

I've attached a small patch to add support for proper editing of messages with smilies and newline characters, and a couple of small refactorings. It's implemented as we discussed off-list - by saving the original message as an attribute to the div tag and then simply retrieving it.

It also fixes the positioning of the cursor when editing a message - now it's displayed after the last character.

Sorry for the huge delay, but I kept finding some small but annoying and hard to fix bugs.

I hope most things work fine now.

The patch works perfectly for me and I've just committed it in revision 10068. Thanks for the hard work!!

It's also ack-ed on our Team&Contributors page.

Cheers,
Yana

···

On Nov 14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:

Cheers,
Ivan
<smilies.patch>


#3

Hey Ivan, Yana,

I think we introduced an issue with this one. I am occasionally seeing
html tags for my outgoing messages, especially when copying content from
a web page. Part of the text also seems duplicated.

Here's one example example, I wrote the following:

  Here's one ref www.google.com/ipv6/statistics.html

And after sending it, appeared as:

<BR
&#10;<PLAINTEXT></PLAINTEXT><A

href="http://www.google.com/ipv6/statistics.html">www.google.com/ipv6/statistics.html</A><PLAINTEXT>'
style="color:#8e8e8e">Here's one ref www.google.com/ipv6/statistics.html

The remote party got it in the latter, scrambled form.

Note that the link "www.google.com/ipv6/statistics.html" was text that I
copied from a web page so it probably went into the clipboard with some
formatting that was eventually transferred into Jitsi.

Do you think you could have a look?

Thanks,
Emil

···

On 19.11.12, 12:17, Yana Stamcheva wrote:

Hi Ivan,

On Nov 14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:

Hey devs, Yana,

I've attached a small patch to add support for proper editing of messages with smilies and newline characters, and a couple of small refactorings. It's implemented as we discussed off-list - by saving the original message as an attribute to the div tag and then simply retrieving it.

It also fixes the positioning of the cursor when editing a message - now it's displayed after the last character.

Sorry for the huge delay, but I kept finding some small but annoying and hard to fix bugs.

I hope most things work fine now.

The patch works perfectly for me and I've just committed it in revision 10068. Thanks for the hard work!!

It's also ack-ed on our Team&Contributors page.

Cheers,
Yana

Cheers,
Ivan
<smilies.patch>

--
https://jitsi.org


#4

Hey Emil,

Thanks for the nice bug report, I'll try to reproduce and fix this.

It was already on my todo-list, but it's been kinda full lately.

Ivan

···

On Wed, Nov 28, 2012 at 7:58 PM, Emil Ivov <emcho@jitsi.org> wrote:

Hey Ivan, Yana,

I think we introduced an issue with this one. I am occasionally seeing
html tags for my outgoing messages, especially when copying content from
a web page. Part of the text also seems duplicated.

Here's one example example, I wrote the following:

  Here's one ref www.google.com/ipv6/statistics.html

And after sending it, appeared as:

><BR
>&#10;<PLAINTEXT></PLAINTEXT><A
href="http://www.google.com/ipv6/statistics.html">
www.google.com/ipv6/statistics.html</A><PLAINTEXT>'
style="color:#8e8e8e">Here's one ref www.google.com/ipv6/statistics.html

The remote party got it in the latter, scrambled form.

Note that the link "www.google.com/ipv6/statistics.html" was text that I
copied from a web page so it probably went into the clipboard with some
formatting that was eventually transferred into Jitsi.

Do you think you could have a look?

Thanks,
Emil

On 19.11.12, 12:17, Yana Stamcheva wrote:
> Hi Ivan,
>
> On Nov 14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> > wrote:
>
>> Hey devs, Yana,
>>
>> I've attached a small patch to add support for proper editing of
messages with smilies and newline characters, and a couple of small
refactorings. It's implemented as we discussed off-list - by saving the
original message as an attribute to the div tag and then simply retrieving
it.
>>
>> It also fixes the positioning of the cursor when editing a message -
now it's displayed after the last character.
>>
>> Sorry for the huge delay, but I kept finding some small but annoying
and hard to fix bugs.
>>
>> I hope most things work fine now.
>
> The patch works perfectly for me and I've just committed it in revision
10068. Thanks for the hard work!!
>
> It's also ack-ed on our Team&Contributors page.
>
> Cheers,
> Yana
>
>>
>> Cheers,
>> Ivan
>> <smilies.patch>
>
>

--
https://jitsi.org


#5

Hi guys,

I'm attaching a patch that fixes the issue for me. It's fairly trivial, we
just didn't escape all the HTML characters.

Cheers,
Ivan

fixEscapeHtml.patch (635 Bytes)

···

On Wed, Nov 28, 2012 at 8:07 PM, Ivan Vergiliev <ivan.vergiliev@gmail.com>wrote:

Hey Emil,

Thanks for the nice bug report, I'll try to reproduce and fix this.

It was already on my todo-list, but it's been kinda full lately.

Ivan

On Wed, Nov 28, 2012 at 7:58 PM, Emil Ivov <emcho@jitsi.org> wrote:

Hey Ivan, Yana,

I think we introduced an issue with this one. I am occasionally seeing
html tags for my outgoing messages, especially when copying content from
a web page. Part of the text also seems duplicated.

Here's one example example, I wrote the following:

  Here's one ref www.google.com/ipv6/statistics.html

And after sending it, appeared as:

><BR
>&#10;<PLAINTEXT></PLAINTEXT><A
href="http://www.google.com/ipv6/statistics.html">
www.google.com/ipv6/statistics.html</A><PLAINTEXT>'
style="color:#8e8e8e">Here's one ref www.google.com/ipv6/statistics.html

The remote party got it in the latter, scrambled form.

Note that the link "www.google.com/ipv6/statistics.html" was text that I
copied from a web page so it probably went into the clipboard with some
formatting that was eventually transferred into Jitsi.

Do you think you could have a look?

Thanks,
Emil

On 19.11.12, 12:17, Yana Stamcheva wrote:
> Hi Ivan,
>
> On Nov 14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> >> wrote:
>
>> Hey devs, Yana,
>>
>> I've attached a small patch to add support for proper editing of
messages with smilies and newline characters, and a couple of small
refactorings. It's implemented as we discussed off-list - by saving the
original message as an attribute to the div tag and then simply retrieving
it.
>>
>> It also fixes the positioning of the cursor when editing a message -
now it's displayed after the last character.
>>
>> Sorry for the huge delay, but I kept finding some small but annoying
and hard to fix bugs.
>>
>> I hope most things work fine now.
>
> The patch works perfectly for me and I've just committed it in revision
10068. Thanks for the hard work!!
>
> It's also ack-ed on our Team&Contributors page.
>
> Cheers,
> Yana
>
>>
>> Cheers,
>> Ivan
>> <smilies.patch>
>
>

--
https://jitsi.org


#6

Hey

If I look at that method it barely cries for other characters that are going to appear in that list. Can't we use Apache's commons-lang library for HTML encoding? It's OSGi-Ready and should therefore be fairly simple to include.

String escaped = StringEscapeUtils.escapeHtml3(stringToEscape);

Regards,
Ingo

···

-----Original Message-----
From: Ivan Vergiliev [mailto:ivan.vergiliev@gmail.com]
Sent: Donnerstag, 29. November 2012 16:05
To: Emil Ivov
Cc: dev@jitsi.java.net; Yana Stamcheva
Subject: [jitsi-dev] Re: [PATCH] Support message correction for messages with
smilies and newlines
Hi guys,

I'm attaching a patch that fixes the issue for me. It's fairly trivial, we
just didn't escape all the HTML characters.

Cheers,
Ivan

On Wed, Nov 28, 2012 at 8:07 PM, Ivan Vergiliev > <ivan.vergiliev@gmail.com> wrote:

  Hey Emil,

  Thanks for the nice bug report, I'll try to reproduce and fix this.

  It was already on my todo-list, but it's been kinda full lately.

  Ivan

  On Wed, Nov 28, 2012 at 7:58 PM, Emil Ivov <emcho@jitsi.org> wrote:

    Hey Ivan, Yana,

    I think we introduced an issue with this one. I am occasionally seeing
    html tags for my outgoing messages, especially when copying content
from a web page. Part of the text also seems duplicated.

    Here's one example example, I wrote the following:

      Here's one ref www.google.com/ipv6/statistics.html

    And after sending it, appeared as:

    ><BR
    >&#10;<PLAINTEXT></PLAINTEXT><A

  href="http://www.google.com/ipv6/statistics.html">www.google.com/ipv6/
statistics.html</A><PLAINTEXT>' style="color:#8e8e8e">Here's one ref
www.google.com/ipv6/statistics.html

    The remote party got it in the latter, scrambled form.

    Note that the link "www.google.com/ipv6/statistics.html" was
text that I
    copied from a web page so it probably went into the clipboard
with some
    formatting that was eventually transferred into Jitsi.

    Do you think you could have a look?

    Thanks,
    Emil

    On 19.11.12, 12:17, Yana Stamcheva wrote: > Hi Ivan, > > On Nov
14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:
    > >> Hey devs, Yana, >> >> I've attached a small patch to add
support for proper editing of messages with smilies and newline
characters, and a couple of small refactorings. It's implemented as we
discussed off-list - by saving the original message as an attribute to
the div tag and then simply retrieving it. >> >> It also fixes the
positioning of the cursor when editing a message - now it's displayed
after the last character. >> >> Sorry for the huge delay, but I kept
finding some small but annoying and hard to fix bugs. >> >> I hope
most things work fine now. > > The patch works perfectly for me and
I've just committed it in revision 10068. Thanks for the hard work!! >
    > It's also ack-ed on our Team&Contributors page. > > Cheers, >
Yana > >> >> Cheers, >> Ivan >> <smilies.patch> > >

    --
    https://jitsi.org


#7

Hey Ingo,

I looked into this method as well, however I don't think we need to escape
the rest of the characters. I added the last two to complete the list from
OWASP<https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content>
.

Also, quoting from w3: "Character references are numeric or symbolic names
for characters that may be included in an HTML document. They are useful
for referring to rarely used characters, or those that authoring tools make
it difficult or impossible to enter." (
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2) So my understanding
is that the only ones that have to be escaped are the ones that mights
confuse the parser that they are a part of a tag or attribute.

I also tried sending some of the other characters that could be escaped -
€ ® ¶ © ½, and they seem to work fine.

Ivan

···

On Thu, Nov 29, 2012 at 11:15 PM, Ingo Bauersachs <ingo@jitsi.org> wrote:

Hey

If I look at that method it barely cries for other characters that are
going to appear in that list. Can't we use Apache's commons-lang library
for HTML encoding? It's OSGi-Ready and should therefore be fairly simple to
include.

String escaped = StringEscapeUtils.escapeHtml3(stringToEscape);

Regards,
Ingo

> -----Original Message-----
> From: Ivan Vergiliev [mailto:ivan.vergiliev@gmail.com]
> Sent: Donnerstag, 29. November 2012 16:05
> To: Emil Ivov
> Cc: dev@jitsi.java.net; Yana Stamcheva
> Subject: [jitsi-dev] Re: [PATCH] Support message correction for messages
with
> smilies and newlines
> Hi guys,
>
> I'm attaching a patch that fixes the issue for me. It's fairly trivial,
we
> just didn't escape all the HTML characters.
>
> Cheers,
> Ivan
>
>
> On Wed, Nov 28, 2012 at 8:07 PM, Ivan Vergiliev > > <ivan.vergiliev@gmail.com> wrote:
>
>
> Hey Emil,
>
> Thanks for the nice bug report, I'll try to reproduce and fix this.
>
> It was already on my todo-list, but it's been kinda full lately.
>
>
> Ivan
>
>
> On Wed, Nov 28, 2012 at 7:58 PM, Emil Ivov <emcho@jitsi.org> > wrote:
>
>
> Hey Ivan, Yana,
>
> I think we introduced an issue with this one. I am
occasionally seeing
> html tags for my outgoing messages, especially when
copying content
> from a web page. Part of the text also seems duplicated.
>
> Here's one example example, I wrote the following:
>
> Here's one ref www.google.com/ipv6/statistics.html
>
> And after sending it, appeared as:
>
> ><BR
> >&#10;<PLAINTEXT></PLAINTEXT><A
>
> href="http://www.google.com/ipv6/statistics.html">
www.google.com/ipv6/
> statistics.html</A><PLAINTEXT>'
style="color:#8e8e8e">Here's one ref
> www.google.com/ipv6/statistics.html
>
> The remote party got it in the latter, scrambled form.
>
> Note that the link "www.google.com/ipv6/statistics.html"
was
> text that I
> copied from a web page so it probably went into the
clipboard
> with some
> formatting that was eventually transferred into Jitsi.
>
> Do you think you could have a look?
>
> Thanks,
> Emil
>
>
> On 19.11.12, 12:17, Yana Stamcheva wrote: >
Hi Ivan, > > On Nov
> 14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:
> > >> Hey devs, Yana, >>
     >> I've attached a small patch to add
> support for proper editing of messages with smilies and newline
> characters, and a couple of small refactorings. It's implemented as we
> discussed off-list - by saving the original message as an attribute to
> the div tag and then simply retrieving it. >> >>
It also fixes the
> positioning of the cursor when editing a message - now it's displayed
> after the last character. >> >> Sorry for the
huge delay, but I kept
> finding some small but annoying and hard to fix bugs. >>
             >> I hope
> most things work fine now. > > The patch works
perfectly for me and
> I've just committed it in revision 10068. Thanks for the hard work!!
     >
> > It's also ack-ed on our Team&Contributors page.
      > > Cheers, >
> Yana > >> >> Cheers, >>
Ivan >> <smilies.patch> > >
>
>
> --
> https://jitsi.org
>
>
>


#8

Hey Ivan,

Thanks!

Your patch is now part of revision 10117 and ack-ed on our contributor's page. I couldn't easily reproduce the issue before applying the patch, so I can't confirm it fixes the problem for me, but we'll just give it a try :slight_smile:

Cheers,
Yana

···

On Nov 29, 2012, at 10:04 PM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:

Hi guys,

I'm attaching a patch that fixes the issue for me. It's fairly trivial, we just didn't escape all the HTML characters.

Cheers,
Ivan

On Wed, Nov 28, 2012 at 8:07 PM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:
Hey Emil,

Thanks for the nice bug report, I'll try to reproduce and fix this.

It was already on my todo-list, but it's been kinda full lately.

Ivan

On Wed, Nov 28, 2012 at 7:58 PM, Emil Ivov <emcho@jitsi.org> wrote:
Hey Ivan, Yana,

I think we introduced an issue with this one. I am occasionally seeing
html tags for my outgoing messages, especially when copying content from
a web page. Part of the text also seems duplicated.

Here's one example example, I wrote the following:

  Here's one ref www.google.com/ipv6/statistics.html

And after sending it, appeared as:

><BR
>&#10;<PLAINTEXT></PLAINTEXT><A
href="http://www.google.com/ipv6/statistics.html">www.google.com/ipv6/statistics.html</A><PLAINTEXT>'
style="color:#8e8e8e">Here's one ref www.google.com/ipv6/statistics.html

The remote party got it in the latter, scrambled form.

Note that the link "www.google.com/ipv6/statistics.html" was text that I
copied from a web page so it probably went into the clipboard with some
formatting that was eventually transferred into Jitsi.

Do you think you could have a look?

Thanks,
Emil

On 19.11.12, 12:17, Yana Stamcheva wrote:
> Hi Ivan,
>
> On Nov 14, 2012, at 1:21 AM, Ivan Vergiliev <ivan.vergiliev@gmail.com> wrote:
>
>> Hey devs, Yana,
>>
>> I've attached a small patch to add support for proper editing of messages with smilies and newline characters, and a couple of small refactorings. It's implemented as we discussed off-list - by saving the original message as an attribute to the div tag and then simply retrieving it.
>>
>> It also fixes the positioning of the cursor when editing a message - now it's displayed after the last character.
>>
>> Sorry for the huge delay, but I kept finding some small but annoying and hard to fix bugs.
>>
>> I hope most things work fine now.
>
> The patch works perfectly for me and I've just committed it in revision 10068. Thanks for the hard work!!
>
> It's also ack-ed on our Team&Contributors page.
>
> Cheers,
> Yana
>
>>
>> Cheers,
>> Ivan
>> <smilies.patch>
>
>

--
https://jitsi.org

<fixEscapeHtml.patch>