diff -ruN licq.bak/include/licq_chat.h licq/include/licq_chat.h
--- licq.bak/include/licq_chat.h	Tue Dec 10 00:52:14 2002
+++ licq/include/licq_chat.h	Mon Dec 23 17:47:48 2002
@@ -117,6 +117,40 @@
 const unsigned long FONT_BOLD      = 0x00000001;
 const unsigned long FONT_ITALIC    = 0x00000002;
 const unsigned long FONT_UNDERLINE = 0x00000004;
+const unsigned long FONT_STRIKEOUT = 0x00000008;
+
+//Font encodings (taken from windows api docs)
+const unsigned char ENCODING_ANSI        =   0;
+const unsigned char ENCODING_DEFAULT     =   1;
+const unsigned char ENCODING_SYMBOL      =   2;
+const unsigned char ENCODING_MAC         =  77;
+const unsigned char ENCODING_SHIFTJIS    = 128;
+const unsigned char ENCODING_HANGEUL     = 129;
+const unsigned char ENCODING_JOHAB       = 130;
+const unsigned char ENCODING_GB2312      = 134;
+const unsigned char ENCODING_CHINESEBIG5 = 136;
+const unsigned char ENCODING_GREEK       = 161;
+const unsigned char ENCODING_TURKISH     = 162;
+const unsigned char ENCODING_VIETNAMESE  = 163;
+const unsigned char ENCODING_HEBREW      = 177;
+const unsigned char ENCODING_ARABIC      = 178;
+const unsigned char ENCODING_BALTIC      = 186;
+const unsigned char ENCODING_RUSSIAN     = 204;
+const unsigned char ENCODING_THAI        = 222;
+const unsigned char ENCODING_EASTEUROPE  = 238;
+const unsigned char ENCODING_OEM         = 255;
+
+//Font style (taken from windows api docs)
+const unsigned char STYLE_DEFAULTxPITCH  = 0x00;
+const unsigned char STYLE_FIXEDxPITCH    = 0x01;
+const unsigned char STYLE_VARIABLExPITCH = 0x02;
+
+const unsigned char STYLE_DONTCARE       = 0x00;
+const unsigned char STYLE_ROMAN          = 0x10;
+const unsigned char STYLE_SWISS          = 0x20;
+const unsigned char STYLE_MODERN         = 0x30;
+const unsigned char STYLE_SCRIPT         = 0x40;
+const unsigned char STYLE_DECORATIVE     = 0x50;
 
 struct SVoteInfo
 {
@@ -223,9 +257,9 @@
      int nColorForeRed, int nColorForeGreen, int nColorForeBlue,
      int nColorBackRed, int nColorBackBlue, int nColorBackGreen,
      unsigned long nFontSize,
-     bool bFontBold, bool bFontItalic, bool bFontUnderline,
-     const char *szFontFamily,
-     ChatClientPList &clientList);
+     bool bFontBold, bool bFontItalic, bool bFontUnderline, bool bFontStrikeOut,
+     const char *szFontFamily, unsigned char nFontEncoding,
+     unsigned char nFontStyle, ChatClientPList &clientList);
 
   CPChat_ColorFont(CBuffer &);
 
@@ -246,8 +280,11 @@
   bool FontBold() { return m_nFontFace & FONT_BOLD; }
   bool FontItalic() { return m_nFontFace & FONT_ITALIC; }
   bool FontUnderline() { return m_nFontFace & FONT_UNDERLINE; }
+  bool FontStrikeOut() { return m_nFontFace & FONT_STRIKEOUT; }
   unsigned long FontFace() { return m_nFontFace; }
   const char *FontFamily() { return m_szFontFamily; }
+  unsigned char FontEncoding() { return m_nFontEncoding; }
+  unsigned char FontStyle() { return m_nFontStyle; }
   ChatClientList &ChatClients()  { return chatClients; }
 
 protected:
@@ -264,6 +301,7 @@
   unsigned long m_nFontSize;
   unsigned long m_nFontFace;
   char *m_szFontFamily;
+  unsigned char m_nFontEncoding, m_nFontStyle;
   ChatClientList chatClients;
 };
 
@@ -277,7 +315,8 @@
    CPChat_Font(unsigned short nLocalPort, unsigned short nSession,
                unsigned long nFontSize,
                bool bFontBold, bool bFontItalic, bool bFontUnderline,
-               const char *szFontFamily);
+               bool bFontStrikeOut, const char *szFontFamily,
+               unsigned char nFontEncoding, unsigned char nFontStyle);
    CPChat_Font(CBuffer &);
    virtual ~CPChat_Font()  { if (m_szFontFamily != NULL) free (m_szFontFamily); }
 
@@ -287,8 +326,11 @@
   bool FontBold() { return m_nFontFace & FONT_BOLD; }
   bool FontItalic() { return m_nFontFace & FONT_ITALIC; }
   bool FontUnderline() { return m_nFontFace & FONT_UNDERLINE; }
+  bool FontStrikeOut() { return m_nFontFace & FONT_STRIKEOUT; }
   unsigned long FontFace() { return m_nFontFace; }
   const char *FontFamily() { return m_szFontFamily; }
+  unsigned char FontEncoding() { return m_nFontEncoding; }
+  unsigned char FontStyle() { return m_nFontStyle; }
 
 protected:
   unsigned short m_nPort;
@@ -296,6 +338,7 @@
   unsigned long m_nFontSize;
   unsigned long m_nFontFace;
   char *m_szFontFamily;
+  unsigned char m_nFontEncoding, m_nFontStyle;
 };
 
 
