[prev in list] [next in list] [prev in thread] [next in thread] 

List:       licq-devel
Subject:    Re: [Licq-devel] Dropping the last character
From:       Tuomas Jaakola <tuomas.jaakola () iki ! fi>
Date:       2005-09-19 17:38:00
Message-ID: 432EF778.6010405 () iki ! fi
[Download RAW message or body]

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.


["icqpacket.patch" (text/x-patch)]

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;
   }

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Licq-devel mailing list
Licq-devel@licq.org
https://lists.sourceforge.net/lists/listinfo/licq-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic