From: Art Cancro Date: Sat, 1 Mar 2003 22:07:19 +0000 (+0000) Subject: * New user registration, as well as existing user re-registration, now X-Git-Tag: v7.86~5986 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=728f8b13e0f45cd677895582efe985a596a49f61;p=citadel.git * New user registration, as well as existing user re-registration, now uses the vCard editing screen. * Administratively editing users' address book entries now works again, mainly due to a fix in the Citadel server. Now requiring Citadel 6.06 in order to enforce this. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index b6c7d4d7b..b8a5d6f88 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,11 @@ $Log$ +Revision 410.1 2003/03/01 22:07:19 ajc +* New user registration, as well as existing user re-registration, now + uses the vCard editing screen. +* Administratively editing users' address book entries now works again, + mainly due to a fix in the Citadel server. Now requiring Citadel 6.06 + in order to enforce this. + Revision 410.0 2003/02/19 03:49:33 ajc * THIS IS 4.10 @@ -1273,3 +1280,4 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix + diff --git a/webcit/auth.c b/webcit/auth.c index 814a43b68..c0f23ae30 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -286,9 +286,6 @@ void validate(void) - - - /* * Display form for registration. * (Set during_login to 1 if this registration is being performed during @@ -296,105 +293,29 @@ void validate(void) */ void display_reg(int during_login) { - char buf[SIZ]; - int a; + long vcard_msgnum; - output_headers(3); - - wprintf("
"); - wprintf("Enter registration info\n"); - wprintf("
\n"); - - wprintf("
"); - serv_puts("MESG register"); - serv_gets(buf); - if (buf[0] == '1') - fmout(NULL); - - wprintf("
\n"); - wprintf("\n", during_login); - - serv_puts("GREG _SELF_"); - serv_gets(buf); - if (buf[0] != '1') { - wprintf("%s
\n", &buf[4]); - } else { - - wprintf("

%s

\n", &buf[4]); - a = 0; - while (serv_gets(buf), strcmp(buf, "000")) { - ++a; - wprintf("\n"); - } - wprintf("
"); - switch (a) { - case 3: - wprintf("Real Name:
\n", buf); - break; - case 4: - wprintf("Street Address:

\n", buf); - break; - case 5: - wprintf("City/town:

\n", buf); - break; - case 6: - wprintf("State/province:

\n", buf); - break; - case 7: - wprintf("ZIP/postal code:

\n", buf); - break; - case 8: - wprintf("Telephone:

\n", buf); - break; - case 10: - wprintf("E-Mail:

\n", buf); - break; - case 11: - wprintf("Country:

\n", buf); - break; - } - wprintf("

"); + if (goto_config_room() != 0) { + if (during_login) do_welcome(); + else display_main_menu(); + return; } - wprintf("\n"); - wprintf("\n"); - wprintf("

\n"); - wDumpContent(1); -} - -/* - * register - */ -void register_user(void) -{ - char buf[SIZ]; - if (strcmp(bstr("action"), "Register")) { - display_error("Cancelled. Registration was not saved."); + vcard_msgnum = locate_user_vcard(WC->wc_username, -1); + if (vcard_msgnum < 0L) { + if (during_login) do_welcome(); + else display_main_menu(); return; } - serv_puts("REGI"); - serv_gets(buf); - if (buf[0] != '4') { - display_error(&buf[4]); + + if (during_login) { + do_edit_vcard(vcard_msgnum, "1", "/do_welcome"); } - serv_puts(bstr("realname")); - serv_puts(bstr("address")); - serv_puts(bstr("city")); - serv_puts(bstr("state")); - serv_puts(bstr("zip")); - serv_puts(bstr("phone")); - serv_puts(bstr("email")); - serv_puts(bstr("country")); - serv_puts("000"); - - if (atoi(bstr("during_login"))) { - do_welcome(); - } else { - display_success("Registration information has been saved."); + else { + do_edit_vcard(vcard_msgnum, "1", "/display_main_menu"); } -} +} diff --git a/webcit/preferences.c b/webcit/preferences.c index 916f55824..9ae4de5f9 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -34,8 +34,6 @@ void load_preferences(void) { char buf[SIZ]; long msgnum = 0L; - lprintf(9, "entering load_preferences()\n"); - serv_printf("GOTO %s", USERCONFIGROOM); serv_gets(buf); if (buf[0] != '2') return; @@ -80,14 +78,15 @@ void load_preferences(void) { /* Go back to the room we're supposed to be in */ serv_printf("GOTO %s", WC->wc_roomname); serv_gets(buf); - lprintf(9, "exiting load_preferences()\n"); } -void save_preferences(void) { +/* + * Goto the user's configuration room, creating it if necessary. + * Returns 0 on success or nonzero upon failure. + */ +int goto_config_room(void) { char buf[SIZ]; - long msgnum = 0L; - lprintf(9, "entering save_preferences()\n"); serv_printf("GOTO %s", USERCONFIGROOM); serv_gets(buf); if (buf[0] != '2') { /* try to create the config room if not there */ @@ -95,9 +94,17 @@ void save_preferences(void) { serv_gets(buf); serv_printf("GOTO %s", USERCONFIGROOM); serv_gets(buf); - if (buf[0] != '2') return; /* oh well. */ + if (buf[0] != '2') return(1); } + return(0); +} + + +void save_preferences(void) { + char buf[SIZ]; + long msgnum = 0L; + if (goto_config_room() != 0) return; /* oh well. */ serv_puts("MSGS ALL|0|1"); serv_gets(buf); if (buf[0] == '8') { @@ -124,7 +131,6 @@ void save_preferences(void) { /* Go back to the room we're supposed to be in */ serv_printf("GOTO %s", WC->wc_roomname); serv_gets(buf); - lprintf(9, "exiting save_preferences()\n"); } void get_preference(char *key, char *value) { @@ -133,7 +139,6 @@ void get_preference(char *key, char *value) { char buf[SIZ]; char thiskey[SIZ]; - lprintf(9, "entering get_preference(%s)\n", key); strcpy(value, ""); num_prefs = num_tokens(WC->preferences, '\n'); @@ -144,7 +149,6 @@ void get_preference(char *key, char *value) { extract_token(value, buf, 1, '|'); } } - lprintf(9, "exiting get_preference() = %s\n", value); } void set_preference(char *key, char *value) { @@ -154,7 +158,6 @@ void set_preference(char *key, char *value) { char thiskey[SIZ]; char *newprefs = NULL; - lprintf(9, "entering set_preference(%s, %s)\n", key, value); num_prefs = num_tokens(WC->preferences, '\n'); for (i=0; ipreferences, i, '\n'); @@ -179,5 +182,4 @@ void set_preference(char *key, char *value) { WC->preferences = newprefs; save_preferences(); - lprintf(9, "exiting set_preference()\n"); } diff --git a/webcit/useredit.c b/webcit/useredit.c index 8424f9d91..494bd4fed 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -88,12 +88,10 @@ void select_user_to_edit(char *message, char *preselect) /* - * Display the form for editing a user's address book entry + * Locate the message number of a user's vCard in the current room */ -void display_edit_address_book_entry(char *username, long usernum) { - char roomname[SIZ]; +long locate_user_vcard(char *username, long usernum) { char buf[SIZ]; - char error_message[SIZ]; long vcard_msgnum = (-1L); char content_type[SIZ]; char partnum[SIZ]; @@ -107,25 +105,6 @@ void display_edit_address_book_entry(char *username, long usernum) { struct stuff_t *stuff = NULL; struct stuff_t *ptr; - - /* Locate the user's config room, creating it if necessary */ - sprintf(roomname, "%010ld.%s", usernum, USERCONFIGROOM); - serv_printf("GOTO %s||1", roomname); - serv_gets(buf); - if (buf[0] != '2') { - serv_printf("CRE8 1|%s|5|||1|", roomname); - serv_gets(buf); - serv_printf("GOTO %s||1", roomname); - serv_gets(buf); - if (buf[0] != '2') { - sprintf(error_message, - "" - "%s

\n", &buf[4]); - select_user_to_edit(error_message, username); - return; - } - } - TRYAGAIN: /* Search for the user's vCard */ serv_puts("MSGS ALL"); @@ -137,7 +116,7 @@ TRYAGAIN: stuff = ptr; } - /* Iterate throught the message list looking for vCards */ + /* Iterate through the message list looking for vCards */ while (stuff != NULL) { serv_printf("MSG0 %ld|2", stuff->msgnum); serv_gets(buf); @@ -159,8 +138,6 @@ TRYAGAIN: stuff = ptr; } - lprintf(9, "vcard_msgnum == %ld\n", vcard_msgnum); - /* If there's no vcard, create one */ if (vcard_msgnum < 0) if (already_tried_creating_one == 0) { already_tried_creating_one = 1; @@ -176,10 +153,45 @@ TRYAGAIN: goto TRYAGAIN; } + return(vcard_msgnum); +} + + +/* + * Display the form for editing a user's address book entry + */ +void display_edit_address_book_entry(char *username, long usernum) { + char roomname[SIZ]; + char buf[SIZ]; + char error_message[SIZ]; + long vcard_msgnum = (-1L); + + /* Locate the user's config room, creating it if necessary */ + sprintf(roomname, "%010ld.%s", usernum, USERCONFIGROOM); + serv_printf("GOTO %s||1", roomname); + serv_gets(buf); + if (buf[0] != '2') { + serv_printf("CRE8 1|%s|5|||1|", roomname); + serv_gets(buf); + serv_printf("GOTO %s||1", roomname); + serv_gets(buf); + if (buf[0] != '2') { + sprintf(error_message, + "" + "%s

\n", &buf[4]); + select_user_to_edit(error_message, username); + return; + } + } + + vcard_msgnum = locate_user_vcard(username, usernum); + if (vcard_msgnum < 0) { sprintf(error_message, "" - "Could not create/edit vCard

\n"); + "Could not create/edit vCard" + "

\n" + ); select_user_to_edit(error_message, username); return; } diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index 8a9d1b429..8365b54c8 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -250,7 +250,6 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { wprintf(""); wprintf("\n"); - wDumpContent(1); } @@ -319,6 +318,9 @@ void submit_vcard(void) { if (!strcmp(bstr("return_to"), "/select_user_to_edit")) { select_user_to_edit(NULL, NULL); } + else if (!strcmp(bstr("return_to"), "/do_welcome")) { + do_welcome(); + } else { readloop("readnew"); } diff --git a/webcit/webcit.c b/webcit/webcit.c index 1233b04a4..26c0e06d2 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1039,8 +1039,6 @@ void session_loop(struct httprequest *req) do_graphics_upload(buf); } else if (!strcasecmp(action, "display_reg")) { display_reg(0); - } else if (!strcasecmp(action, "register")) { - register_user(); } else if (!strcasecmp(action, "display_changepw")) { display_changepw(); } else if (!strcasecmp(action, "changepw")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index cd7bfc4cc..08473b0d9 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -28,7 +28,7 @@ #define DEVELOPER_ID 0 #define CLIENT_ID 4 #define CLIENT_VERSION 410 /* This version of WebCit */ -#define MINIMUM_CIT_VERSION 605 /* min required Citadel vers */ +#define MINIMUM_CIT_VERSION 606 /* min required Citadel vers */ #define DEFAULT_HOST "localhost" /* Default Citadel server */ #define DEFAULT_PORT "504" #define LB (1) /* Internal escape chars */ @@ -292,7 +292,6 @@ void serv_puts(char *string); void serv_printf(const char *format,...); void load_floorlist(void); void display_reg(int); -void register_user(void); void display_changepw(void); void changepw(void); void display_edit_node(void); @@ -388,4 +387,6 @@ void partstat_as_string(char *buf, icalproperty *attendee); extern char *months[]; extern char *days[]; void read_server_binary(char *buffer, size_t total_len); +int goto_config_room(void); +long locate_user_vcard(char *username, long usernum); void sleeeeeeeeeep(int);