Casey Cichon wrote:
I'm not sure if this has been brought up before, but when I'm sending a message directly to a ICQ contact the last character is being dropped.
Yeah the same happens with my Licq. If the receiver has also Licq, there is no problem but official clients drop the last character or then they get messages like "12345D€" when sending "12345". I guess that the problem is that they require terminating '\0' char in the msg. I bet this problem has been since the patch in icqpacket.cpp around July 14. I succeeded to fix this problem by attached patch but I'm not sure if it has been fixed at all in correct way... -- # Tumppi.
Index: icqpacket.cpp =================================================================== RCS file: /cvsroot/licq/licq/src/icqpacket.cpp,v retrieving revision 1.121 diff -u -1 -b -p -r1.121 icqpacket.cpp --- icqpacket.cpp 9 Sep 2005 16:13:53 -0000 1.121 +++ icqpacket.cpp 19 Sep 2005 17:34:02 -0000 @@ -4263,5 +4263,6 @@ CPacketTcp::CPacketTcp(unsigned long _nC { - m_szMessage = (char *)malloc(nLen); + m_szMessage = (char *)malloc(nLen + 1); memcpy(m_szMessage, szMessage, nLen); - m_nMsgLen = nLen; + m_szMessage[nLen] = 0; + m_nMsgLen = nLen + 1; } @@ -4270,3 +4271,3 @@ CPacketTcp::CPacketTcp(unsigned long _nC m_szMessage = (szMessage == NULL ? strdup("") : strdup(szMessage)); - m_nMsgLen = strlen(m_szMessage); + m_nMsgLen = strlen(m_szMessage) + 1; }