diff -urN -x CVS licq/include/licq_user.h licq.patched/include/licq_user.h --- licq/include/licq_user.h Mon Sep 30 01:43:54 2002 +++ licq.patched/include/licq_user.h Wed Oct 2 13:31:10 2002 @@ -382,6 +382,9 @@ void SetIgnoreList(bool s) { SetInGroup(GROUPS_SYSTEM, GROUP_IGNORE_LIST, s); } void SetNewUser(bool s) { SetInGroup(GROUPS_SYSTEM, GROUP_NEW_USERS, s); } + void SetChatmodeView(bool s) { m_bChatmodeView = s; } + bool GetChatmodeView() { return m_bChatmodeView; } + // Time time_t LocalTime(); int LocalTimeGMTOffset(); @@ -486,7 +489,8 @@ m_bShowAwayMsg, m_bOfflineOnDisconnect, m_bConnectionInProgress, - m_bSecure; + m_bSecure, + m_bChatmodeView; unsigned short m_nStatusToUser, m_nSendLevel; unsigned short m_nAutoAccept; diff -urN -x CVS licq/plugins/qt-gui/src/usereventdlg.cpp licq.patched/plugins/qt-gui/src/usereventdlg.cpp --- licq/plugins/qt-gui/src/usereventdlg.cpp Fri Oct 18 08:39:55 2002 +++ licq.patched/plugins/qt-gui/src/usereventdlg.cpp Tue Oct 22 23:13:17 2002 @@ -353,20 +353,23 @@ lay->addSpacing(10); lay->addWidget(h_action); btnRead1 = new CEButton(h_action); + btnReadChatmodeView = new QPushButton(h_action); btnRead2 = new QPushButton(h_action); btnRead3 = new QPushButton(h_action); btnRead4 = new QPushButton(h_action); - + btnRead1->setEnabled(false); + btnReadChatmodeView->setEnabled(false); btnRead2->setEnabled(false); btnRead3->setEnabled(false); btnRead4->setEnabled(false); - + connect(btnRead1, SIGNAL(clicked()), this, SLOT(slot_btnRead1())); + connect(btnReadChatmodeView, SIGNAL(clicked()), this, SLOT(slot_btnReadChatmodeView())); connect(btnRead2, SIGNAL(clicked()), this, SLOT(slot_btnRead2())); connect(btnRead3, SIGNAL(clicked()), this, SLOT(slot_btnRead3())); connect(btnRead4, SIGNAL(clicked()), this, SLOT(slot_btnRead4())); - + QBoxLayout *h_lay = new QHBoxLayout(top_lay, 4); if (!m_bOwner) { @@ -457,8 +460,9 @@ bool doclose = (u->NewMessages() == 0); gUserManager.DropUser(u); - if(doclose) + if(doclose) { close(); + } } //-----UserViewEvent::updateNextButton--------------------------------------- @@ -499,10 +503,12 @@ MsgViewItem *e = (MsgViewItem *)eq; btnRead1->setText(""); + btnReadChatmodeView->setText(""); btnRead2->setText(""); btnRead3->setText(""); btnRead4->setText(""); btnRead1->setEnabled(false); + btnReadChatmodeView->setEnabled(false); btnRead2->setEnabled(false); btnRead3->setEnabled(false); btnRead4->setEnabled(false); @@ -557,6 +563,7 @@ case ICQ_CMDxSUB_MSG: btnRead1->setText(tr("&Reply")); + btnReadChatmodeView->setText(tr("Chatmode")); btnRead2->setText(tr("&Quote")); btnRead3->setText(tr("&Forward")); btnRead4->setText(tr("Start Chat")); @@ -568,6 +575,7 @@ case ICQ_CMDxSUB_URL: // view a url btnRead1->setText(tr("&Reply")); + btnReadChatmodeView->setText(tr("Chatmode")); btnRead2->setText(tr("&Quote")); btnRead3->setText(tr("&Forward")); if (server->getUrlViewer() != NULL) @@ -616,6 +624,7 @@ } // if if (!btnRead1->text().isEmpty()) btnRead1->setEnabled(true); + if (!btnReadChatmodeView->text().isEmpty()) btnReadChatmodeView->setEnabled(true); if (!btnRead2->text().isEmpty()) btnRead2->setEnabled(true); if (!btnRead3->text().isEmpty()) btnRead3->setEnabled(true); if (!btnRead4->text().isEmpty()) btnRead4->setEnabled(true); @@ -655,7 +664,7 @@ { UserSendMsgEvent *e = new UserSendMsgEvent(server, sigman, mainwin, m_nUin); e->setText(txt); - + // Find a good position for the new window if (mainwin->m_bAutoPosReplyWin) { @@ -693,8 +702,14 @@ case ICQ_CMDxSUB_URL: case ICQ_CMDxSUB_CHAT: case ICQ_CMDxSUB_FILE: - sendMsg(""); - break; + { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); + u->SetChatmodeView(false); + gUserManager.DropUser(u); + + sendMsg(""); + break; + } case ICQ_CMDxSUB_AUTHxREQUEST: (void) new AuthUserDlg(server, ((CEventAuthRequest *)m_xCurrentReadEvent)->Uin(), true); @@ -731,8 +746,14 @@ { case ICQ_CMDxSUB_MSG: // quote case ICQ_CMDxSUB_URL: - generateReply(); - break; + { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); + u->SetChatmodeView(false); + gUserManager.DropUser(u); + + generateReply(); + break; + } case ICQ_CMDxSUB_CHAT: // accept a chat request { @@ -785,6 +806,10 @@ case ICQ_CMDxSUB_MSG: // Forward case ICQ_CMDxSUB_URL: { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); + u->SetChatmodeView(false); + gUserManager.DropUser(u); + CForwardDlg *f = new CForwardDlg(sigman, m_xCurrentReadEvent, this); f->show(); break; @@ -837,8 +862,15 @@ switch (m_xCurrentReadEvent->SubCommand()) { case ICQ_CMDxSUB_MSG: - mainwin->callFunction(mnuUserSendChat, Uin()); - break; + { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); + u->SetChatmodeView(false); + gUserManager.DropUser(u); + + mainwin->callFunction(mnuUserSendChat, Uin()); + break; + } + case ICQ_CMDxSUB_CHAT: // join to current chat { CEventChat *c = (CEventChat *)m_xCurrentReadEvent; @@ -891,6 +923,53 @@ } +void UserViewEvent::slot_btnReadChatmodeView() +{ + if (m_xCurrentReadEvent == NULL) return; + + switch (m_xCurrentReadEvent->SubCommand()) + { + case ICQ_CMDxSUB_MSG: // reply/quote + case ICQ_CMDxSUB_URL: + case ICQ_CMDxSUB_CHAT: + case ICQ_CMDxSUB_FILE: + { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); + u->SetChatmodeView(true); + gUserManager.DropUser(u); + + sendMsg(""); + break; + } + + case ICQ_CMDxSUB_AUTHxREQUEST: + (void) new AuthUserDlg(server, ((CEventAuthRequest *)m_xCurrentReadEvent)->Uin(), true); + break; + + case ICQ_CMDxSUB_AUTHxGRANTED: + server->AddUserToList( ((CEventAuthGranted *)m_xCurrentReadEvent)->Uin()); + break; + + case ICQ_CMDxSUB_ADDEDxTOxLIST: + server->AddUserToList( ((CEventAdded *)m_xCurrentReadEvent)->Uin()); + break; + case ICQ_CMDxSUB_CONTACTxLIST: + { + const ContactList& cl = static_cast(m_xCurrentReadEvent)->Contacts(); + + ContactList::const_iterator it; + for(it = cl.begin(); it != cl.end(); ++it) { + ICQUser* u = gUserManager.FetchUser((*it)->Uin(), LOCK_R); + if(u == NULL) + server->AddUserToList((*it)->Uin()); + gUserManager.DropUser(u); + } + btnReadChatmodeView->setEnabled(false); + } + } // switch +} + + void UserViewEvent::UserUpdated(CICQSignal *sig, ICQUser *u) { if (sig->SubSignal() == USER_EVENTS) @@ -925,8 +1004,13 @@ void UserViewEvent::slot_sentevent(ICQEvent *e) { if (e->Uin() != m_nUin) return; - if (!mainwin->m_bMsgChatView) + + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); + + if (!mainwin->m_bMsgChatView && !u->GetChatmodeView()) (void) new MsgViewItem(e->GrabUserEvent(), codec, msgView); + + gUserManager.DropUser(u); } @@ -1004,14 +1088,23 @@ splView = new QSplitter(Vertical, mainWidget); //splView->setOpaqueResize(); mleHistory=0; - if (mainwin->m_bMsgChatView) { + + u = gUserManager.FetchUser(m_nUin, LOCK_R); + if (mainwin->m_bMsgChatView || u->GetChatmodeView()) { + /* prevent deadlock in CMessageViewWidget */ + gUserManager.DropUser(u); + mleHistory = new CMessageViewWidget(_nUin, splView); #if QT_VERSION >= 300 mleHistory->setICQDaemon(server); #endif connect (mainwin, SIGNAL(signal_sentevent(ICQEvent *)), mleHistory, SLOT(addMsg(ICQEvent *))); //splView->setResizeMode(mleHistory, QSplitter::FollowSizeHint); + + } else { + gUserManager.DropUser(u); } + mleSend = new MLEditWrap(true, splView, true); //splView->setResizeMode(mleSend, QSplitter::Stretch); setTabOrder(mleSend, btnSend); @@ -1331,11 +1424,16 @@ { emit mainwin->signal_sentevent(e); - if (mainwin->m_bMsgChatView) { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); + + if (mainwin->m_bMsgChatView || u->GetChatmodeView()) { mleHistory->GotoEnd(); resetSettings(); - } else + } else { close(); + } + + gUserManager.DropUser(u); } } } @@ -1424,6 +1522,10 @@ if (!icqEventTag) { + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); + u->SetChatmodeView(false); + gUserManager.DropUser(u); + close(); return; } @@ -1499,7 +1601,13 @@ { QBoxLayout* lay = new QVBoxLayout(mainWidget); lay->addWidget(splView); - if (!m->m_bMsgChatView) mleSend->setMinimumHeight(150); + + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); + + if (!m->m_bMsgChatView && !u->GetChatmodeView()) mleSend->setMinimumHeight(150); + + gUserManager.DropUser(u); + mleSend->setFocus (); m_sBaseTitle += tr(" - Message"); @@ -1834,9 +1942,13 @@ QBoxLayout *lay = new QVBoxLayout(mainWidget, 9); lay->addWidget(splView); - - if (!m->m_bMsgChatView) mleSend->setMinimumHeight(150); - + + ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); + + if (!m->m_bMsgChatView && !u->GetChatmodeView()) mleSend->setMinimumHeight(150); + + gUserManager.DropUser(u); + QBoxLayout* h_lay = new QHBoxLayout(lay); lblItem = new QLabel(tr("Multiparty: "), mainWidget); h_lay->addWidget(lblItem); diff -urN -x CVS licq/plugins/qt-gui/src/usereventdlg.h licq.patched/plugins/qt-gui/src/usereventdlg.h --- licq/plugins/qt-gui/src/usereventdlg.h Fri Oct 18 08:39:55 2002 +++ licq.patched/plugins/qt-gui/src/usereventdlg.h Sun Oct 20 14:04:55 2002 @@ -121,7 +121,7 @@ MsgView *msgView; CUserEvent *m_xCurrentReadEvent; QCheckBox* chkAutoClose; - QPushButton *btnRead2, *btnRead3, *btnRead4, *btnReadNext; + QPushButton *btnRead2, *btnRead3, *btnRead4, *btnReadNext, *btnReadChatmodeView; CEButton *btnRead1, *btnClose; // The currently displayed message in decoded (Unicode) form. @@ -144,6 +144,7 @@ void slot_btnRead3(); void slot_btnRead4(); void slot_btnReadNext(); + void slot_btnReadChatmodeView(); void slot_printMessage(QListViewItem*); void slot_sentevent(ICQEvent *); void slot_setEncoding(); diff -urN -x CVS licq/src/user.cpp licq.patched/src/user.cpp --- licq/src/user.cpp Thu Oct 17 06:19:14 2002 +++ licq.patched/src/user.cpp Thu Oct 17 19:38:27 2002 @@ -1056,6 +1056,7 @@ } m_fConf.CloseFile(); m_fConf.SetFlags(INI_FxWARN | INI_FxALLOWxCREATE); + m_bChatmodeView = false; } @@ -1068,6 +1069,7 @@ szFilename[MAX_FILENAME_LEN - 1] = '\0'; m_fConf.SetFileName(szFilename); m_fConf.SetFlags(INI_FxWARN | INI_FxALLOWxCREATE); + m_bChatmodeView = false; }