------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=133995
Summary: [patch] greedy matching for emoticons
Product: kopete
Version: unspecified
Platform: Compiled Sources
OS/Version: Linux
Status: UNCONFIRMED
Severity: wishlist
Priority: NOR
Component: general
AssignedTo: kopete-devel kde org
ReportedBy: juventuz2000 yahoo com
Version: 0.12.2 (using KDE Devel)
Installed from: Compiled sources
Compiler: gcc 4.1.1
OS: Linux
Kopete's emoticon parsing is not greedy. This means that :s will be parsed over
:strong:, which is not the behavior that users expect. I discovered this
problem when testing this emoticon theme:
http://www.kde-look.org/content/show.php?content=43094 (which incidentally is
good for testing, because of the number of emoticons and emoticon strings it
contains).
Now with regards to implementation, this is how Kopete parses emoticons.. In
kopete/libkopete/private/kopeteemoticons.cpp, in the function tokenize(), it
reads the message letter by letter and tries to match on emoticons. If it
matches the first letter of any emoticon, it then traverses a list of emoticons
(which matched the first letter) and simply picks the first one that matches.
So if :s is listed before :strong:, :s will be the emoticon displayed and
that's it.
There are two fairly obvious ways to fix this. One is to hack tokenize() to
find more than one match, and then to use the longest one. And this would
complicate tokenize() somewhat. So another solution, possibly simpler, is to
streamline the data (the list of emoticons) so that they are sorted from
longest to shortest. This will ensure that matches are always greedy. My patch
does exactly this.
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel