--- client.c.old	Wed Feb 10 00:32:10 2010
+++ client.c	Wed Feb 10 00:27:07 2010
@@ -798,13 +798,17 @@
 
     /* fill buf with partial msg, replacing \n with \r\n */
     buflen = 0;
-    while ((size_t)buflen < (sizeof(buf) - 1) && i < msglen) {
+    while ((size_t)buflen < (sizeof(buf) - 2) && i < msglen) {
       /* only replace \n and not \r\n */
       if (i > 0 && msg[i] == '\n' && msg[i - 1] != '\r') {
         buf[buflen] = '\r';
         buflen++;
       }
-
+      if (msg[i] == '.' && (i == 0 || msg[i - 1] == '\n') ) {
+        buf[buflen] = '.';
+        buflen++;
+      }
+                            
       buf[buflen] = msg[i];
       buflen++;
       i++;
