]> code.citadel.org Git - citadel.git/blobdiff - webcit/serv_func.c
If we disconnect the server, clean up thoroughly, so we don't struggle over half...
[citadel.git] / webcit / serv_func.c
index 2f6c8073526021482cc519ccfefdebf34c874b97..873a3ffde67114687c9492af222b5273a31a1e0a 100644 (file)
@@ -172,6 +172,7 @@ int GetConnected (void)
                WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
        
        if (WCC->serv_sock < 0) {
+               WCC->connected = 0;
                FreeStrBuf(&WCC->ReadBuf);
                return 1;
        }
@@ -544,11 +545,19 @@ int read_server_text(StrBuf *Buf, long *nLines)
 }
 
 
-int GetServerStatus(StrBuf *Line, long* FullState)
+int GetServerStatusMsg(StrBuf *Line, long* FullState, int PutImportantMessage, int MajorOK)
 {
+       int rc;
        if (FullState != NULL)
                *FullState = StrTol(Line);
-       return ChrPtr(Line)[0] - 48;
+       rc = ChrPtr(Line)[0] - 48;
+       if ((!PutImportantMessage) || 
+           (MajorOK == rc)||
+           (StrLength(Line) <= 4))
+               return rc;
+
+       AppendImportantMessage(ChrPtr(Line) + 4, StrLength(Line) - 4);
+       return rc;
 }