From 3ae4c1e0cca6232517ab300f602d235a5cdaf27c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 7 Mar 2002 04:56:09 +0000 Subject: [PATCH] * Final polish for initial round of vCard editing functions. Only show "edit" link when editing user's own vCard in the My Citadel Config> room. --- webcit/ChangeLog | 5 +++++ webcit/messages.c | 20 ++++++++++++-------- webcit/vcard_edit.c | 33 +++++++++++++++++++++++++++++++-- webcit/webcit.h | 2 ++ 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index cb15edbfb..fbdc01f65 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 323.10 2002/03/07 04:56:09 ajc +* Final polish for initial round of vCard editing functions. Only show "edit" + link when editing user's own vCard in the My Citadel Config> room. + Revision 323.9 2002/03/06 05:22:33 ajc * More vcard editing form stuff @@ -738,3 +742,4 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix + diff --git a/webcit/messages.c b/webcit/messages.c index 15e514ba3..3d0502adc 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -98,7 +98,10 @@ void display_vcard(char *vcard_source) { wprintf(""); if (v->numprops) for (i=0; i<(v->numprops); ++i) { if (!strcasecmp(v->prop[i].name, "n")) { - wprintf("" + "" + "\n"); } @@ -392,14 +395,15 @@ void read_message(long msgnum, int is_summary) { vcard_source = load_mimepart(msgnum, vcard_partnum); if (vcard_source != NULL) { - /* FIXME this is a temporary hack to make the screen usable - * while we build it. We need a more intuitive way of getting - * in. - */ - wprintf("", - msgnum, vcard_partnum); - wprintf("(edit)"); + /* If it's my vCard I can edit it */ + if (!strcasecmp(WC->wc_roomname, USERCONFIGROOM)) { + wprintf("", + msgnum, vcard_partnum); + wprintf("(edit)"); + } + /* In all cases, display it */ display_vcard(vcard_source); free(vcard_source); } diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index e920ec942..99c629d84 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -39,6 +39,7 @@ void edit_vcard(void) { struct vCard *v; int i; char *key, *value; + char whatuser[SIZ]; char lastname[SIZ]; char firstname[SIZ]; @@ -73,6 +74,28 @@ void edit_vcard(void) { extrafields[0] = 0; output_headers(1); + + strcpy(whatuser, ""); + sprintf(buf, "MSG0 %s|1", bstr("msgnum") ); + serv_puts(buf); + serv_gets(buf); + if (buf[0] != '1') { + wDumpContent(1); + return; + } + while (serv_gets(buf), strcmp(buf, "000")) { + if (!strncasecmp(buf, "from=", 5)) { + strcpy(whatuser, &buf[5]); + } + else if (!strncasecmp(buf, "node=", 5)) { + strcat(whatuser, " @ "); + strcat(whatuser, &buf[5]); + } + } + + total_len = atoi(&buf[4]); + + sprintf(buf, "OPNA %s|%s", bstr("msgnum"), bstr("partnum") ); serv_puts(buf); serv_gets(buf); @@ -151,7 +174,9 @@ void edit_vcard(void) { /* Display the form */ wprintf("\n"); wprintf("

" - "Contact information for FIXME

\n"); + "Contact information for "); + escputs(whatuser); + wprintf("\n"); wprintf("
"); + wprintf("
" + ""); escputs(v->prop[i].value); wprintf("
" "" @@ -231,6 +256,10 @@ void edit_vcard(void) { void submit_vcard(void) { char buf[SIZ]; + if (strcmp(bstr("sc"), "OK")) { + readloop("readnew"); + return; + } sprintf(buf, "ENT0 1|||4||"); fprintf(stderr, "%s\n", buf); @@ -265,5 +294,5 @@ void submit_vcard(void) { serv_puts("end:vcard"); serv_puts("000"); - edit_vcard(); + readloop("readnew"); } diff --git a/webcit/webcit.h b/webcit/webcit.h index 18cfeea3d..86a87b5c0 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -21,6 +21,8 @@ #define INITIAL_WORKER_THREADS 5 #define LISTEN_QUEUE_LENGTH 100 /* listen() backlog queue */ +#define USERCONFIGROOM "My Citadel Config" + /* Room flags (from Citadel) */ #define QR_PERMANENT 1 /* Room does not purge */ -- 2.39.2
Prefix