* evaluate server status code, this will lock us up if we're trying to read the messa...
authorWilfried Göesgens <willi@citadel.org>
Sat, 18 Apr 2009 12:41:37 +0000 (12:41 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 18 Apr 2009 12:41:37 +0000 (12:41 +0000)
webcit/serv_func.c

index 5fc0996bd1ca00f33585babd08ddb0d96323dc42..63d77171724d506af5dd98c4286fba023f1f763e 100644 (file)
@@ -607,22 +607,26 @@ void tmplput_mesg(StrBuf *Target, WCTemplputParams *TP)
        Buf = NewStrBuf();
        Line = NewStrBuf();
        serv_printf("MESG %s", TP->Tokens->Params[0]->Start);
+
        StrBuf_ServGetln(Line);
-       while (!Done &&  (StrBuf_ServGetln(Line)>=0)) {
-               if ( (StrLength(Line)==3) && 
-                   !strcmp(ChrPtr(Line), "000")) 
-                       Done = 1;
-               else
-               {
-                       if (n > 0)
-                               StrBufAppendBufPlain(Buf, "\n", 1, 0);
-                       StrBufAppendBuf(Buf, Line, 0);
+       if (GetServerStatus(Line, NULL) == 1) {
+               while (!Done &&  (StrBuf_ServGetln(Line)>=0)) {
+                       if ( (StrLength(Line)==3) && 
+                            !strcmp(ChrPtr(Line), "000")) 
+                               Done = 1;
+                       else
+                       {
+                               if (n > 0)
+                                       StrBufAppendBufPlain(Buf, "\n", 1, 0);
+                               StrBufAppendBuf(Buf, Line, 0);
+                       }
+                       n++;
                }
-               n++;
+       
+               FlushStrBuf(Line);
+               FmOut(Line, "center", Buf);
+               StrBufAppendTemplate(Target, TP, Line, 1);
        }
-       FlushStrBuf(Line);
-       FmOut(Line, "center", Buf);
-       StrBufAppendTemplate(Target, TP, Line, 1);
        FreeStrBuf(&Buf);
        FreeStrBuf(&Line);
 }