@@ -398,18 +441,21 @@
 class CChatUser
 {
 public:
-  unsigned long Uin()       { return uin; }
-  unsigned long ToKick()    { return nToKick; }
-  const char *Name()        { return chatname; }
-  int *ColorFg()            { return colorFore; }
-  int *ColorBg()            { return colorBack; }
-  char *FontFamily()        { return fontFamily; }
-  unsigned short FontSize() { return fontSize; }
-  bool FontBold()           { return fontFace & FONT_BOLD; }
-  bool FontItalic()         { return fontFace & FONT_ITALIC; }
-  bool FontUnderline()      { return fontFace & FONT_UNDERLINE; }
-  bool Focus()              { return focus; }
-  bool Sleep()              { return sleep; }
+  unsigned long Uin()          { return uin; }
+  unsigned long ToKick()       { return nToKick; }
+  const char *Name()           { return chatname; }
+  int *ColorFg()               { return colorFore; }
+  int *ColorBg()               { return colorBack; }
+  char *FontFamily()           { return fontFamily; }
+  unsigned char FontEncoding() { return fontEncoding; }
+  unsigned char FontStyle()    { return fontStyle; }
+  unsigned short FontSize()    { return fontSize; }
+  bool FontBold()              { return fontFace & FONT_BOLD; }
+  bool FontItalic()            { return fontFace & FONT_ITALIC; }
+  bool FontUnderline()         { return fontFace & FONT_UNDERLINE; }
+  bool FontStrikeOut()         { return fontFace & FONT_STRIKEOUT; }
+  bool Focus()                 { return focus; }
+  bool Sleep()                 { return sleep; }
 
   ~CChatUser() {}
 
@@ -421,6 +467,7 @@
   char chatname[32];
   int colorFore[3], colorBack[3];
   char fontFamily[64];
+  unsigned char fontEncoding, fontStyle;
   unsigned short fontSize;
   unsigned long fontFace;
   bool focus, sleep;
@@ -473,10 +520,12 @@
 public:
   CChatManager(CICQDaemon *d, unsigned long nUin,
      const char *fontFamily = "courier",
+     unsigned char fontEncoding = ENCODING_DEFAULT,
+     unsigned char fontStyle = STYLE_DONTCARE | STYLE_DEFAULTxPITCH,
      unsigned short fontSize = 12, bool fontBold = false,
      bool fontItalic = false, bool fontUnderline = false,
-     int fr = 0xFF, int fg = 0xFF, int fb = 0xFF,
-     int br = 0x00, int bg = 0x00, int bb = 0x00);
+     bool fontStrikeOut = false, int fr = 0xFF, int fg = 0xFF,
+     int fb = 0xFF, int br = 0x00, int bg = 0x00, int bb = 0x00);
   ~CChatManager();
 
   bool StartAsServer();
@@ -489,6 +538,8 @@
   unsigned short LocalPort() { return chatServer.LocalPort(); }
   const char *Name()  { return m_szName; }
   const char *FontFamily()  { return m_szFontFamily; }
+  unsigned char FontEncoding() { return m_nFontEncoding; }
+  unsigned char FontStyle() { return m_nFontStyle; }
   unsigned long FontFace()  { return m_nFontFace; }
   unsigned short FontSize()  { return m_nFontSize; }
   int *ColorFg()  { return m_nColorFore; }
@@ -497,9 +548,9 @@
   bool Sleep()  { return m_bSleep; }
   bool Focus()  { return m_bFocus; }
 
-  void ChangeFontFamily(const char *);
+  void ChangeFontFamily(const char *, unsigned char, unsigned char);
   void ChangeFontSize(unsigned short);
-  void ChangeFontFace(bool, bool, bool);
+  void ChangeFontFace(bool, bool, bool, bool);
   void ChangeColorFg(int, int, int);
   void ChangeColorBg(int, int, int);
   void SendBeep();
@@ -538,6 +589,7 @@
 
   int m_nColorFore[3], m_nColorBack[3];
   char m_szFontFamily[64], m_szName[64];
+  unsigned char m_nFontEncoding, m_nFontStyle;
   unsigned short m_nFontSize;
   unsigned long m_nFontFace;
   bool m_bSleep, m_bFocus;
diff -ruN licq.bak/plugins/qt-gui/src/chatdlg.cpp licq/plugins/qt-gui/src/chatdlg.cpp
--- licq.bak/plugins/qt-gui/src/chatdlg.cpp	Tue Dec 10 01:16:40 2002
+++ licq/plugins/qt-gui/src/chatdlg.cpp	Mon Dec 23 21:16:51 2002
@@ -71,6 +71,7 @@
 #include "xpm/chatBold.xpm"
 #include "xpm/chatItalic.xpm"
 #include "xpm/chatUnder.xpm"
+#include "xpm/chatStrike.xpm"
 #include "xpm/chatBeep.xpm"
 #include "xpm/chatIgnore.xpm"
 #include "xpm/chatChangeFg.xpm"
@@ -200,22 +201,26 @@
    // tbtLaugh = new QToolButton(LeftArrow, barChat);
 
   QPixmap* pixIgnore = new QPixmap(chatIgnore_xpm);
+  qPixmaps.push_back(pixIgnore);
   tbtIgnore = new QToolButton(*pixIgnore, tr("Ignore user settings"),
     tr("Ignores user color settings"), this, SLOT(updateRemoteStyle()), barChat);
   tbtIgnore->setToggleButton(true);
 
   QPixmap* pixBeep = new QPixmap(chatBeep_xpm);
+  qPixmaps.push_back(pixBeep);
   tbtBeep = new QToolButton(*pixBeep, tr("Beep"),
      tr("Sends a Beep to all recipients"),this, SLOT(chatSendBeep()), barChat);
 
   barChat->addSeparator();
 
   QPixmap* pixFg = new QPixmap(chatChangeFg_xpm);
+  qPixmaps.push_back(pixFg);
   tbtFg = new QToolButton(*pixFg, tr("Foreground color"),
      tr("Changes the foreground color"), this, SLOT(changeFrontColor()), barChat);
   mnuFg = new QPopupMenu(this);
 
   QPixmap* pixBg = new QPixmap(chatChangeBg_xpm);
+  qPixmaps.push_back(pixBg);
   tbtBg = new QToolButton(*pixBg, tr("Background color"),
      tr("Changes the background color"), this, SLOT(changeBackColor()), barChat);
 
