Show
Ignore:
Timestamp:
05/01/03 10:02:06 (6 years ago)
Author:
emostar
Message:

Fixes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/protocol_plugin_1_3_0/qt-gui/src/usereventdlg.cpp

    r3467 r3471  
    7575 
    7676// ----------------------------------------------------------------------------- 
     77#ifdef QT_PROTOCOL_PLUGIN 
     78UserEventCommon::UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, 
     79                                 CMainWindow *m, const char *_szId, 
     80                                 unsigned long _nPPID, QWidget *parent, 
     81                                 const char *name) 
     82  : QWidget(parent, name, WDestructiveClose) 
     83{ 
     84  server = s; 
     85  mainwin = m; 
     86  sigman = theSigMan; 
     87  m_szId = _szId ? strdup(_szId) : 0; 
     88  m_nPPID = _nPPID; 
     89  m_bOwner = (gUserManager.FindOwner(m_szId, m_nPPID) != NULL); 
     90  m_bDeleteUser = false; 
     91   
     92  top_hlay = new QHBoxLayout(this, 6); 
     93  top_lay = new QVBoxLayout(top_hlay); 
     94  top_hlay->setStretchFactor(top_lay, 1); 
     95 
     96  // initalize codec 
     97  codec = QTextCodec::codecForLocale(); 
     98 
     99  QBoxLayout *layt = new QHBoxLayout(top_lay, 8); 
     100  layt->addWidget(new QLabel(tr("Status:"), this)); 
     101  nfoStatus = new CInfoField(this, true); 
     102  nfoStatus->setMinimumWidth(nfoStatus->sizeHint().width()+30); 
     103  layt->addWidget(nfoStatus); 
     104  layt->addWidget(new QLabel(tr("Time:"), this)); 
     105  nfoTimezone = new CInfoField(this, true); 
     106  nfoTimezone->setMinimumWidth(nfoTimezone->sizeHint().width()/2+10); 
     107  layt->addWidget(nfoTimezone); 
     108 
     109  popupEncoding = new QPopupMenu(this); 
     110  btnSecure = new QPushButton(this); 
     111  QToolTip::add(btnSecure, tr("Open / Close secure channel")); 
     112  layt->addWidget(btnSecure); 
     113  connect(btnSecure, SIGNAL(clicked()), this, SLOT(slot_security())); 
     114  btnHistory = new QPushButton(this); 
     115  btnHistory->setPixmap(mainwin->pmHistory); 
     116  QToolTip::add(btnHistory, tr("Show User History")); 
     117  connect(btnHistory, SIGNAL(clicked()), this, SLOT(showHistory())); 
     118  layt->addWidget(btnHistory); 
     119  btnInfo = new QPushButton(this); 
     120  btnInfo->setPixmap(mainwin->pmInfo); 
     121  QToolTip::add(btnInfo, tr("Show User Info")); 
     122  connect(btnInfo, SIGNAL(clicked()), this, SLOT(showUserInfo())); 
     123  layt->addWidget(btnInfo); 
     124  btnEncoding = new QPushButton(this); 
     125  btnEncoding->setPixmap(mainwin->pmEncoding); 
     126  QToolTip::add(btnEncoding, tr("Change user text encoding")); 
     127  QWhatsThis::add(btnEncoding, tr("This button selects the text encoding used when communicating with this user. You might need to change the encoding to communicate in a different language.")); 
     128  btnEncoding->setPopup(popupEncoding); 
     129 
     130  layt->addWidget(btnEncoding); 
     131 
     132  tmrTime = NULL; 
     133 
     134  ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 
     135  if (u != NULL) 
     136  { 
     137    nfoStatus->setData(u->StatusStr()); 
     138    if (u->NewMessages() == 0) 
     139      setIcon(CMainWindow::iconForStatus(u->StatusFull())); 
     140    else 
     141      setIcon(CMainWindow::iconForEvent(ICQ_CMDxSUB_MSG)); 
     142    SetGeneralInfo(u); 
     143 
     144    // restore prefered encoding 
     145    codec = UserCodec::codecForICQUser(u); 
     146 
     147    gUserManager.DropUser(u); 
     148  } 
     149 
     150  QString codec_name = QString::fromLatin1( codec->name() ).lower(); 
     151  popupEncoding->setCheckable(true); 
     152 
     153  // populate the popup menu 
     154  UserCodec::encoding_t *it = &UserCodec::m_encodings[0]; 
     155  while(it->encoding != NULL) { 
     156 
     157    if (QString::fromLatin1(it->encoding).lower() == codec_name) { 
     158      if (mainwin->m_bShowAllEncodings || it->isMinimal) { 
     159        popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib); 
     160      } else { 
     161        // if the current encoding does not appear in the minimal list 
     162        popupEncoding->insertSeparator(0); 
     163        popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib, 0); 
     164      } 
     165      popupEncoding->setItemChecked(it->mib, true); 
     166    } else { 
     167      if (mainwin->m_bShowAllEncodings || it->isMinimal) { 
     168        popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib); 
     169      } 
     170    } 
     171 
     172    ++it; 
     173  } 
     174 
     175  connect (sigman, SIGNAL(signal_updatedUser(CICQSignal *)), 
     176           this, SLOT(slot_userupdated(CICQSignal *))); 
     177 
     178  mainWidget = new QWidget(this); 
     179  top_lay->addWidget(mainWidget); 
     180} 
     181#endif 
     182 
    77183#if QT_VERSION >= 300 
    78184UserEventTabDlg::UserEventTabDlg(QWidget *parent, const char *name) 
     
    235341 
    236342// ----------------------------------------------------------------------------- 
    237 #ifdef QT_PROTOCOL_PLUGIN 
     343 
    238344UserEventCommon::UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, 
    239                                  CMainWindow *m, const char *_szId, 
    240                                  unsigned long _nPPID, QWidget *parent, 
    241                                  const char *name) 
     345                                 CMainWindow *m, unsigned long _nUin, 
     346                                 QWidget* parent, const char* name) 
    242347  : QWidget(parent, name, WDestructiveClose) 
    243348{ 
     349#ifdef QT_PROTOCOL_PLUGIN 
     350  char szUin[24]; 
     351  sprintf(szUin, "%lu", _nUin); 
     352  m_szId = strdup(szUin); 
     353  m_nPPID = LICQ_PPID; 
     354#endif 
    244355  server = s; 
    245356  mainwin = m; 
    246357  sigman = theSigMan; 
    247   m_szId = _szId ? strdup(_szId) : 0; 
    248   m_nPPID = _nPPID; 
    249   m_bOwner = (gUserManager.FindOwner(m_szId, m_nPPID) != NULL); 
     358  m_nUin = _nUin; 
     359  m_bOwner = (m_nUin == gUserManager.OwnerUin()); 
    250360  m_bDeleteUser = false; 
    251361 
     
    292402  tmrTime = NULL; 
    293403 
    294   ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 
     404  ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); 
    295405  if (u != NULL) 
    296406  { 
     
    339449  top_lay->addWidget(mainWidget); 
    340450} 
    341 #endif 
    342  
    343 UserEventCommon::UserEventCommon(CICQDaemon *s, CSignalManager *theSigMan, 
    344                                  CMainWindow *m, unsigned long _nUin, 
    345                                  QWidget* parent, const char* name) 
    346   : QWidget(parent, name, WDestructiveClose) 
    347 { 
    348 #ifdef QT_PROTOCOL_PLUGIN 
    349   char szUin[24]; 
    350   sprintf(szUin, "%lu", _nUin); 
    351   m_szId = strdup(szUin); 
    352   m_nPPID = LICQ_PPID; 
    353 #endif 
    354   server = s; 
    355   mainwin = m; 
    356   sigman = theSigMan; 
    357   m_nUin = _nUin; 
    358   m_bOwner = (m_nUin == gUserManager.OwnerUin()); 
    359   m_bDeleteUser = false; 
    360  
    361   top_hlay = new QHBoxLayout(this, 6); 
    362   top_lay = new QVBoxLayout(top_hlay); 
    363   top_hlay->setStretchFactor(top_lay, 1); 
    364  
    365   // initalize codec 
    366   codec = QTextCodec::codecForLocale(); 
    367  
    368   QBoxLayout *layt = new QHBoxLayout(top_lay, 8); 
    369   layt->addWidget(new QLabel(tr("Status:"), this)); 
    370   nfoStatus = new CInfoField(this, true); 
    371   nfoStatus->setMinimumWidth(nfoStatus->sizeHint().width()+30); 
    372   layt->addWidget(nfoStatus); 
    373   layt->addWidget(new QLabel(tr("Time:"), this)); 
    374   nfoTimezone = new CInfoField(this, true); 
    375   nfoTimezone->setMinimumWidth(nfoTimezone->sizeHint().width()/2+10); 
    376   layt->addWidget(nfoTimezone); 
    377  
    378   popupEncoding = new QPopupMenu(this); 
    379   btnSecure = new QPushButton(this); 
    380   QToolTip::add(btnSecure, tr("Open / Close secure channel")); 
    381   layt->addWidget(btnSecure); 
    382   connect(btnSecure, SIGNAL(clicked()), this, SLOT(slot_security())); 
    383   btnHistory = new QPushButton(this); 
    384   btnHistory->setPixmap(mainwin->pmHistory); 
    385   QToolTip::add(btnHistory, tr("Show User History")); 
    386   connect(btnHistory, SIGNAL(clicked()), this, SLOT(showHistory())); 
    387   layt->addWidget(btnHistory); 
    388   btnInfo = new QPushButton(this); 
    389   btnInfo->setPixmap(mainwin->pmInfo); 
    390   QToolTip::add(btnInfo, tr("Show User Info")); 
    391   connect(btnInfo, SIGNAL(clicked()), this, SLOT(showUserInfo())); 
    392   layt->addWidget(btnInfo); 
    393   btnEncoding = new QPushButton(this); 
    394   btnEncoding->setPixmap(mainwin->pmEncoding); 
    395   QToolTip::add(btnEncoding, tr("Change user text encoding")); 
    396   QWhatsThis::add(btnEncoding, tr("This button selects the text encoding used when communicating with this user. You might need to change the encoding to communicate in a different language.")); 
    397   btnEncoding->setPopup(popupEncoding); 
    398  
    399   layt->addWidget(btnEncoding); 
    400  
    401   tmrTime = NULL; 
    402  
    403   ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); 
    404   if (u != NULL) 
    405   { 
    406     nfoStatus->setData(u->StatusStr()); 
    407     if (u->NewMessages() == 0) 
    408       setIcon(CMainWindow::iconForStatus(u->StatusFull())); 
    409     else 
    410       setIcon(CMainWindow::iconForEvent(ICQ_CMDxSUB_MSG)); 
    411     SetGeneralInfo(u); 
    412  
    413     // restore prefered encoding 
    414     codec = UserCodec::codecForICQUser(u); 
    415  
    416     gUserManager.DropUser(u); 
    417   } 
    418  
    419   QString codec_name = QString::fromLatin1( codec->name() ).lower(); 
    420   popupEncoding->setCheckable(true); 
    421  
    422   // populate the popup menu 
    423   UserCodec::encoding_t *it = &UserCodec::m_encodings[0]; 
    424   while(it->encoding != NULL) { 
    425  
    426     if (QString::fromLatin1(it->encoding).lower() == codec_name) { 
    427       if (mainwin->m_bShowAllEncodings || it->isMinimal) { 
    428         popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib); 
    429       } else { 
    430         // if the current encoding does not appear in the minimal list 
    431         popupEncoding->insertSeparator(0); 
    432         popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib, 0); 
    433       } 
    434       popupEncoding->setItemChecked(it->mib, true); 
    435     } else { 
    436       if (mainwin->m_bShowAllEncodings || it->isMinimal) { 
    437         popupEncoding->insertItem(UserCodec::nameForEncoding(it->encoding), this, SLOT(slot_setEncoding(int)), 0, it->mib); 
    438       } 
    439     } 
    440      
    441     ++it; 
    442   } 
    443  
    444   connect (sigman, SIGNAL(signal_updatedUser(CICQSignal *)), 
    445            this, SLOT(slot_userupdated(CICQSignal *))); 
    446  
    447   mainWidget = new QWidget(this); 
    448   top_lay->addWidget(mainWidget); 
    449 } 
    450451 
    451452void UserEventCommon::slot_setEncoding(int encodingMib) { 
     
    471472 
    472473    /* save prefered character set */ 
     474#ifdef QT_PROTOCOL_PLUGIN 
     475    ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 
     476#else 
    473477    ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); 
     478#endif 
    474479    if (u != NULL) { 
    475480      u->SetEnableSave(false); 
     
    544549  if (m_bDeleteUser && !m_bOwner) 
    545550    mainwin->RemoveUserFromList(strdup(m_szId), m_nPPID, this); 
    546  
     551     
    547552  free(m_szId); 
    548553#else 
     
    875880  if(!chkAutoClose->isChecked()) return; 
    876881 
     882#ifdef QT_PROTOCOL_PLUGIN 
     883  ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R); 
     884#else 
    877885  ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); 
     886#endif 
    878887  bool doclose = (u->NewMessages() == 0); 
    879888  gUserManager.DropUser(u); 
     
    983992        btnRead4->setText(tr("Start Chat")); 
    984993        break; 
    985          
     994 
    986995      case ICQ_CMDxSUB_SMS: 
    987996        btnEncoding->setEnabled(false); 
     
    10021011        btnRead1->setText(tr("A&uthorize")); 
    10031012        btnRead2->setText(tr("&Refuse")); 
     1013#ifdef QT_PROTOCOL_PLUGIN 
     1014        CEventAuthRequest *pAuthReq = (CEventAuthRequest *)m;; 
     1015        ICQUser *u = gUserManager.FetchUser(pAuthReq->IdString(), pAuthReq->PPID(), LOCK_R); 
     1016#else 
    10041017        ICQUser *u = gUserManager.FetchUser( ((CEventAuthRequest *)m)->Uin(), LOCK_R); 
     1018#endif 
    10051019        if (u == NULL) 
    10061020          btnRead3->setText(tr("A&dd User")); 
     
    10111025      case ICQ_CMDxSUB_AUTHxGRANTED: 
    10121026      { 
     1027#ifdef QT_PROTOCOL_PLUGIN 
     1028        CEventAuthGranted *pAuth = (CEventAuthGranted *)m; 
     1029        ICQUser *u = gUserManager.FetchUser(pAuth->IdString(), pAuth->PPID(), LOCK_R); 
     1030#else 
    10131031        ICQUser *u = gUserManager.FetchUser( ((CEventAuthGranted *)m)->Uin(), LOCK_R); 
     1032#endif 
    10141033        if (u == NULL) 
    10151034          btnRead1->setText(tr("A&dd User")); 
     
    10201039      case ICQ_CMDxSUB_ADDEDxTOxLIST: 
    10211040      { 
     1041#ifdef QT_PROTOCOL_PLUGIN 
     1042        CEventAdded *pAdd = (CEventAdded *)m; 
     1043        ICQUser *u = gUserManager.FetchUser(pAdd->IdString(), pAdd->PPID(), LOCK_R); 
     1044#else 
    10221045        ICQUser *u = gUserManager.FetchUser( ((CEventAdded *)m)->Uin(), LOCK_R); 
     1046#endif 
    10231047        if (u == NULL) 
    10241048          btnRead1->setText(tr("A&dd User")); 
     
    10481072  if (e->m_nEventId != -1 && e->msg->Direction() == D_RECEIVER) 
    10491073  { 
     1074#ifdef QT_PROTOCOL_PLUGIN 
     1075    ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 
     1076#else 
    10501077    ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); 
     1078#endif 
    10511079    u->EventClearId(e->m_nEventId); 
    10521080    gUserManager.DropUser(u); 
     
    10771105void UserViewEvent::sendMsg(QString txt) 
    10781106{ 
     1107#ifdef QT_PROTOCOL_PLUGIN 
     1108  UserSendMsgEvent *e = new UserSendMsgEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1109#else 
    10791110  UserSendMsgEvent *e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin); 
     1111#endif 
    10801112  e->setText(txt); 
    10811113 
     
    11211153 
    11221154    case ICQ_CMDxSUB_AUTHxREQUEST: 
     1155    { 
     1156#ifdef QT_PROTOCOL_PLUGIN 
     1157      CEventAuthRequest *p = (CEventAuthRequest *)m_xCurrentReadEvent; 
     1158      (void) new AuthUserDlg(server, p->IdString(), p->PPID(), true); 
     1159#else 
    11231160      (void) new AuthUserDlg(server, ((CEventAuthRequest *)m_xCurrentReadEvent)->Uin(), true); 
     1161#endif 
    11241162      break; 
     1163    } 
    11251164 
    11261165    case ICQ_CMDxSUB_AUTHxGRANTED: 
    1127 #ifdef QT_PROTOCOL_PLUGIN 
    1128     { 
     1166    { 
     1167#ifdef QT_PROTOCOL_PLUGIN 
    11291168      CEventAuthGranted *p = (CEventAuthGranted *)m_xCurrentReadEvent; 
    11301169      server->AddUserToList(p->IdString(), p->PPID()); 
    1131     } 
    11321170#else 
    11331171      server->AddUserToList( ((CEventAuthGranted *)m_xCurrentReadEvent)->Uin()); 
    11341172#endif 
    11351173      break; 
     1174    } 
    11361175 
    11371176    case ICQ_CMDxSUB_ADDEDxTOxLIST: 
    1138 #ifdef QT_PROTOCOL_PLUGIN 
    1139     { 
     1177    { 
     1178#ifdef QT_PROTOCOL_PLUGIN 
    11401179      CEventAdded *p = (CEventAdded *)m_xCurrentReadEvent; 
    11411180      server->AddUserToList(p->IdString(), p->PPID()); 
    1142     } 
    11431181#else 
    11441182      server->AddUserToList( ((CEventAdded *)m_xCurrentReadEvent)->Uin()); 
    11451183#endif 
    11461184      break; 
     1185    } 
     1186 
    11471187    case ICQ_CMDxSUB_CONTACTxLIST: 
    11481188    { 
     
    11511191      ContactList::const_iterator it; 
    11521192      for(it = cl.begin(); it != cl.end(); ++it) { 
     1193#ifdef QT_PROTOCOL_PLUGIN 
     1194        ICQUser *u = gUserManager.FetchUser((*it)->IdString(), (*it)->PPID(), LOCK_R); 
     1195#else 
    11531196        ICQUser* u = gUserManager.FetchUser((*it)->Uin(), LOCK_R); 
     1197#endif 
    11541198        if(u == NULL) 
    11551199          server->AddUserToList((*it)->Uin()); 
     
    11861230      { 
    11871231        if (chatDlg->StartAsClient(c->Port())) 
     1232#ifdef QT_PROTOCOL_PLUGIN 
     1233        { 
     1234          //TODO in CICQDaemon 
     1235          server->icqChatRequestAccept(strtoul(m_szId, (char **)NULL, 10), 0, 
     1236            c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1237        } 
     1238#else 
    11881239          server->icqChatRequestAccept(m_nUin, 0, c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1240#endif 
    11891241      } 
    11901242      else  // single party (other side connects to us) 
    11911243      { 
    11921244        if (chatDlg->StartAsServer()) 
     1245#ifdef QT_PROTOCOL_PLUGIN 
     1246        { 
     1247          //TODO in CICQDaemon 
     1248          server->icqChatRequestAccept(strtoul(m_szId, (char **)NULL, 10), 
     1249            chatDlg->LocalPort(), c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1250        } 
     1251#else 
    11931252          server->icqChatRequestAccept(m_nUin, chatDlg->LocalPort(), c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1253#endif 
    11941254      } 
    11951255      break; 
     
    12601320        btnRead2->setEnabled(false); 
    12611321        btnRead3->setEnabled(false); 
     1322#ifdef QT_PROTOCOL_PLUGIN 
     1323        //TODO in CICQDaemon 
     1324        server->icqChatRequestRefuse(strtoul(m_szId, (char **)NULL, 10), 
     1325          codec->fromUnicode(r->RefuseMessage()), 
     1326          m_xCurrentReadEvent->Sequence(), c->MessageID(), c->IsDirect()); 
     1327#else 
    12621328        server->icqChatRequestRefuse(m_nUin, codec->fromUnicode(r->RefuseMessage()), 
    12631329           m_xCurrentReadEvent->Sequence(), c->MessageID(), c->IsDirect()); 
     1330#endif 
    12641331      } 
    12651332      delete r; 
     
    12691336    case ICQ_CMDxSUB_FILE:  // refuse a file transfer 
    12701337    { 
     1338#ifdef QT_PROTOCOL_PLUGIN 
     1339      CRefuseDlg *r = new CRefuseDlg(m_szId, m_nPPID, tr("File Transfer"), this); 
     1340#else 
    12711341      CRefuseDlg *r = new CRefuseDlg(m_nUin, tr("File Transfer"), this); 
     1342#endif 
    12721343      if (r->exec()) 
    12731344      { 
     
    12761347        btnRead2->setEnabled(false); 
    12771348        btnRead3->setEnabled(false); 
     1349#ifdef QT_PROTOCOL_PLUGIN 
     1350        //TODO 
     1351        server->icqFileTransferRefuse(strtoul(m_szId, (char **)NULL, 10), 
     1352          codec->fromUnicode(r->RefuseMessage()), 
     1353          m_xCurrentReadEvent->Sequence(), f->MessageID(), f->IsDirect()); 
     1354#else 
    12781355        server->icqFileTransferRefuse(m_nUin, codec->fromUnicode(r->RefuseMessage()), 
    12791356           m_xCurrentReadEvent->Sequence(), f->MessageID(), f->IsDirect()); 
     1357#endif 
    12801358      } 
    12811359      delete r; 
     
    12841362 
    12851363    case ICQ_CMDxSUB_AUTHxREQUEST: 
     1364#ifdef QT_PROTOCOL_PLUGIN 
     1365    { 
     1366      CEventAuthRequest *p = (CEventAuthRequest *)m_xCurrentReadEvent; 
     1367      server->AddUserToList(p->IdString(), p->PPID()); 
     1368      break; 
     1369    } 
     1370#else 
    12861371      server->AddUserToList( ((CEventAuthRequest *)m_xCurrentReadEvent)->Uin()); 
    12871372      break; 
    1288  
     1373#endif 
    12891374  } 
    12901375} 
     
    12981383  { 
    12991384    case ICQ_CMDxSUB_MSG: 
     1385#ifdef QT_PROTOCOL_PLUGIN 
     1386      mainwin->callFunction(mnuUserSendChat, m_szId, m_nPPID); 
     1387#else 
    13001388      mainwin->callFunction(mnuUserSendChat, Uin()); 
     1389#endif 
    13011390      break; 
    13021391    case ICQ_CMDxSUB_CHAT:  // join to current chat 
     
    13051394      if (c->Port() != 0)  // Joining a multiparty chat (we connect to them) 
    13061395      { 
     1396#ifdef QT_PROTOCOL_PLUGIN 
     1397        ChatDlg *chatDlg = new ChatDlg(m_szId, m_nPPID, server, mainwin); 
     1398        //TODO 
     1399        if (chatDlg->StartAsClient(c->Port())) 
     1400          server->icqChatRequestAccept(strtoul(m_szId, (char **)NULL, 10), 0, c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1401#else 
    13071402        ChatDlg *chatDlg = new ChatDlg(m_nUin, server, mainwin); 
    13081403        if (chatDlg->StartAsClient(c->Port())) 
    13091404          server->icqChatRequestAccept(m_nUin, 0, c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1405#endif 
    13101406      } 
    13111407      else  // single party (other side connects to us) 
     
    13141410        CJoinChatDlg *j = new CJoinChatDlg(this); 
    13151411        if (j->exec() && (chatDlg = j->JoinedChat()) != NULL) 
     1412#ifdef QT_PROTOCOL_PLUGIN 
     1413          //TODO 
     1414          server->icqChatRequestAccept(strtoul(m_szId, (char **)NULL, 10), chatDlg->LocalPort(), c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1415#else 
    13161416          server->icqChatRequestAccept(m_nUin, chatDlg->LocalPort(), c->Clients(), c->Sequence(), c->MessageID(), c->IsDirect()); 
     1417#endif 
    13171418        delete j; 
    13181419      } 
     
    13841485void UserViewEvent::slot_sentevent(ICQEvent *e) 
    13851486{ 
     1487#ifdef QT_PROTOCOL_PLUGIN 
     1488  if (e->PPID() != m_nPPID || (strcmp(e->Id(), m_szId) != 0)) return; 
     1489#else 
    13861490  if (e->Uin() != m_nUin) return; 
     1491#endif 
    13871492  if (!mainwin->m_bMsgChatView) 
    13881493    (void) new MsgViewItem(e->GrabUserEvent(), codec, msgView); 
     
    16071712void UserSendCommon::windowActivationChange(bool oldActive) 
    16081713{ 
     1714#ifdef QT_PROTOCOL_PLUGIN 
     1715  ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R); 
     1716#else 
     1717  ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); 
     1718#endif 
     1719 
    16091720  if (isActiveWindow() && mainwin->m_bMsgChatView && 
    16101721      (!mainwin->userEventTabDlg || 
     
    16131724     mainwin->userEventTabDlg->tabIsSelected(this))))) 
    16141725    { 
    1615     ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); 
    16161726    if (u != NULL && u->NewMessages() > 0) 
    16171727    { 
     
    16271737        u->EventClearId(idList[i]); 
    16281738    } 
    1629     gUserManager.DropUser(u); 
    1630   } 
     1739  } 
     1740  gUserManager.DropUser(u); 
    16311741  QWidget::windowActivationChange(oldActive); 
    16321742} 
     
    16611771void UserSendCommon::trySecure() 
    16621772{ 
     1773#ifdef QT_PROTOCOL_PLUGIN 
     1774  ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R); 
     1775#else 
    16631776  ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); 
     1777#endif 
    16641778  bool autoSecure = ( u->AutoSecure() && gLicqDaemon->CryptoEnabled() && 
    16651779                      (u->SecureChannelSupport() == SECURE_CHANNEL_SUPPORTED ) && 
     
    16691783  connect(btnSend, SIGNAL(clicked()), this, SLOT(sendButton())); 
    16701784  if ( autoSecure ) { 
     1785#ifdef QT_PROTOCOL_PLUGIN 
     1786    QWidget *w = new KeyRequestDlg(sigman, m_szId, m_nPPID); 
     1787#else 
    16711788    QWidget* w = new KeyRequestDlg(sigman, m_nUin); 
     1789#endif 
    16721790    connect(w, SIGNAL( destroyed() ), this, SLOT( sendButton() ) ); 
    16731791  } 
     
    17041822  switch(id) 
    17051823  { 
     1824#ifdef QT_PROTOCOL_PLUGIN 
     1825  case 0: 
     1826    e = new UserSendMsgEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1827    break; 
     1828  case 1: 
     1829    e = new UserSendUrlEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1830    break; 
     1831  case 2: 
     1832    e = new UserSendChatEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1833    break; 
     1834  case 3: 
     1835    e = new UserSendFileEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1836    break; 
     1837  case 4: 
     1838    e = new UserSendContactEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1839    break; 
     1840  case 5: 
     1841    e = new UserSendSmsEvent(server, sigman, mainwin, m_szId, m_nPPID); 
     1842    break; 
     1843#else 
    17061844  case 0: 
    17071845    e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin, parent); 
     
    17221860    e = new UserSendSmsEvent(server, sigman, mainwin, m_nUin, parent); 
    17231861    break; 
     1862#endif 
    17241863  } 
    17251864 
     
    17271866  { 
    17281867    if (e->mleSend && mleSend) 
    1729     {   
     1868    { 
    17301869      e->mleSend->setText(mleSend->text()); 
    17311870      e->mleSend->setEdited(e->mleSend->length()); 
     
    18431982{ 
    18441983  if(!mainwin->m_bManualNewUser) { 
     1984#ifdef QT_PROTOCOL_PLUGIN 
     1985    ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 
     1986#else 
    18451987    ICQUser* u = gUserManager.FetchUser(m_nUin, LOCK_W); 
     1988#endif 
    18461989 
    18471990    if(u->NewUser()) 
     
    18491992      u->SetNewUser(false); 
    18501993      gUserManager.DropUser(u); 
    1851  
     1994#ifdef QT_PROTOCOL_PLUGIN 
     1995      CICQSignal s(SIGNAL_UPDATExUSER, USER_BASIC, m_szId, m_nPPID); 
     1996#else 
    18521997      CICQSignal s(SIGNAL_UPDATExUSER, USER_BASIC, m_nUin); 
     1998#endif 
    18531999      emit updateUser(&s); 
    18542000    } 
     
    19802126  if (e->SubResult() == ICQ_TCPxACK_RETURN) 
    19812127  { 
     2128#ifdef QT_PROTOCOL_PLUGIN 
     2129    u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 
     2130#else 
    19822131    u = gUserManager.FetchUser(m_nUin, LOCK_W); 
     2132#endif 
    19832133    msg = tr("%1 is in %2 mode:\n%3\nSend...") 
    19842134             .arg(codec->toUnicode(u->GetAlias())).arg(u->StatusStr()) 
     
    20022152  else if (e->SubResult() == ICQ_TCPxACK_REFUSE) 
    20032153  {