From 6ddcd59c0dff99062b7c3cdbcd8bdbc2f28563cb Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 24 Oct 2003 02:50:19 +0000 Subject: [PATCH] * Clicking "Enter Message" in a room with an Address Book view opens a blank vCard entry screen. --- webcit/ChangeLog | 5 ++ webcit/messages.c | 9 +++ webcit/vcard_edit.c | 164 +++++++++++++++++++++++--------------------- 3 files changed, 99 insertions(+), 79 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index bafab1ecc..be498c152 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,8 @@ $Log$ +Revision 502.1 2003/10/24 02:50:19 ajc +* Clicking "Enter Message" in a room with an Address Book view opens + a blank vCard entry screen. + Revision 502.0 2003/10/23 03:16:50 ajc * THIS IS 5.02 @@ -1616,3 +1620,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 01f8bb04d..1c50808b7 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -1429,6 +1429,15 @@ void display_enter(void) gotoroom(bstr("force_room"), 0); } + /* Are we perhaps in an address book view? If so, then an "enter + * message" command really means "add new entry." + */ + if (WC->wc_view == 2) { + do_edit_vcard(-1, "", ""); + return; + } + + /* Otherwise proceed normally */ output_headers(1); sprintf(buf, "ENT0 0|%s|0|0", bstr("recp")); serv_puts(buf); diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index 65f0f3fc1..1eec8b339 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -29,7 +29,10 @@ #include "vcard.h" - +/* Edit the vCard component of a MIME message. Supply the message number + * and MIME part number to fetch. Or, specify -1 for the message number + * to start with a blank card. + */ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { char buf[SIZ]; char *serialized_vcard = NULL; @@ -76,91 +79,94 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { output_headers(3); strcpy(whatuser, ""); - sprintf(buf, "MSG0 %ld|1", 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]); - } - } - sprintf(buf, "OPNA %ld|%s", msgnum, partnum); - serv_puts(buf); - serv_gets(buf); - if (buf[0] != '2') { - wDumpContent(1); - return; - } - - total_len = atoi(&buf[4]); - serialized_vcard = malloc(total_len + 1); - - read_server_binary(serialized_vcard, total_len); - - serv_puts("CLOS"); - serv_gets(buf); - serialized_vcard[total_len + 1] = 0; - - v = vcard_load(serialized_vcard); - free(serialized_vcard); - - /* Populate the variables for our form */ - i = 0; - while (key = vcard_get_prop(v, "", 0, i, 1), key != NULL) { - value = vcard_get_prop(v, "", 0, i++, 0); - - if (!strcasecmp(key, "n")) { - extract_token(lastname, value, 0, ';'); - extract_token(firstname, value, 1, ';'); - extract_token(middlename, value, 2, ';'); - extract_token(prefix, value, 3, ';'); - extract_token(suffix, value, 4, ';'); - } - - else if (!strcasecmp(key, "adr")) { - extract_token(pobox, value, 0, ';'); - extract_token(extadr, value, 1, ';'); - extract_token(street, value, 2, ';'); - extract_token(city, value, 3, ';'); - extract_token(state, value, 4, ';'); - extract_token(zipcode, value, 5, ';'); - extract_token(country, value, 6, ';'); + if (msgnum >= 0) { + sprintf(buf, "MSG0 %ld|1", msgnum); + serv_puts(buf); + serv_gets(buf); + if (buf[0] != '1') { + wDumpContent(1); + return; } - - else if (!strcasecmp(key, "tel;home")) { - extract_token(hometel, value, 0, ';'); + 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]); + } } - - else if (!strcasecmp(key, "tel;work")) { - extract_token(worktel, value, 0, ';'); + + sprintf(buf, "OPNA %ld|%s", msgnum, partnum); + serv_puts(buf); + serv_gets(buf); + if (buf[0] != '2') { + wDumpContent(1); + return; } - - else if (!strcasecmp(key, "email;internet")) { - if (inetemail[0] != 0) { - strcat(inetemail, "\n"); + + total_len = atoi(&buf[4]); + serialized_vcard = malloc(total_len + 1); + + read_server_binary(serialized_vcard, total_len); + + serv_puts("CLOS"); + serv_gets(buf); + serialized_vcard[total_len + 1] = 0; + + v = vcard_load(serialized_vcard); + free(serialized_vcard); + + /* Populate the variables for our form */ + i = 0; + while (key = vcard_get_prop(v, "", 0, i, 1), key != NULL) { + value = vcard_get_prop(v, "", 0, i++, 0); + + if (!strcasecmp(key, "n")) { + extract_token(lastname, value, 0, ';'); + extract_token(firstname, value, 1, ';'); + extract_token(middlename, value, 2, ';'); + extract_token(prefix, value, 3, ';'); + extract_token(suffix, value, 4, ';'); } - strcat(inetemail, value); - } - - else { - strcat(extrafields, key); - strcat(extrafields, ":"); - strcat(extrafields, value); - strcat(extrafields, "\n"); + + else if (!strcasecmp(key, "adr")) { + extract_token(pobox, value, 0, ';'); + extract_token(extadr, value, 1, ';'); + extract_token(street, value, 2, ';'); + extract_token(city, value, 3, ';'); + extract_token(state, value, 4, ';'); + extract_token(zipcode, value, 5, ';'); + extract_token(country, value, 6, ';'); + } + + else if (!strcasecmp(key, "tel;home")) { + extract_token(hometel, value, 0, ';'); + } + + else if (!strcasecmp(key, "tel;work")) { + extract_token(worktel, value, 0, ';'); + } + + else if (!strcasecmp(key, "email;internet")) { + if (inetemail[0] != 0) { + strcat(inetemail, "\n"); + } + strcat(inetemail, value); + } + + else { + strcat(extrafields, key); + strcat(extrafields, ":"); + strcat(extrafields, value); + strcat(extrafields, "\n"); + } + } - - } - vcard_free(v); + vcard_free(v); + } /* Display the form */ do_template("beginbox_nt"); -- 2.39.2