X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fvcard_edit.c;h=5ec2799afcad92107e48e7f1a57aa93cac4a3470;hb=fb6f6fa4ec4e3277e30d84326d48e6850822d318;hp=a794dddd3b9de05d199e7986dd6ac54544f55880;hpb=23f67881c0c0de5092ea849c5469b8601ce31ee4;p=citadel.git diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index a794dddd3..5ec2799af 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -1,19 +1,13 @@ /* - * Copyright (c) 1996-2011 by the citadel.org team + * Copyright (c) 1996-2012 by the citadel.org team * * This program is open source software. You can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. + * modify it under the terms of the GNU General Public License, version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "webcit.h" @@ -1280,24 +1274,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; } @@ -1341,15 +1334,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); } @@ -1362,6 +1358,7 @@ void submit_vcard(void) { else { readloop(readnew, eUseDefault); } + FreeStrBuf(&Buf); } @@ -1414,7 +1411,9 @@ int vcard_GetParamsGetServerCall(SharedMessageStatus *Stat, void **ViewSpecific, long oper, char *cmd, - long len) + long len, + char *filter, + long flen) { vcardview_struct *VS; @@ -1511,6 +1510,7 @@ InitModule_VCARD VIEW_ADDRESSBOOK, vcard_GetParamsGetServerCall, NULL, + NULL, NULL, vcard_LoadMsgFromServer, vcard_RenderView_or_Tail,