From: <er...@us...> - 2006-08-15 22:38:11
|
Author: erijo Date: Wed Aug 16 00:37:47 2006 New Revision: 4572 URL: http://svn.licq.org/viewvc/licq?rev=3D4572&view=3Drev Log: Fixed issue reported by Martin Garbe: If you have two smilies and both are partly identical but one is=20 longer than the other then alway the shorter one will be found. smiley 1 - :) smiley 2 - :)) If I receive smiley 2 then alway the first two characters will be=20 replaced with an image. The last ) stays in the text. Modified: trunk/qt-gui/src/emoticon.cpp Modified: trunk/qt-gui/src/emoticon.cpp URL: http://svn.licq.org/viewvc/licq/trunk/qt-gui/src/emoticon.cpp?rev=3D45= 72&r1=3D4571&r2=3D4572&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/qt-gui/src/emoticon.cpp (original) +++ trunk/qt-gui/src/emoticon.cpp Wed Aug 16 00:37:47 2006 @@ -277,9 +277,19 @@ first =3D false; } =20 - //emoticons[emo.smiley[0]].append(emo); - //if (emo.smiley !=3D emo.escapedSmiley) - (*emoticons)[emo.escapedSmiley[0]].append(emo); + // Insert the smiley sorted by length with longest first. This w= ay, if we have + // a smiley :) with image A and :)) with image B, the string :))= will always + // be replaced by image B. + QValueList<Emoticon>::iterator it =3D (*emoticons)[emo.escapedSm= iley[0]].begin(); + QValueList<Emoticon>::iterator end =3D (*emoticons)[emo.escapedS= miley[0]].end(); + while (it !=3D end) + { + if ((*it).escapedSmiley.length() < emo.escapedSmiley.length()) + break; + else + it++; + } + (*emoticons)[emo.escapedSmiley[0]].insert(it, emo); } else { |