Roundcube Community Forum

 

More robust emoticons matching

Started by LonelyPixel, October 11, 2011, 04:44:37 PM

Previous topic - Next topic

LonelyPixel

Hi,

I was just about to post this to Trac, but before I could figure out my password, its database decided to die. (Operational error, database is locked, or so.) So I'll try my luck here:

I have often noticed that emoticons show up in messages where they certainly do not belong. Since I had done such things several times before, I took a closer look at the emoticons plugin and modified it so that it only matches :) and the like if there are certain characters around it that make up some distance to the surrounding text. This way, you can more certainly tell that an emoticon was actually meant here. Especially 8) occurs very often in text and I need to know the complete number and see the closing parentheses instead of an incomplete number and a funny yellowish face wearing sunglasses.

I have attached my modified version of the file here.
[ATTACH=CONFIG]1772[/ATTACH]

It's taken from 0.6 release. Since you don't use Git, I didn't feel like I want to tinker with your source control. But I'm sure you can do the diff yourself quickly. Please tell me what you think of it, what I've done wrong and whether you find it useful. Take it and do whatever you want with it, it's yours.

LonelyPixel

Oh, I forgot the test case: (Let's see how good this forum is at correct emoticon matching...*)

This is a test :) line. <-- accept
This is a test:) line.
This is a test :)line.
This is a test:)line.
This is a test:).
This is a test :). <-- accept
This is a test ;) line. <-- accept
This is a test;) line.
This is a test ;)line.
This is a test;)line.
This is a test;).
What else? (This :-)) (;) not) <-- accept first only

*) It fails miserably with a random error. Needed to disable smileys for this post.