@@ -224,6 +229,7 @@
   for(unsigned int i = 0; i < NUM_COLORS; i++)
   {
     QPixmap *pix = new QPixmap(48, 14);
+    qPixmaps.push_back(pix);
     QPainter p(pix);
     QColor c (col_array[i*3+0], col_array[i*3+1], col_array[i*3+2]);
 
@@ -232,6 +238,7 @@
 
     mnuBg->insertItem(*pix, i);
     QPixmap* pixf = new QPixmap(48, 14);
+    qPixmaps.push_back(pixf);
     pixf->fill(colorGroup().background());
     QPainter pf(pixf);
     pf.setPen(c);
@@ -241,33 +248,47 @@
   barChat->addSeparator();
 
   QPixmap* pixBold = new QPixmap(chatBold_xpm);
+  qPixmaps.push_back(pixBold);
   tbtBold = new QToolButton(*pixBold, tr("Bold"),
     tr("Toggles Bold font") , this, SLOT(fontStyleChanged()), barChat);
   tbtBold->setToggleButton(true);
 
   QPixmap* pixItalic = new QPixmap(chatItalic_xpm);
+  qPixmaps.push_back(pixItalic);
   tbtItalic = new QToolButton(*pixItalic, tr("Italic"),
     tr("Toggles Italic font"), this, SLOT(fontStyleChanged()), barChat);
   tbtItalic->setToggleButton(true);
 
   QPixmap *pixUnder = new QPixmap(chatUnder_xpm);
+  qPixmaps.push_back(pixUnder);
   tbtUnderline = new QToolButton(*pixUnder, tr("Underline"),
      tr("Toggles Bold font"), this, SLOT(fontStyleChanged()), barChat);
   tbtUnderline->setToggleButton(true);
 
+  QPixmap *pixStrike = new QPixmap(chatStrike_xpm);
+  qPixmaps.push_back(pixStrike);
+  tbtStrikeOut = new QToolButton(*pixStrike, tr("StrikeOut"),
+     tr("Toggles StrikeOut font"), this, SLOT(fontStyleChanged()), barChat);
+  tbtStrikeOut->setToggleButton(true);
+
   tbtBold->setAutoRaise(false);
   tbtItalic->setAutoRaise(false);
   tbtUnderline->setAutoRaise(false);
+  tbtStrikeOut->setAutoRaise(false);
 
   barChat->addSeparator();
 
-  cmbFontSize = new QComboBox(false, barChat);
+  cmbFontSize = new QComboBox(true, barChat);
+  cmbFontSize->setInsertionPolicy(QComboBox::NoInsertion);
+  //windows font size limit seems to be 1638 (tested 98, 2000)
+  cmbFontSize->setValidator(new QIntValidator(1, 1638, cmbFontSize));
   connect(cmbFontSize, SIGNAL(activated(const QString&)), SLOT(fontSizeChanged(const QString&)));
   cmbFontSize->insertItem(QString::number(font().pointSize()));
 
   QValueList<int> sizes = QFontDatabase::standardSizes();
   for(unsigned i = 0; i < sizes.count(); i++)
-    cmbFontSize->insertItem(QString::number(sizes[i]));
+    if(sizes[i] != font().pointSize())
+      cmbFontSize->insertItem(QString::number(sizes[i]));
 
   QFontDatabase fb;
   cmbFontName = new QComboBox(false, barChat);
@@ -285,16 +306,6 @@
 
   codec = QTextCodec::codecForLocale();
 
-  // determine the other user's preferred encoding
-  ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W);
-  if (u != NULL)
-  {
-    // restore prefered encoding
-    codec = UserCodec::codecForICQUser(u);
-
-    gUserManager.DropUser(u);
-  }
-
   QString codec_name = QString::fromLatin1( codec->name() ).lower(); // TODO: determine best codec
   QPopupMenu *popupEncoding = new QPopupMenu;
   popupEncoding->setCheckable(true);
@@ -340,14 +351,18 @@
   chatDlgs.push_back(this);
 
   // Create the chat manager using our font
-  QFont f(mlePaneLocal->font());
-  char *fontName = strdup(f.family().local8Bit());
-  char *endp = strstr(fontName, " [");
-  if (endp != NULL)
-    *endp = '\0';
-  chatman = new CChatManager(daemon, _nUin,
-     fontName, f.pointSize(), f.bold(), f.italic(), f.underline());
-  free(fontName);
+  QFontInfo fi(mlePaneLocal->font());
+  QFontDatabase fd; //QFontInfo.fixedPitch returns incorrect info???
+  unsigned char style = STYLE_DONTCARE;
+  if (fd.isFixedPitch(fi.family(), fd.styleString(mlePaneLocal->font())))
+    style |= STYLE_FIXEDxPITCH;
+  else
+    style |= STYLE_VARIABLExPITCH;
+  unsigned char encoding = UserCodec::charsetForName(codec->name());
+  chatman = new CChatManager(daemon, _nUin, fi.family().local8Bit(),
+     encoding, style, fi.pointSize(), fi.bold(), fi.italic(), fi.underline(),
+     fi.strikeOut());
+  
   sn = new QSocketNotifier(chatman->Pipe(), QSocketNotifier::Read);
   connect(sn, SIGNAL(activated(int)), this, SLOT(slot_chat()));
 
@@ -383,6 +398,10 @@
   if (sn != NULL) delete sn;
   sn = NULL;
 
+  QPixmapList::iterator i;
+  for (i = qPixmaps.begin(); i != qPixmaps.end(); i++) delete *i;
+  qPixmaps.clear();
+
   ChatDlgList::iterator iter;
   for (iter = chatDlgs.begin(); iter != chatDlgs.end(); iter++)
   {
@@ -411,11 +430,12 @@
   mleIRCLocal->setFont(f);
   mleIRCRemote->setFont(f);
 
-  // transmit to remote
-  chatman->ChangeFontSize(txt.toULong());
-
   // if ignoring style change the remote panes too
   updateRemoteStyle();
+
+  // transmit to remote
+  QFontInfo fi(f);
+  chatman->ChangeFontSize(fi.pointSize());
 }
 
 
@@ -431,18 +451,29 @@
   mleIRCLocal->setFont(f);
   mleIRCRemote->setFont(f);
 
-  // transmit to remote
-  char *newFont = strdup(txt.ascii());
-  char *endp = strstr(newFont, " [");
-  if (endp != NULL)
-  {
-    *endp = '\0';
-  }
-  chatman->ChangeFontFamily(newFont);
-  free(newFont);
-
   // if ignoring style change the remote panes too
   updateRemoteStyle();
+
+  // transmit to remote
+  sendFontInfo();
+}
+
+// -----------------------------------------------------------------------------
+
+void ChatDlg::sendFontInfo()
+{
+  //FIXME can we get more precise style???
+  QFontInfo fi(mlePaneLocal->font());
+  QFontDatabase fd; //QFontInfo.fixedPitch returns incorrect info???
+  unsigned char style = STYLE_DONTCARE;
+  if (fd.isFixedPitch(fi.family(), fd.styleString(mlePaneLocal->font())))
+    style |= STYLE_FIXEDxPITCH;
+  else
+    style |= STYLE_VARIABLExPITCH;
+
+  unsigned char encoding = UserCodec::charsetForName(codec->name());
+
+  chatman->ChangeFontFamily(fi.family().local8Bit(), encoding, style);
 }
 
 // -----------------------------------------------------------------------------
@@ -454,18 +485,18 @@
   f.setBold(tbtBold->state() == QButton::On);
   f.setItalic(tbtItalic->state() == QButton::On);
   f.setUnderline(tbtUnderline->state() == QButton::On);
+  f.setStrikeOut(tbtStrikeOut->state() == QButton::On);
 
   mlePaneLocal->setFont(f);
   mleIRCLocal->setFont(f);
   mleIRCRemote->setFont(f);
 
-  // transmit to remote
-  chatman->ChangeFontFace(tbtBold->state() == QButton::On,
-    tbtItalic->state() == QButton::On,
-    tbtUnderline->state() == QButton::On);
-
   // if ignoring style change the remote panes too
   updateRemoteStyle();
+
+  // transmit to remote
+  QFontInfo fi(f);
+  chatman->ChangeFontFace(fi.bold(), fi.italic(), fi.underline(), fi.strikeOut());
 }
 
 
@@ -490,11 +521,11 @@
   mleIRCLocal->setForeground(color);
   mleIRCRemote->setForeground(color);
 
