X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmainmenu.c;h=31aec39861201d1ab941a9dc5b0ebc399d66a754;hb=HEAD;hp=d62a0bdbd8fb7948f2a725a430440f6ea63a311a;hpb=5b4b70e8e3298f102239217d49c1aff65cdd6fd3;p=citadel.git diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index d62a0bdbd..2c326e001 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -43,60 +43,68 @@ void do_generic(void) { char *junk; size_t len; - if (!havebstr("sc_button")) { + if ( (!havebstr("sc_button")) && (!havebstr("ok_button")) && (!havebstr("cancel_button")) ) { display_main_menu(); return; } - Buf = NewStrBuf(); - serv_puts(bstr("g_cmd")); - StrBuf_ServGetln(Buf); - - switch (GetServerStatus(Buf, NULL)) { - case 8: - serv_puts("\n\n000"); - if ( (StrLength(Buf)==3) && - !strcmp(ChrPtr(Buf), "000")) { - StrBufAppendBufPlain(Buf, HKEY("\000"), 0); - break; - } - case 1: - LineBuf = NewStrBuf(); - StrBufAppendBufPlain(Buf, HKEY("\n"), 0); - while (!Done) { - if (StrBuf_ServGetln(LineBuf) < 0) + if (havebstr("cancel_button")) { + AppendImportantMessage(_("Cancelled. Changes were not saved."), -1); + } + + if (havebstr("ok_button")) { + Buf = NewStrBuf(); + serv_puts(bstr("g_cmd")); + StrBuf_ServGetln(Buf); + + switch (GetServerStatus(Buf, NULL)) { + case 8: + serv_puts("\n\n000"); + if ( (StrLength(Buf)==3) && + !strcmp(ChrPtr(Buf), "000")) { + StrBufAppendBufPlain(Buf, HKEY("\000"), 0); break; - if ( (StrLength(LineBuf)==3) && - !strcmp(ChrPtr(LineBuf), "000")) { - Done = 1; } - StrBufAppendBuf(Buf, LineBuf, 0); + case 1: + LineBuf = NewStrBuf(); StrBufAppendBufPlain(Buf, HKEY("\n"), 0); + while (!Done) { + if (StrBuf_ServGetln(LineBuf) < 0) + break; + if ( (StrLength(LineBuf)==3) && + !strcmp(ChrPtr(LineBuf), "000")) { + Done = 1; + } + StrBufAppendBuf(Buf, LineBuf, 0); + StrBufAppendBufPlain(Buf, HKEY("\n"), 0); + } + FreeStrBuf(&LineBuf); + break; + case 2: + break; + case 4: + text_to_server(bstr("g_input")); + serv_puts("000"); + break; + case 6: + len = atol(&ChrPtr(Buf)[4]); + StrBuf_ServGetBLOBBuffered(Buf, len); + break; + case 7: + len = atol(&ChrPtr(Buf)[4]); + junk = malloc(len); + memset(junk, 0, len); + serv_write(junk, len); + free(junk); + break; } - FreeStrBuf(&LineBuf); - break; - case 2: - break; - case 4: - text_to_server(bstr("g_input")); - serv_puts("000"); - break; - case 6: - len = atol(&ChrPtr(Buf)[4]); - StrBuf_ServGetBLOBBuffered(Buf, len); - break; - case 7: - len = atol(&ChrPtr(Buf)[4]); - junk = malloc(len); - memset(junk, 0, len); - serv_write(junk, len); - free(junk); - break; + FreeStrBuf(&Buf); } - + // We may have been supplied with instructions regarding the location // to which we must return after posting. If found, go there. if (havebstr("return_to")) { + syslog(LOG_DEBUG, "return_to = %s", bstr("return_to")); http_redirect(bstr("return_to")); } @@ -113,7 +121,6 @@ void do_generic(void) { wDumpContent(1); } - FreeStrBuf(&Buf); }