Attached is a set of patches I apply to fix multiparty chat,
filetransfers, non-tabbed view and, uhm, INetSocket::SetOwner(long).

Multiparty chat was broken because CChatClient lacked some methods to be
able to be put in an STL container. The patch fixed chat in november.
Don't know if it is broken again in current CVS in another way. :-)

Filetransfers were broken when a reverse connection was tried at first.
Select slept infinitely and wasn't informed about a new socket made
after the reverse connection failed.

Non-tabbed view was broken when a timer tried to update the tab label
after a user-is-typing notification.

I fixed SetOwner(unsigned long) my way about the same time Tuomas Jaakola
sent a patch to the list. He introduced a SetOwner(const char*,unsigned long)
and replaced one occurence of the old SetOwner with his version. There
is still another occurence left.

There is another small fix in TCPSocket::TransferConnectionFrom.
I don't know if this bug can be triggered in any way.

  Daniel

diff -rud /home/daniel/cv/licq/include/licq_chat.h licq/include/licq_chat.h
--- /home/daniel/cv/licq/include/licq_chat.h    Sat Jun 26 22:21:01 2004
+++ licq/include/licq_chat.h    Tue Jun 29 20:23:06 2004
@@ -234,6 +234,27 @@
 public:
   CChatClient();
   CChatClient(ICQUser *);
+  CChatClient(const CChatClient &p) {
+    m_szId=NULL; 
+    *this=p;
+  }
+  CChatClient & operator =(const CChatClient &p) {
+    if(this!=&p) {
+      m_nVersion=p.m_nVersion;
+      m_nPort=p.m_nPort;
+      m_nUin=p.m_nUin;
+      m_nPPID=p.m_nPPID;
+      m_nIp=p.m_nIp;
+      m_nIntIp=p.m_nIntIp;
+      m_nMode=p.m_nMode;
+      m_nSession=p.m_nSession;
+      m_nHandshake=p.m_nHandshake;
+      if(m_szId)
+       free(m_szId);
+      m_szId=p.m_szId?strdup(p.m_szId):NULL;
+    }
+    return *this;
+  }
   ~CChatClient() { if (m_szId) free(m_szId); }
 
   // Initialize from the handshake buffer (does not set the session
diff -rud /home/daniel/cv/licq/include/licq_socket.h licq/include/licq_socket.h
--- /home/daniel/cv/licq/include/licq_socket.h  Sat Jun 26 22:21:02 2004
+++ licq/include/licq_socket.h  Tue Jun 29 20:23:06 2004
@@ -49,7 +49,7 @@
   unsigned long OwnerPPID() { return m_nOwnerPPID; }
   void SetOwner(const char *s, unsigned long n);
   unsigned long Owner()     { return (m_nOwner); }
-  void SetOwner(unsigned long _nOwner)  { m_nOwner = _nOwner; }
+  void SetOwner(unsigned long _nOwner);
   unsigned long Version()     { return (m_nVersion); }
   void SetVersion(unsigned long _nVersion)  { m_nVersion = _nVersion; }
 
diff -rud /home/daniel/cv/licq/plugins/qt-gui/src/usereventdlg.cpp 
licq/plugins/qt-gui/src/usereventdlg.cpp
--- /home/daniel/cv/licq/plugins/qt-gui/src/usereventdlg.cpp    Sat Jun 26 22:21:04 
2004
+++ licq/plugins/qt-gui/src/usereventdlg.cpp    Tue Jun 29 20:23:06 2004
@@ -529,7 +529,8 @@
   ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W);
   u->SetTyping(ICQ_TYPING_INACTIVEx0);
   nfoStatus->unsetPalette();
-  mainwin->userEventTabDlg->updateTabLabel(u);
+  if(mainwin->m_bTabbedChatting && mainwin->userEventTabDlg)
+    mainwin->userEventTabDlg->updateTabLabel(u);
   gUserManager.DropUser(u);  
 }
 
diff -rud /home/daniel/cv/licq/src/icqd-filetransfer.cpp licq/src/icqd-filetransfer.cpp
--- /home/daniel/cv/licq/src/icqd-filetransfer.cpp      Sat Jun 26 22:21:14 2004
+++ licq/src/icqd-filetransfer.cpp      Tue Jun 29 20:23:06 2004
@@ -1131,7 +1131,7 @@
         if (nCurrentSocket == ftman->pipe_thread[PIPE_READ])
         {
           read(ftman->pipe_thread[PIPE_READ], buf, 1);
-          if (buf[0] == 'S')
+          if (buf[0] == 'R')
           {
             DEBUG_THREADS("[FileTransferManager_tep] Reloading socket info.\n");
           }
@@ -1268,6 +1268,7 @@
     {
       rc->m->ftSock.TransferConnectionFrom(s);
       bConnected = rc->m->SendFileHandshake();
+      write(rc->m->pipe_thread[PIPE_WRITE], "R", 1);
     }
   }
 
diff -rud /home/daniel/cv/licq/src/socket.cpp licq/src/socket.cpp
--- /home/daniel/cv/licq/src/socket.cpp Sat Jun 26 22:21:18 2004
+++ licq/src/socket.cpp Tue Jun 29 20:23:06 2004
@@ -241,11 +241,9 @@
 }
 
 
-//-----INetSocket::constructor--------------------------------------------------
-INetSocket::INetSocket(unsigned long _nOwner)
+void INetSocket::SetOwner(unsigned long _nOwner)
 {
   m_nOwner = _nOwner;
-  m_nDescriptor = -1;
   if (_nOwner)
   {
     char szUin[24];
@@ -258,6 +256,13 @@
     m_szOwnerId = 0;
     m_nOwnerPPID = 0;
   }
+}
+
+//-----INetSocket::constructor--------------------------------------------------
+INetSocket::INetSocket(unsigned long _nOwner)
+{
+  m_nDescriptor = -1;
+  SetOwner(_nOwner);
   m_nVersion = 0;
   m_nErrorType = SOCK_ERROR_none;
   memset(&m_sRemoteAddr, 0, sizeof(struct sockaddr_in));
@@ -787,6 +792,8 @@
     free (m_szOwnerId);
   if (from.m_szOwnerId)
     m_szOwnerId = strdup(from.m_szOwnerId);
+  else
+    m_szOwnerId = NULL;
   m_nOwnerPPID = from.m_nOwnerPPID;
 
   if (m_nOwnerPPID == LICQ_PPID)

Attachment: pgpcckeTIXc6O.pgp
Description: PGP signature

Reply via email to