-  // sent to remote
-  chatman->ChangeColorFg(color.red(), color.green(), color.blue());
-
   // if ignoring style change the remote panes too
   updateRemoteStyle();
+
+  // sent to remote
+  chatman->ChangeColorFg(color.red(), color.green(), color.blue());
 }
 
 
@@ -511,11 +542,11 @@
   mleIRCLocal->setBackground(color);
   mleIRCRemote->setBackground(color);
 
-  // sent to remote
-  chatman->ChangeColorBg(color.red(), color.green(), color.blue());
-
   // if ignoring style change the remote panes too
   updateRemoteStyle();
+
+  // sent to remote
+  chatman->ChangeColorBg(color.red(), color.green(), color.blue());
 }
 
 // -----------------------------------------------------------------------------
@@ -597,7 +628,7 @@
 
          // even if the pane didn't trigger the event,
          // we need to keep it updated
-         mlePaneLocal->insertLine("");
+         mlePaneLocal->appendNoNewLine("\n");
          // so you'll get some idea what your buddy sees (encoding-wise)
          mleIRCRemote->append(chatname + "> " + codec->toUnicode(encoded));
          mleIRCRemote->GotoEnd();
@@ -646,7 +677,6 @@
       break;
     }
   }
-
 }
 
 
@@ -715,6 +745,10 @@
           connect(mleIRCLocal, SIGNAL(keyPressed(QKeyEvent *)), this, SLOT(chatSend(QKeyEvent *)));
           mlePaneLocal->setEnabled(true);
           mleIRCLocal->setEnabled(true);
+          if (m_nMode == CHAT_PANE)
+            mlePaneLocal->setFocus();
+          else
+            mleIRCLocal->setFocus();
         }
 
         CChatWindow *lePaneRemote = new CChatWindow(boxPane);
@@ -735,11 +769,10 @@
         QString n = UserCodec::codecForCChatUser(u)->toUnicode(u->Name());
 
         // add to IRC box
-        mleIRCRemote->append(n + QString::fromLatin1("> ") + codec->toUnicode(e->Data()));
+        mleIRCRemote->append(n + QString::fromLatin1("> ") + UserCodec::codecForCChatUser(u)->toUnicode(e->Data()));
         mleIRCRemote->GotoEnd();
-
-        GetPane(u)->insertLine("");
-        GetPane(u)->GotoEnd();
+        GetWindow(u)->appendNoNewLine("\n");
+        GetWindow(u)->GotoEnd();
         break;
       }
 
@@ -749,7 +782,7 @@
           QApplication::beep();
         else
         {
-          GetPane(u)->append(tr("\n<--BEEP-->\n"));
+          GetWindow(u)->append(tr("\n<--BEEP-->\n"));
           mleIRCRemote->append(chatname + tr("> <--BEEP-->\n"));
         }
         break;
@@ -758,13 +791,13 @@
       case CHAT_BACKSPACE:   // backspace
       {
 #if QT_VERSION >= 300
-        GetPane(u)->setReadOnly(false);
-        GetPane(u)->setCursorPosition(-1, -1, false);
+        GetWindow(u)->setReadOnly(false);
+        GetWindow(u)->setCursorPosition(-1, -1, false);
 #endif
-        GetPane(u)->backspace();
+        GetWindow(u)->backspace();
 #if QT_VERSION >= 300
-        GetPane(u)->setReadOnly(true);
-        GetPane(u)->update();
+        GetWindow(u)->setReadOnly(true);
+        GetWindow(u)->update();
 #endif
         break;
       }
@@ -772,7 +805,7 @@
       case CHAT_COLORxFG: // change foreground color
       {
         if (tbtIgnore->state() == QButton::Off)
-          GetPane(u)->setForeground(QColor (u->ColorFg()[0],
+          GetWindow(u)->setForeground(QColor (u->ColorFg()[0],
              u->ColorFg()[1], u->ColorFg()[2]));
         break;
       }
@@ -780,7 +813,7 @@
       case CHAT_COLORxBG:  // change background color
       {
         if (tbtIgnore->state() == QButton::Off)
-          GetPane(u)->setBackground(QColor (u->ColorBg()[0],
+          GetWindow(u)->setBackground(QColor (u->ColorBg()[0],
              u->ColorBg()[1], u->ColorBg()[2]));
 
         break;
@@ -790,9 +823,30 @@
       {
         if (tbtIgnore->state() == QButton::Off)
         {
-          QFont f(GetPane(u)->font());
+          QFont f(GetWindow(u)->font());
+          f.setFixedPitch(u->FontStyle() & 0x0F == STYLE_FIXEDxPITCH);
+          switch (u->FontStyle() & 0xF0)
+          {
+          case STYLE_ROMAN:
+            f.setStyleHint(QFont::Serif);
+            break;
+          case STYLE_SWISS:
+            f.setStyleHint(QFont::SansSerif);
+            break;
+          case STYLE_DECORATIVE:
+            f.setStyleHint(QFont::Decorative);
+            break;
+          case STYLE_DONTCARE:
+          case STYLE_MODERN:
+          case STYLE_SCRIPT:
+          default:
+            f.setStyleHint(QFont::AnyStyle);
+            break;
+          }
+
           f.setFamily(u->FontFamily());
-          GetPane(u)->setFont(f);
+
+          GetWindow(u)->setFont(f);
         }
         break;
       }
@@ -801,11 +855,12 @@
       {
         if (tbtIgnore->state() == QButton::Off)
         {
-          QFont f(GetPane(u)->font());
+          QFont f(GetWindow(u)->font());
           f.setBold(u->FontBold());
           f.setItalic(u->FontItalic());
           f.setUnderline(u->FontUnderline());
-          GetPane(u)->setFont(f);
+          f.setStrikeOut(u->FontStrikeOut());
+          GetWindow(u)->setFont(f);
         }
         break;
       }
@@ -814,9 +869,9 @@
       {
         if (tbtIgnore->state() == QButton::Off)
         {
-          QFont f(GetPane(u)->font());
+          QFont f(GetWindow(u)->font());
           f.setPointSize(u->FontSize() > 24 ? 24 : u->FontSize());
-          GetPane(u)->setFont(f);
+          GetWindow(u)->setFont(f);
         }
         break;
       }
@@ -832,7 +887,7 @@
 
       case CHAT_CHARACTER:
       {
-        GetPane(u)->appendNoNewLine(codec->toUnicode(e->Data()));
+        GetWindow(u)->appendNoNewLine(UserCodec::codecForCChatUser(u)->toUnicode(e->Data()));
         break;
       }
 
@@ -857,8 +912,8 @@
   boxPane->hide();
   mleIRCLocal->setText(mlePaneLocal->textLine(mlePaneLocal->numLines()-2));
   mleIRCLocal->GotoEnd();
-  mleIRCLocal->setFocus();
   boxIRC->show();
+  mleIRCLocal->setFocus();
 }
 
 
@@ -868,9 +923,9 @@
   mnuMode->setItemChecked(mnuMode->idAt(0), true);
   mnuMode->setItemChecked(mnuMode->idAt(1), false);
   boxIRC->hide();
-  mlePaneLocal->setFocus();
   mlePaneLocal->GotoEnd();
   boxPane->show();
+  mlePaneLocal->setFocus();
 }
 
 
@@ -939,7 +994,7 @@
   chatClose(NULL);
 }
 
-CChatWindow *ChatDlg::GetPane(CChatUser *u)
+CChatWindow *ChatDlg::GetWindow(CChatUser *u)
 {
   ChatUserWindowsList::iterator iter;
   for (iter = chatUserWindows.begin(); iter != chatUserWindows.end(); iter++)
@@ -974,7 +1029,7 @@
 {
   char *sz = chatman->ClientsStr();
   QString n = sz;
-  delete sz;
+  delete [] sz;
   return n;
 }
 
@@ -1061,15 +1116,8 @@
     /* make the chosen encoding checked */
     popupEncoding->setItemChecked(encodingMib, true);
 
-    /* save prefered character set */
-    ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W);
-    if (u != NULL) {
-      u->SetEnableSave(false);
-      u->SetUserEncoding(encoding.latin1());
-      u->SetEnableSave(true);
-      u->SaveLicqInfo();
-      gUserManager.DropUser(u);
-    }
+    // transmit to remote
+    sendFontInfo();
 
     emit encodingChanged();
   }
@@ -1100,10 +1148,7 @@
 
 void CChatWindow::GotoEnd()
 {
-  if (lineLength(numLines() - 1) == 0)
-    setCursorPosition(numLines() - 1, 0);
-  else
-    setCursorPosition(numLines() - 1, lineLength(numLines() - 1) - 1);
+  setCursorPosition(numLines() - 1, lineLength(numLines() - 1));
 }
 
 
@@ -1130,6 +1175,8 @@
         e->key() != Key_Enter))
     return;
 
