fix read_server_text; it was broken. webcit-8.06
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 25 Mar 2012 12:51:04 +0000 (14:51 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 26 Mar 2012 18:59:47 +0000 (20:59 +0200)
  - fixes attendee availability + suppenkasper.

webcit/serv_func.c

index 873a3ffde67114687c9492af222b5273a31a1e0a..a6c41f711e858a9ec61cc87c88570d2d3cba6450 100644 (file)
@@ -524,22 +524,23 @@ void server_to_text()
 int read_server_text(StrBuf *Buf, long *nLines)
 {
        wcsession *WCC = WC;
+       StrBuf *ReadBuf;
        long nRead;
        long nTotal = 0;
        long nlines;
        
        nlines = 0;
+       ReadBuf = NewStrBuf();
        while ((WCC->serv_sock!=-1) &&
-              (nRead = StrBuf_ServGetln(Buf), (nRead >= 0) ))
+              (nRead = StrBuf_ServGetln(ReadBuf), (nRead >= 0) &&
+               ((nRead != 3)||(strcmp(ChrPtr(ReadBuf), "000") != 0))))
        {
-               if (strcmp(ChrPtr(Buf) + nTotal, "000") != 0) {
-                       StrBufCutRight(Buf, nRead);
-                       break;
-               }
+               StrBufAppendBuf(Buf, ReadBuf, 0);
+               StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
                nTotal += nRead;
                nlines ++;
        }
-
+       FreeStrBuf(&ReadBuf);
        *nLines = nlines;
        return nTotal;
 }