]> code.citadel.org Git - citadel.git/commitdiff
* Begin work on better handling of vCard display
authorArt Cancro <ajc@citadel.org>
Wed, 8 Oct 2003 02:33:49 +0000 (02:33 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 8 Oct 2003 02:33:49 +0000 (02:33 +0000)
webcit/ChangeLog
webcit/messages.c

index ad3a91377da20e8c1ac5df8fadd69b89ee0e745b..d2b84937d66cffa0e30b3e0907e055016a34dd51 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 500.26  2003/10/08 02:33:49  ajc
+* Begin work on better handling of vCard display
+
 Revision 500.25  2003/09/04 03:41:27  ajc
 * siteconfig.c: changed some config items to drop-down boxes
 
@@ -1585,4 +1588,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 5d5785d15d8b3a248b6d3a49416df104b7b6a18a..af6067775172c266e83abc1aed3a89deb639310c 100644 (file)
@@ -120,6 +120,8 @@ void display_parsed_vcard(struct vCard *v, int full) {
        char buf[SIZ];
        char *name;
 
+       char *thisname, *thisvalue;
+
        if (!full) {
                wprintf("<TD>");
                name = vcard_get_prop(v, "n", 1, 0, 0);
@@ -136,28 +138,34 @@ void display_parsed_vcard(struct vCard *v, int full) {
 
        wprintf("<TABLE bgcolor=#888888>");
        if (v->numprops) for (i=0; i<(v->numprops); ++i) {
-               if (!strcasecmp(v->prop[i].name, "n")) {
+
+               thisname = strdup(v->prop[i].name);
+               thisvalue = strdup(v->prop[i].value);
+
+               /* FIXME handle base64 and qp encodings here */
+
+               if (!strcasecmp(thisname, "n")) {
                        wprintf("<TR BGCOLOR=\"#AAAAAA\">"
                        "<TD BGCOLOR=\"#FFFFFF\">"
                        "<IMG ALIGN=CENTER SRC=\"/static/vcard.gif\"></TD>"
                        "<TD><FONT SIZE=+1><B>");
-                       escputs(v->prop[i].value);
+                       escputs(thisvalue);
                        wprintf("</B></FONT></TD></TR>\n");
                }
-               else if (!strcasecmp(v->prop[i].name, "email;internet")) {
+               else if (!strcasecmp(thisname, "email;internet")) {
                        wprintf("<TR><TD>Internet e-mail:</TD>"
                                "<TD>"
                                "<A HREF=\"/display_enter"
                                "?force_room=_MAIL_&recp=");
-                       urlescputs(v->prop[i].value);
+                       urlescputs(thisvalue);
                        wprintf("\">");
-                       escputs(v->prop[i].value);
+                       escputs(thisvalue);
                        wprintf("</A></TD></TR>\n");
                }
-               else if (!strcasecmp(v->prop[i].name, "adr")) {
+               else if (!strcasecmp(thisname, "adr")) {
                        wprintf("<TR><TD>Address:</TD><TD>");
-                       for (j=0; j<num_tokens(v->prop[i].value, ';'); ++j) {
-                               extract_token(buf, v->prop[i].value, j, ';');
+                       for (j=0; j<num_tokens(thisvalue, ';'); ++j) {
+                               extract_token(buf, thisvalue, j, ';');
                                if (strlen(buf) > 0) {
                                        escputs(buf);
                                        wprintf("<BR>");
@@ -165,11 +173,11 @@ void display_parsed_vcard(struct vCard *v, int full) {
                        }
                        wprintf("</TD></TR>\n");
                }
-               else if (!strncasecmp(v->prop[i].name, "tel;", 4)) {
+               else if (!strncasecmp(thisname, "tel;", 4)) {
                        wprintf("<TR><TD>%s telephone:</TD><TD>",
-                               &v->prop[i].name[4]);
-                       for (j=0; j<num_tokens(v->prop[i].value, ';'); ++j) {
-                               extract_token(buf, v->prop[i].value, j, ';');
+                               &thisname[4]);
+                       for (j=0; j<num_tokens(thisvalue, ';'); ++j) {
+                               extract_token(buf, thisvalue, j, ';');
                                if (strlen(buf) > 0) {
                                        escputs(buf);
                                        wprintf("<BR>");
@@ -179,11 +187,15 @@ void display_parsed_vcard(struct vCard *v, int full) {
                }
                else {
                        wprintf("<TR><TD>");
-                       escputs(v->prop[i].name);
+                       escputs(thisname);
                        wprintf("</TD><TD>");
-                       escputs(v->prop[i].value);
+                       escputs(thisvalue);
                        wprintf("</TD></TR>\n");
                }
+
+               free(thisname);
+               free(thisvalue);
+
        }
        wprintf("</TABLE>\n");
 }