+  GotoEnd();
+
   // the order of the two is important -- on Enter, first QMultiLineEdit adds
   // a line break, and later we clear the input line, and not vice versa
   QMultiLineEdit::keyPressEvent(e);
@@ -1163,7 +1210,6 @@
 void CChatWindow::paste()
 {
   QString t = QApplication::clipboard()->text();
-  QApplication::clipboard()->clear();
 
   if ( !t.isEmpty() ) {
 
diff -ruN licq.bak/plugins/qt-gui/src/chatdlg.h licq/plugins/qt-gui/src/chatdlg.h
--- licq.bak/plugins/qt-gui/src/chatdlg.h	Tue Dec 10 01:16:40 2002
+++ licq/plugins/qt-gui/src/chatdlg.h	Mon Dec 23 21:11:36 2002
@@ -71,6 +71,7 @@
   QLabel *l;
 } UserWindowPair;
 typedef std::list<UserWindowPair> ChatUserWindowsList;
+typedef std::list<QPixmap *> QPixmapList;
 
 enum ChatMode { CHAT_PANE, CHAT_IRC };
 
@@ -111,7 +112,7 @@
   CMainWindow *mainwin;
   QListBox *lstUsers;
 
-  QToolButton *tbtBold, *tbtItalic, *tbtUnderline;
+  QToolButton *tbtBold, *tbtItalic, *tbtUnderline, *tbtStrikeOut;
   QToolButton *tbtLaugh, *tbtBeep, *tbtFg, *tbtBg;
   QToolButton *tbtIgnore, *tbtEncoding;
 
@@ -120,13 +121,15 @@
 
   ChatMode m_nMode;
   ChatUserWindowsList chatUserWindows;
+  QPixmapList qPixmaps; //pixmaps are not deleted by qt destructor
+
   unsigned long m_nUin;
   QSocketNotifier *sn;
   bool m_bAudio;
   QTextCodec *codec;
 
   virtual void closeEvent(QCloseEvent*);
-  CChatWindow *GetPane(CChatUser *u);
+  CChatWindow *GetWindow(CChatUser *u);
   void UpdateRemotePane();
 
   friend class CJoinChatDlg;
@@ -142,6 +145,7 @@
 
   void fontSizeChanged(const QString&);
   void fontNameChanged(const QString&);
+  void sendFontInfo();
   void fontStyleChanged();
   void changeFrontColor();
   void changeBackColor();
diff -ruN licq.bak/plugins/qt-gui/src/usercodec.cpp licq/plugins/qt-gui/src/usercodec.cpp
--- licq.bak/plugins/qt-gui/src/usercodec.cpp	Sat May 25 19:12:31 2002
+++ licq/plugins/qt-gui/src/usercodec.cpp	Mon Dec 23 17:47:48 2002
@@ -29,53 +29,53 @@
 #include "licq_chat.h"
 
 UserCodec::encoding_t UserCodec::m_encodings[] = {
-  { QT_TR_NOOP("Unicode"), "UTF-8", 106, true },
+  { QT_TR_NOOP("Unicode"), "UTF-8", 106, ENCODING_DEFAULT, true },
 
-  { QT_TR_NOOP("Arabic"), "ISO 8859-6", 82, false },
-  { QT_TR_NOOP("Arabic"), "CP 1256", 2256, true },
+  { QT_TR_NOOP("Arabic"), "ISO 8859-6", 82, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Arabic"), "CP 1256", 2256, ENCODING_ARABIC, true },
 
-  { QT_TR_NOOP("Baltic"), "ISO 8859-13", 109, false },
-  { QT_TR_NOOP("Baltic"), "CP 1257", 2257, true },
+  { QT_TR_NOOP("Baltic"), "ISO 8859-13", 109, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Baltic"), "CP 1257", 2257, ENCODING_BALTIC, true },
 
-  { QT_TR_NOOP("Central European"), "ISO 8859-2", 5, false },
-  { QT_TR_NOOP("Central European"), "CP 1250", 2250, true },
+  { QT_TR_NOOP("Central European"), "ISO 8859-2", 5, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Central European"), "CP 1250", 2250, ENCODING_EASTEUROPE, true },
 
-  { QT_TR_NOOP("Chinese"), "GBK", -2025, false },
-  { QT_TR_NOOP("Chinese Traditional"), "Big5", 2026, true },
+  { QT_TR_NOOP("Chinese"), "GBK", -2025, ENCODING_GB2312, false },
+  { QT_TR_NOOP("Chinese Traditional"), "Big5", 2026, ENCODING_CHINESEBIG5, true },
 
-  { QT_TR_NOOP("Cyrillic"), "ISO 8859-5", 8, false },
-  { QT_TR_NOOP("Cyrillic"), "KOI8-R", 2084, false },
-  { QT_TR_NOOP("Cyrillic"), "CP 1251", 2251, true },
+  { QT_TR_NOOP("Cyrillic"), "ISO 8859-5", 8, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Cyrillic"), "KOI8-R", 2084, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Cyrillic"), "CP 1251", 2251, ENCODING_RUSSIAN, true },
 
-  { QT_TR_NOOP("Esperanto"), "ISO 8859-3", 6, false },
+  { QT_TR_NOOP("Esperanto"), "ISO 8859-3", 6, ENCODING_DEFAULT, false },
   
-  { QT_TR_NOOP("Greek"), "ISO 8859-7", 10, false },
-  { QT_TR_NOOP("Greek"), "CP 1253", 2253, true },
+  { QT_TR_NOOP("Greek"), "ISO 8859-7", 10, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Greek"), "CP 1253", 2253, ENCODING_GREEK, true },
   
   // Visual Hebrew is avoided on purpose -- its not usable for communications
-  { QT_TR_NOOP("Hebrew"), "ISO 8859-8-I", 85, false },
-  { QT_TR_NOOP("Hebrew"), "CP 1255", 2255, true },
+  { QT_TR_NOOP("Hebrew"), "ISO 8859-8-I", 85, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Hebrew"), "CP 1255", 2255, ENCODING_HEBREW, true },
 
-  { QT_TR_NOOP("Japanese"), "Shift-JIS", 17, true },
-  { QT_TR_NOOP("Japanese"), "JIS7", 16, false },
-  { QT_TR_NOOP("Japanese"), "eucJP", 18, false },
+  { QT_TR_NOOP("Japanese"), "Shift-JIS", 17, ENCODING_SHIFTJIS, true },
+  { QT_TR_NOOP("Japanese"), "JIS7", 16, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Japanese"), "eucJP", 18, ENCODING_DEFAULT, false },
 
-  { QT_TR_NOOP("Korean"), "eucKR", 38, true },
+  { QT_TR_NOOP("Korean"), "eucKR", 38, ENCODING_DEFAULT, true },
 
-  { QT_TR_NOOP("Western European"), "ISO 8859-1", 4, false },
-  { QT_TR_NOOP("Western European"), "ISO 8859-15", 111, false },
-  { QT_TR_NOOP("Western European"), "CP 1252", 2252, true },
+  { QT_TR_NOOP("Western European"), "ISO 8859-1", 4, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Western European"), "ISO 8859-15", 111, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Western European"), "CP 1252", 2252, ENCODING_ANSI, true },
 
-  { QT_TR_NOOP("Tamil"), "TSCII", 2028, true },
+  { QT_TR_NOOP("Tamil"), "TSCII", 2028, ENCODING_DEFAULT, true },
 
-  { QT_TR_NOOP("Thai"), "TIS-620", 2259, true },
+  { QT_TR_NOOP("Thai"), "TIS-620", 2259, ENCODING_THAI, true },
 
-  { QT_TR_NOOP("Turkish"), "ISO 8859-9", 12, false },
-  { QT_TR_NOOP("Turkish"), "CP 1254", 2254, true },
+  { QT_TR_NOOP("Turkish"), "ISO 8859-9", 12, ENCODING_DEFAULT, false },
+  { QT_TR_NOOP("Turkish"), "CP 1254", 2254, ENCODING_TURKISH, true },
 
-  { QT_TR_NOOP("Ukrainian"), "KOI8-U", 2088, false },
+  { QT_TR_NOOP("Ukrainian"), "KOI8-U", 2088, ENCODING_DEFAULT, false },
   
-  { 0, 0, 0, false } // end marker
+  { 0, 0, 0, 0, false } // end marker
 };
 
 QTextCodec* UserCodec::codecForICQUser(ICQUser *u)
@@ -107,14 +107,11 @@
 
 QTextCodec *UserCodec::codecForCChatUser(CChatUser *u)
 {
-  if (ICQUser *user = gUserManager.FetchUser(u->Uin(), LOCK_R)) {
-    QTextCodec *codec = UserCodec::codecForICQUser(user);
-    gUserManager.DropUser(user);
-    return codec;
-  }
+  if (nameForCharset(u->FontEncoding()) != QString::null)
+    return QTextCodec::codecForName(nameForCharset(u->FontEncoding()));
 
   // return default encoding
-  return QTextCodec::codecForLocale();
+  return codecForUIN(u->Uin());
 }
 
 QString UserCodec::encodingForMib(int mib)
@@ -145,4 +142,31 @@
 {
   int left = descriptiveName.find( " ( " );
   return descriptiveName.mid( left + 3, descriptiveName.find( " )", left ) - left - 3 );
+}
+
+unsigned char UserCodec::charsetForName(QString name)
+{
+  encoding_t *it = &m_encodings[0];
+  while (it->encoding != NULL) {
+     if (it->encoding == name)
+       return it->charset;
+     it++;
+  }
+
+  return ENCODING_DEFAULT;
+}
+
+QString UserCodec::nameForCharset(unsigned char charset)
+{
+  if (charset == ENCODING_DEFAULT)
+    return QString::null;
+
+  encoding_t *it = &m_encodings[0];
+  while (it->encoding != NULL) {
+     if (it->charset == charset)
+       return QString::fromLatin1(it->encoding);
+     it++;
+  }
+
+  return QString::null;
 }
diff -ruN licq.bak/plugins/qt-gui/src/usercodec.h licq/plugins/qt-gui/src/usercodec.h
--- licq.bak/plugins/qt-gui/src/usercodec.h	Sat May 25 19:12:31 2002
+++ licq/plugins/qt-gui/src/usercodec.h	Mon Dec 23 17:47:48 2002
@@ -31,6 +31,7 @@
 	const char *script;
 	const char *encoding;
 	int mib;
+	unsigned char charset;
 	bool isMinimal;
   };
 
@@ -43,6 +44,8 @@
   static QString encodingForMib(int mib);
   static QString nameForEncoding(const QString &encoding);
   static QString encodingForName(const QString &descriptiveName);
+  static unsigned char charsetForName(QString name);
+  static QString nameForCharset(unsigned char charset);
 
 public:
   static encoding_t m_encodings[];
diff -ruN licq.bak/plugins/qt-gui/src/xpm/chatStrike.xpm licq/plugins/qt-gui/src/xpm/chatStrike.xpm
--- licq.bak/plugins/qt-gui/src/xpm/chatStrike.xpm	Wed Dec 31 19:00:00 1969
+++ licq/plugins/qt-gui/src/xpm/chatStrike.xpm	Mon Dec 23 17:47:48 2002
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * chatStrike_xpm[] = {
+"16 16 3 1",
+" 	c None",
+".	c #000000",
+"+	c #4C4C4C",
+"                ",
+"                ",
+"                ",
+"      .... .    ",
+"     . +++..+   ",
+"     .+    .+   ",
+"     .+     +   ",
+"      ...       ",
+"   ..........   ",
+"    +++++++.++  ",
+"     .     .+   ",
+"     ..    .+   ",
+"     .+.... +   ",
+"      + ++++    ",
+"                ",
+"                "};
diff -ruN licq.bak/src/icqd-chat.cpp licq/src/icqd-chat.cpp
--- licq.bak/src/icqd-chat.cpp	Tue Dec 10 00:52:15 2002
+++ licq/src/icqd-chat.cpp	Mon Dec 23 17:47:48 2002
@@ -218,9 +218,9 @@
    int nColorForeRed, int nColorForeGreen, int nColorForeBlue, int nColorBackRed,
    int nColorBackBlue, int nColorBackGreen,
    unsigned long nFontSize,
-   bool bFontBold, bool bFontItalic, bool bFontUnderline,
-   const char *szFontFamily,
-   ChatClientPList &clientList)
+   bool bFontBold, bool bFontItalic, bool bFontUnderline, bool bFontStrikeOut,
+   const char *szFontFamily, unsigned char nFontEncoding,
+   unsigned char nFontStyle, ChatClientPList &clientList)
 {
   m_szName = NULL;
   m_nPort = nLocalPort;
@@ -237,7 +237,10 @@
   if (bFontBold) m_nFontFace |= FONT_BOLD;
   if (bFontItalic) m_nFontFace |= FONT_ITALIC;
   if (bFontUnderline) m_nFontFace |= FONT_UNDERLINE;
+  if (bFontStrikeOut) m_nFontFace |= FONT_STRIKEOUT;
   m_szFontFamily = NULL;
+  m_nFontEncoding = nFontEncoding;
+  m_nFontStyle = nFontStyle;
 
   m_nSize = 10 + strlen(szLocalName) + 38 + strlen(szFontFamily) + 4
             + clientList.size() * (sizeof(CChatClient) + 2);
@@ -263,7 +266,8 @@
   buffer->PackUnsignedLong(m_nFontSize);
   buffer->PackUnsignedLong(m_nFontFace);
   buffer->PackString(szFontFamily);
-  buffer->PackUnsignedShort(0x2200);
+  buffer->PackChar(nFontEncoding);
+  buffer->PackChar(nFontStyle);
   buffer->PackChar(clientList.size());
 
   ChatClientPList::iterator iter;
@@ -307,7 +311,8 @@
   m_nFontSize = b.UnpackUnsignedLong();
   m_nFontFace = b.UnpackUnsignedLong();
   m_szFontFamily = strdup(b.UnpackString(buf, sizeof(buf)));
-  b.UnpackUnsignedShort();
+  m_nFontEncoding = b.UnpackChar();
+  m_nFontStyle = b.UnpackChar();
 
   // Read out client packets
   unsigned short nc = b.UnpackChar();
@@ -324,7 +329,8 @@
 CPChat_Font::CPChat_Font(unsigned short nLocalPort, unsigned short nSession,
                          unsigned long nFontSize,
                          bool bFontBold, bool bFontItalic, bool bFontUnderline,
-                         const char *szFontFamily)
+                         bool bFontStrikeOut, const char *szFontFamily,
+                         unsigned char nFontEncoding, unsigned char nFontStyle)
 {
   m_nPort = nLocalPort;
   m_nSession = nSession;
@@ -333,7 +339,10 @@
   if (bFontBold) m_nFontFace |= FONT_BOLD;
   if (bFontItalic) m_nFontFace |= FONT_ITALIC;
   if (bFontUnderline) m_nFontFace |= FONT_UNDERLINE;
+  if (bFontStrikeOut) m_nFontFace |= FONT_STRIKEOUT;
   m_szFontFamily = NULL;
+  m_nFontEncoding = nFontEncoding;
+  m_nFontStyle = nFontStyle;
 
   m_nSize = 29 + strlen(szFontFamily) + 3;
   InitBuffer();
@@ -347,8 +356,8 @@
   buffer->PackUnsignedLong(m_nFontSize);
   buffer->PackUnsignedLong(m_nFontFace);
   buffer->PackString(szFontFamily);
-  buffer->PackUnsignedShort(0x2200);
-//  buffer->PackChar(0);
+  buffer->PackChar(nFontEncoding);
+  buffer->PackChar(nFontStyle);
 }
 
 CPChat_Font::CPChat_Font(CBuffer &b)
@@ -364,6 +373,8 @@
   m_nFontSize = b.UnpackUnsignedLong();
   m_nFontFace = b.UnpackUnsignedLong();
   m_szFontFamily = strdup(b.UnpackString(buf, sizeof(buf)));
+  m_nFontEncoding = b.UnpackChar();
+  m_nFontStyle = b.UnpackChar();
 }
 
 /*
@@ -518,6 +529,8 @@
   chatname[0] = '\0';
   linebuf[0] = '\0';
   strcpy(fontFamily, "courier");
+  fontEncoding = ENCODING_DEFAULT;
+  fontStyle = STYLE_MODERN | STYLE_FIXEDxPITCH; // style of courier
   fontSize = 12;
   fontFace = FONT_PLAIN;
   focus = true;
@@ -549,9 +562,9 @@
 
 
 CChatManager::CChatManager(CICQDaemon *d, unsigned long nUin,
-  const char *fontFamily, unsigned short fontSize, bool fontBold,
-  bool fontItalic, bool fontUnderline, int fr, int fg, int fb,
-  int br, int bg, int bb)
+  const char *fontFamily, unsigned char fontEncoding, unsigned char fontStyle,
+  unsigned short fontSize, bool fontBold, bool fontItalic, bool fontUnderline,
+  bool fontStrikeOut, int fr, int fg, int fb, int br, int bg, int bb)
 {
   // Create the plugin notification pipe
   pipe(pipe_thread);
@@ -571,8 +584,11 @@
   if (fontBold) m_nFontFace |= FONT_BOLD;
   if (fontItalic) m_nFontFace |= FONT_ITALIC;
   if (fontUnderline) m_nFontFace |= FONT_UNDERLINE;
+  if (fontStrikeOut) m_nFontFace |= FONT_STRIKEOUT;
   strncpy(m_szFontFamily, fontFamily, sizeof(m_szFontFamily));
   m_szFontFamily[sizeof(m_szFontFamily) - 1] = '\0';
+  m_nFontEncoding = fontEncoding;
+  m_nFontStyle = fontStyle;
   m_nFontSize = fontSize;
   m_nColorFore[0] = fr;
   m_nColorFore[1] = fg;
@@ -827,7 +843,8 @@
          m_nColorFore[0], m_nColorFore[1], m_nColorFore[2],
          m_nColorBack[0], m_nColorBack[1], m_nColorBack[2],
          m_nFontSize, m_nFontFace & FONT_BOLD, m_nFontFace & FONT_ITALIC,
-         m_nFontFace & FONT_UNDERLINE, m_szFontFamily, l);
+         m_nFontFace & FONT_UNDERLINE, m_nFontFace & FONT_STRIKEOUT,
+         m_szFontFamily, m_nFontEncoding, m_nFontStyle, l);
       if (!u->sock.SendPacket(p_colorfont.getBuffer()))
       {
         char buf[128];
@@ -850,6 +867,8 @@
       u->fontFace = pin.FontFace();
       strncpy(u->fontFamily, pin.FontFamily(), 64);
       u->fontFamily[63] = '\0';
+      u->fontEncoding = pin.FontEncoding();
+      u->fontStyle = pin.FontStyle();
 
       u->state = CHAT_STATE_CONNECTED;
       PushChatEvent(new CChatEvent(CHAT_CONNECTION, u));
@@ -882,6 +901,8 @@
       u->fontFace = pin.FontFace();
       strncpy(u->fontFamily, pin.FontFamily(), 64);
       u->fontFamily[63] = '\0';
+      u->fontEncoding = pin.FontEncoding();
+      u->fontStyle = pin.FontStyle();
 
       // Parse the multiusers list
       if (pin.ChatClients().size() > 0)
@@ -906,7 +927,8 @@
       // send the reply (font packet)
 			CPChat_Font p_font(LocalPort(), m_nSession,
          m_nFontSize, m_nFontFace & FONT_BOLD, m_nFontFace & FONT_ITALIC,
-         m_nFontFace & FONT_UNDERLINE, m_szFontFamily);
+         m_nFontFace & FONT_UNDERLINE, m_nFontFace & FONT_STRIKEOUT,
+         m_szFontFamily, m_nFontEncoding, m_nFontStyle);
       if (!u->sock.SendPacket(p_font.getBuffer()))
       {
         char buf[128];
@@ -1053,16 +1075,16 @@
       case CHAT_FONTxFAMILY: // change font type
       {
          if (u->chatQueue.size() < 3) return true;
-         unsigned short sizeFontName, encodingFont, i;
+         unsigned short sizeFontName, i;
          sizeFontName = u->chatQueue[1] | (u->chatQueue[2] << 8);
          if (u->chatQueue.size() < (unsigned long)(sizeFontName + 2 + 3)) return true;
          char nameFont[sizeFontName];
          for (i = 0; i < sizeFontName; i++)
             nameFont[i] = u->chatQueue[i + 3];
-         encodingFont = u->chatQueue[sizeFontName + 3] |
-                        (u->chatQueue[sizeFontName + 4] << 8);
          strncpy(u->fontFamily, nameFont, 64);
          u->fontFamily[63] = '\0';
+         u->fontEncoding = u->chatQueue[sizeFontName + 3];
+         u->fontStyle = u->chatQueue[sizeFontName + 4];
 
          // Dequeue all characters
          for (unsigned short i = 0; i < 3 + sizeFontName + 2; i++)
@@ -1326,9 +1348,6 @@
                  (u->chatQueue[4] << 16) |
                  (u->chatQueue[5] << 24);
 
-      // FIXME did old clients used to do that too???
-      if (chatChar == CHAT_FONTxFAMILY) chatSize--;
-
       if (u->chatQueue.size() < 6 + chatSize) return true;
       for (unsigned short i = 0; i < 6; i++)
         u->chatQueue.pop_front();
@@ -1369,17 +1388,19 @@
 
         case CHAT_FONTxFAMILY: // change font type
         {
-           unsigned short sizeFontName, encodingFont, i;
+           unsigned short sizeFontName, i;
            sizeFontName = u->chatQueue[0] | (u->chatQueue[1] << 8);
            char nameFont[sizeFontName];
            for (i = 0; i < sizeFontName; i++)
               nameFont[i] = u->chatQueue[i + 2];
-           encodingFont = u->chatQueue[sizeFontName + 2] |
-                          (u->chatQueue[sizeFontName + 3] << 8);
            strncpy(u->fontFamily, nameFont, 64);
            u->fontFamily[63] = '\0';
+           u->fontEncoding = u->chatQueue[sizeFontName + 2];
+           u->fontStyle = u->chatQueue[sizeFontName + 3];
 
            PushChatEvent(new CChatEvent(CHAT_FONTxFAMILY, u));
+           //the size includes the following character, so don't dequeue it
+           chatSize--;
            break;
         }
 
@@ -1692,6 +1713,7 @@
   {
     b_out.PackChar(0);
     b_out.PackChar(cmd);
+    //the change font command size includes the following character
     b_out.PackUnsignedLong(b->getDataSize() + ((cmd == CHAT_FONTxFAMILY)?1:0));
     b_out.Pack(b->getDataStart(), b->getDataSize());
   }
@@ -1884,23 +1906,22 @@
 }
 
 
-void CChatManager::ChangeFontFamily(const char *f)
+void CChatManager::ChangeFontFamily(const char *f, unsigned char enc,
+                                    unsigned char style)
 {
   //CPChat_ChangeFontFamily p(f);
   //SendPacket(&p);
 
   CBuffer buf(strlen_safe(f) + 5);
   buf.PackString(f);
-  buf.PackUnsignedShort(0x2200);
-  // 0x2200 west
-  // 0x22a2 turkey
-  // 0x22cc cyrillic
-  // 0x22a1 greek
-  // 0x22ba baltic
+  buf.PackChar(enc);
+  buf.PackChar(style);
   SendBuffer(&buf, CHAT_FONTxFAMILY);
 
   strncpy(m_szFontFamily, f, sizeof(m_szFontFamily));
   m_szFontFamily[sizeof(m_szFontFamily) - 1] = '\0';
+  m_nFontEncoding = enc;
+  m_nFontStyle = style;
 }
 
 
@@ -1917,7 +1938,7 @@
 }
 
 
-void CChatManager::ChangeFontFace(bool b, bool i, bool u)
+void CChatManager::ChangeFontFace(bool b, bool i, bool u, bool s)
 {
   //CPChat_ChangeFontFace p(b, i, u);
   //SendPacket(&p);
@@ -1926,6 +1947,7 @@
   if (b) m_nFontFace |= FONT_BOLD;
   if (i) m_nFontFace |= FONT_ITALIC;
   if (u) m_nFontFace |= FONT_UNDERLINE;
+  if (s) m_nFontFace |= FONT_STRIKEOUT;
 
   CBuffer buf(4);
   buf.PackUnsignedLong(m_nFontFace);
@@ -2073,7 +2095,7 @@
 //-----CChatManager::ClientsStr----------------------------------------------
 char *CChatManager::ClientsStr()
 {
-  char *sz = new char[chatUsers.size() * 36];
+  char *sz = new char[chatUsers.size() * 36 + 1];
   sz[0] = '\0';
   int nPos = 0;
 
