* Handle multiple Internet e-mail addresses in vCard editor
authorArt Cancro <ajc@citadel.org>
Sun, 10 Mar 2002 06:07:09 +0000 (06:07 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 10 Mar 2002 06:07:09 +0000 (06:07 +0000)
webcit/ChangeLog
webcit/vcard_edit.c

index fbdc01f6560a350879feedd7428beb26195e0246..cde9bd6328bc78bfeed6468af86ef1e85f96d025 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 323.11  2002/03/10 06:07:09  ajc
+* Handle multiple Internet e-mail addresses in vCard editor
+
 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.
@@ -742,4 +745,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index 99c629d842f3e5300dc057e4258f8c8d393f8236..58047f7b8c85d937e10f889194751fee14c22dc3 100644 (file)
@@ -55,6 +55,7 @@ void edit_vcard(void) {
        char country[SIZ];
        char hometel[SIZ];
        char worktel[SIZ];
+       char inetemail[SIZ];
        char extrafields[SIZ];
 
        lastname[0] = 0;
@@ -71,6 +72,7 @@ void edit_vcard(void) {
        country[0] = 0;
        hometel[0] = 0;
        worktel[0] = 0;
+       inetemail[0] = 0;
        extrafields[0] = 0;
 
        output_headers(1);
@@ -160,6 +162,13 @@ void edit_vcard(void) {
                        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, ":");
@@ -238,6 +247,14 @@ void edit_vcard(void) {
                "VALUE=\"%s\" MAXLENGTH=\"29\"></TD></TR></TABLE>\n",
                worktel);
 
+       wprintf("<TABLE border=0><TR><TD>Internet e-mail addresses:<BR>"
+               "<FONT size=-2>For addresses in the Citadel directory, "
+               "the topmost address will be used in outgoing mail."
+               "</FONT></TD><TD>"
+               "<TEXTAREA NAME=\"inetemail\" ROWS=5 COLS=40 WIDTH=40>");
+       escputs(inetemail);
+       wprintf("</TEXTAREA></TD></TR></TABLE><BR>\n");
+
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"extrafields\" VALUE=\"");
        escputs(extrafields);
        wprintf("\">\n");
@@ -255,6 +272,7 @@ void edit_vcard(void) {
 
 void submit_vcard(void) {
        char buf[SIZ];
+       int i;
 
        if (strcmp(bstr("sc"), "OK")) { 
                readloop("readnew");
@@ -290,6 +308,14 @@ void submit_vcard(void) {
                bstr("country") );
        serv_printf("tel;home:%s", bstr("hometel") );
        serv_printf("tel;work:%s", bstr("worktel") );
+       
+       for (i=0; i<num_tokens(bstr("inetemail"), '\n'); ++i) {
+               extract_token(buf, bstr("inetemail"), i, '\n');
+               if (strlen(buf) > 0) {
+                       serv_printf("email;internet:%s", buf);
+               }
+       }
+
        serv_printf("%s", bstr("extrafields") );
        serv_puts("end:vcard");
        serv_puts("000");