X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fvcard_edit.c;h=9c8bd3b0c4c76b899883eb610e0df2308d633a7e;hb=4b4dc864ede7c5d8d956febe4a0afb422b78e7c4;hp=1e1e222970f2b75e3bae7a0d40c7b4d1e00f2c37;hpb=814d4bec141c8374ef72a60aeeded0d696483c5e;p=citadel.git diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index 1e1e22297..9c8bd3b0c 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -252,7 +252,7 @@ void fetchname_parsed_vcard(struct vCard *v, char **storename) { } } if (is_qp) { - // %ff can become 6 bytes in utf8 + /* %ff can become 6 bytes in utf8 */ *storename = malloc(len * 2 + 3); j = CtdlDecodeQuotedPrintable( *storename, name, @@ -260,7 +260,7 @@ void fetchname_parsed_vcard(struct vCard *v, char **storename) { (*storename)[j] = 0; } else if (is_b64) { - // ff will become one byte.. + /* ff will become one byte.. */ *storename = malloc(len + 50); CtdlDecodeBase64( *storename, name, @@ -1243,11 +1243,11 @@ void edit_vcard(void) { * parse edited vcard from the browser */ void submit_vcard(void) { - wcsession *WCC = WC; struct vCard *v; char *serialized_vcard; char buf[SIZ]; StrBuf *Buf; + const StrBuf *ForceRoom; int i; if (!havebstr("ok_button")) { @@ -1256,19 +1256,13 @@ void submit_vcard(void) { } if (havebstr("force_room")) { - if (gotoroom(sbstr("force_room")) != 200) { - StrBufAppendBufPlain(WCC->ImportantMsg, - _("Unable to enter the room to save your message"), - -1, 0); - StrBufAppendBufPlain(WCC->ImportantMsg, - HKEY(": "), 0); - StrBufAppendBuf(WCC->ImportantMsg, sbstr("force_room"), 0); - StrBufAppendBufPlain(WCC->ImportantMsg, - HKEY("; "), 0); - - StrBufAppendBufPlain(WCC->ImportantMsg, - _("Aborting."), - -1, 0); + ForceRoom = sbstr("force_room"); + if (gotoroom(ForceRoom) != 200) { + AppendImportantMessage(_("Unable to enter the room to save your message"), -1); + AppendImportantMessage(HKEY(": ")); + AppendImportantMessage(SKEY(ForceRoom)); + AppendImportantMessage(HKEY("; ")); + AppendImportantMessage(_("Aborting."), -1); if (!strcmp(bstr("return_to"), "select_user_to_edit")) { select_user_to_edit(NULL); @@ -1286,24 +1280,23 @@ void submit_vcard(void) { } } - sprintf(buf, "ENT0 1|||4||"); - serv_puts(buf); - serv_getln(buf, sizeof buf); - if (buf[0] != '4') { + Buf = NewStrBuf(); + serv_write(HKEY("ENT0 1|||4||||||1\n")); + if (!StrBuf_ServGetln(Buf) && (GetServerStatus(Buf, NULL) != 4)) + { edit_vcard(); return; } /* Make a vCard structure out of the data supplied in the form */ - Buf = NewStrBuf(); StrBufPrintf(Buf, "begin:vcard\r\n%s\r\nend:vcard\r\n", bstr("extrafields") ); v = VCardLoad(Buf); /* Start with the extra fields */ - FreeStrBuf(&Buf); if (v == NULL) { AppendImportantMessage(_("An error has occurred."), -1); edit_vcard(); + FreeStrBuf(&Buf); return; } @@ -1347,15 +1340,18 @@ void submit_vcard(void) { if (serialized_vcard == NULL) { AppendImportantMessage(_("An error has occurred."), -1); edit_vcard(); + FreeStrBuf(&Buf); return; } - serv_puts("Content-type: text/x-vcard; charset=UTF-8"); - serv_puts(""); + serv_write(HKEY("Content-type: text/x-vcard; charset=UTF-8\n")); + serv_write(HKEY("\n")); serv_printf("%s\r\n", serialized_vcard); - serv_puts("000"); + serv_write(HKEY("000\n")); free(serialized_vcard); + StrBuf_ServGetln(Buf); + if (!strcmp(bstr("return_to"), "select_user_to_edit")) { select_user_to_edit(NULL); } @@ -1368,6 +1364,7 @@ void submit_vcard(void) { else { readloop(readnew, eUseDefault); } + FreeStrBuf(&Buf); } @@ -1420,7 +1417,9 @@ int vcard_GetParamsGetServerCall(SharedMessageStatus *Stat, void **ViewSpecific, long oper, char *cmd, - long len) + long len, + char *filter, + long flen) { vcardview_struct *VS; @@ -1517,6 +1516,7 @@ InitModule_VCARD VIEW_ADDRESSBOOK, vcard_GetParamsGetServerCall, NULL, + NULL, NULL, vcard_LoadMsgFromServer, vcard_RenderView_or_Tail,