------- 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
ogoffart kde org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From ogoffart kde org 2006-09-15 22:14 -------
SVN commit 584918 by ogoffart:
Fix emoticon parsing if there are sub-emoticons.
BUG: 133995
Patch by Martin Matusiak, thanks.
M +18 -0 kopeteemoticons.cpp
M +6 -0 kopeteemoticons.h
--- branches/KDE/3.5/kdenetwork/kopete/libkopete/private/kopeteemoticons.cpp
#584917:584918
@ -48,6 +48,8 @
struct Emoticons::Emoticon
{
Emoticon(){}
+ /* sort by longest to shortest matchText */
+ bool operator< (const Emoticon &e){ return matchText.length() >
e.matchText.length(); }
QString matchText;
QString matchTextEscaped;
QString picPath;
@ -424,6 +426,7 @
node = node.nextSibling();
}
mapFile.close();
+ sortEmoticons();
}
@ -492,12 +495,27 @
node = node.nextSibling();
}
mapFile.close();
+ sortEmoticons();
}
+void Emoticons::sortEmoticons()
+{
+ /* sort strings in order of longest to shortest to provide convenient
input for
+ greedy matching in the tokenizer */
+ QValueList<QChar> keys = d->emoticonMap.keys();
+ for ( QValueList<QChar>::const_iterator it = keys.begin(); it !=
keys.end(); ++it )
+ {
+ QChar key = (*it);
+ QValueList<Emoticon> keyValues = d->emoticonMap[key];
+ qHeapSort(keyValues.begin(), keyValues.end());
+ d->emoticonMap[key] = keyValues;
+ }
+}
+
QMap<QString, QString> Emoticons::emoticonAndPicList()
{
return d->emoticonAndPicList;
--- branches/KDE/3.5/kdenetwork/kopete/libkopete/private/kopeteemoticons.h
#584917:584918
@ -156,6 +156,12 @
* see initEmoticons
*/
void initEmoticon_JEP0038( const QString & filename);
+
+ /**
+ * sorts emoticons for convenient parsing, which yields greedy matching
on
+ * matchText
+ */
+ void sortEmoticons();
struct Emoticon;
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel