* Moved to the new string tokenizer API
[citadel.git] / webcit / messages.c
index b3e55205cb549d14404cc1c4f9ade8a0c7b5bf24..fddc4894851cfa85e8f62f467cf5b297a8086be2 100644 (file)
@@ -91,25 +91,57 @@ char buf[];
 }
 
 
+/*
+ * Turn a vCard "n" (name) field into something displayable.
+ */
+void vcard_n_prettyize(char *name)
+{
+       char *original_name;
+       int i;
+
+       original_name = strdup(name);
+       for (i=0; i<5; ++i) {
+               if (strlen(original_name) > 0) {
+                       if (original_name[strlen(original_name)-1] == ' ') {
+                               original_name[strlen(original_name)-1] = 0;
+                       }
+                       if (original_name[strlen(original_name)-1] == ';') {
+                               original_name[strlen(original_name)-1] = 0;
+                       }
+               }
+       }
+       strcpy(name, "");
+       for (i=0; i<strlen(original_name); ++i) {
+               if (original_name[i] == ';') {
+                       strcat(name, ", ");
+               }
+               else {
+                       name[strlen(name)+1] = 0;
+                       name[strlen(name)] = original_name[i];
+               }
+       }
+       free(original_name);
+}
+
+
+
+
 /* display_vcard() calls this after parsing the textual vCard into
  * our 'struct vCard' data object.
  * This gets called instead of display_parsed_vcard() if we are only looking
  * to extract the person's name instead of displaying the card.
  */
 void fetchname_parsed_vcard(struct vCard *v, char *storename) {
-       int i;
+       char *name;
 
        strcpy(storename, "");
-       if (v->numprops) for (i=0; i<(v->numprops); ++i) {
-               if (!strcasecmp(v->prop[i].name, "n")) {
-                       strcpy(storename, v->prop[i].value);
-                       if ((strlen(storename)>0) && (storename[0] != ';')) {
-                               while(storename[strlen(storename)-1] == ';') {
-                                       storename[strlen(storename)-1] = 0;
-                               }
-                       }
-               }
+
+       name = vcard_get_prop(v, "n", 1, 0, 0);
+       if (name != NULL) {
+               strcpy(storename, name);
+               /* vcard_n_prettyize(storename); */
        }
+
 }
 
 
@@ -137,12 +169,16 @@ void display_parsed_vcard(struct vCard *v, int full) {
        int pass;
 
        char displayname[SIZ];
+       char title[SIZ];
+       char org[SIZ];
        char phone[SIZ];
        char mailto[SIZ];
 
        strcpy(displayname, "");
        strcpy(phone, "");
        strcpy(mailto, "");
+       strcpy(title, "");
+       strcpy(org, "");
 
        if (!full) {
                wprintf("<TD>");
@@ -151,7 +187,9 @@ void display_parsed_vcard(struct vCard *v, int full) {
                        escputs(name);
                }
                else if (name = vcard_get_prop(v, "n", 1, 0, 0), name != NULL) {
-                       escputs(name);
+                       strcpy(displayname, name);
+                       vcard_n_prettyize(displayname);
+                       escputs(displayname);
                }
                else {
                        wprintf("&nbsp;");
@@ -160,16 +198,16 @@ void display_parsed_vcard(struct vCard *v, int full) {
                return;
        }
 
-       wprintf("<TABLE bgcolor=#888888>");
+       wprintf("<div align=center><table bgcolor=#aaaaaa width=50%%>");
        for (pass=1; pass<=2; ++pass) {
 
                if (v->numprops) for (i=0; i<(v->numprops); ++i) {
 
                        thisname = strdup(v->prop[i].name);
-                       extract_token(firsttoken, thisname, 0, ';');
+                       extract_token(firsttoken, thisname, 0, ';', sizeof firsttoken);
        
                        for (j=0; j<num_tokens(thisname, ';'); ++j) {
-                               extract_token(buf, thisname, j, ';');
+                               extract_token(buf, thisname, j, ';', sizeof buf);
                                if (!strcasecmp(buf, "encoding=quoted-printable")) {
                                        is_qp = 1;
                                        remove_token(thisname, j, ';');
@@ -203,6 +241,7 @@ void display_parsed_vcard(struct vCard *v, int full) {
                        if (!strcasecmp(firsttoken, "n")) {
                                if (strlen(displayname) == 0) {
                                        strcpy(displayname, thisvalue);
+                                       vcard_n_prettyize(displayname);
                                }
                        }
        
@@ -210,6 +249,16 @@ void display_parsed_vcard(struct vCard *v, int full) {
                        else if (!strcasecmp(firsttoken, "fn")) {
                                strcpy(displayname, thisvalue);
                        }
+
+                       /* title */
+                       else if (!strcasecmp(firsttoken, "title")) {
+                               strcpy(title, thisvalue);
+                       }
+       
+                       /* organization */
+                       else if (!strcasecmp(firsttoken, "org")) {
+                               strcpy(org, thisvalue);
+                       }
        
                        else if (!strcasecmp(firsttoken, "email")) {
                                if (strlen(mailto) > 0) strcat(mailto, "<br />");
@@ -225,7 +274,7 @@ void display_parsed_vcard(struct vCard *v, int full) {
                                if (strlen(phone) > 0) strcat(phone, "<br />");
                                strcat(phone, thisvalue);
                                for (j=0; j<num_tokens(thisname, ';'); ++j) {
-                                       extract_token(buf, thisname, j, ';');
+                                       extract_token(buf, thisname, j, ';', sizeof buf);
                                        if (!strcasecmp(buf, "tel"))
                                                strcat(phone, "");
                                        else if (!strcasecmp(buf, "work"))
@@ -245,10 +294,11 @@ void display_parsed_vcard(struct vCard *v, int full) {
                                if (pass == 2) {
                                        wprintf("<TR><TD>Address:</TD><TD>");
                                        for (j=0; j<num_tokens(thisvalue, ';'); ++j) {
-                                               extract_token(buf, thisvalue, j, ';');
+                                               extract_token(buf, thisvalue, j, ';', sizeof buf);
                                                if (strlen(buf) > 0) {
                                                        escputs(buf);
-                                                       wprintf("<br />");
+                                                       if (j<3) wprintf("<br />");
+                                                       else wprintf(" ");
                                                }
                                        }
                                        wprintf("</TD></TR>\n");
@@ -264,6 +314,8 @@ void display_parsed_vcard(struct vCard *v, int full) {
                                /* ignore */
                        }
                        else {
+
+                               /*** Don't show extra fields.  They're ugly.
                                if (pass == 2) {
                                        wprintf("<TR><TD>");
                                        escputs(thisname);
@@ -271,6 +323,7 @@ void display_parsed_vcard(struct vCard *v, int full) {
                                        escputs(thisvalue);
                                        wprintf("</TD></TR>\n");
                                }
+                               ***/
                        }
        
                        free(thisname);
@@ -283,7 +336,18 @@ void display_parsed_vcard(struct vCard *v, int full) {
                        "<IMG ALIGN=CENTER SRC=\"/static/vcard.gif\">"
                        "<FONT SIZE=+1><B>");
                        escputs(displayname);
-                       wprintf("</B></FONT></TD></TR>\n");
+                       wprintf("</B></FONT>");
+                       if (strlen(title) > 0) {
+                               wprintf("<div align=right>");
+                               escputs(title);
+                               wprintf("</div>");
+                       }
+                       if (strlen(org) > 0) {
+                               wprintf("<div align=right>");
+                               escputs(org);
+                               wprintf("</div>");
+                       }
+                       wprintf("</TD></TR>\n");
                
                        if (strlen(phone) > 0)
                                wprintf("<TR><TD>Telephone:</TD><TD>%s</TD></TR>\n", phone);
@@ -293,7 +357,7 @@ void display_parsed_vcard(struct vCard *v, int full) {
 
        }
 
-       wprintf("</TABLE>\n");
+       wprintf("</table></div>\n");
 }
 
 
@@ -323,9 +387,10 @@ void display_vcard(char *vcard_source, char alpha, int full, char *storename) {
        if (storename != NULL) {
                fetchname_parsed_vcard(v, storename);
        }
-       else if ( (alpha == 0)
-          || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) )
-          || ((!isalpha(alpha)) && (!isalpha(this_alpha))) ) {
+       else if (       (alpha == 0)
+                       || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) )
+                       || ((!isalpha(alpha)) && (!isalpha(this_alpha)))
+               ) {
                display_parsed_vcard(v, full);
        }
 
@@ -375,7 +440,8 @@ void read_message(long msgnum) {
        }
 
        /* begin everythingamundo table */
-       wprintf("<center><table width=99%% border=1 cellspacing=0 "
+       wprintf("<div id=\"fix_scrollbar_bug\">\n");
+       wprintf("<table width=100%% border=1 cellspacing=0 "
                "cellpadding=0><TR><TD>\n");
 
        /* begin message header table */
@@ -439,10 +505,10 @@ void read_message(long msgnum) {
                }
 
                if (!strncasecmp(buf, "part=", 5)) {
-                       extract(mime_filename, &buf[5], 1);
-                       extract(mime_partnum, &buf[5], 2);
-                       extract(mime_disposition, &buf[5], 3);
-                       extract(mime_content_type, &buf[5], 4);
+                       extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+                       extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+                       extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+                       extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
                        mime_length = extract_int(&buf[5], 5);
 
                        if (!strcasecmp(mime_disposition, "attachment")) {
@@ -516,34 +582,29 @@ void read_message(long msgnum) {
 
        /* start msg buttons */
        wprintf("<TD ALIGN=RIGHT>\n");
-       wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_stuff_to_one_msg\">\n");
-       wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%ld\">\n",
-               msgnum);
-       wprintf("<INPUT TYPE=\"hidden\" NAME=\"recp\" VALUE=\"");
-       escputs(reply_to);
-       wprintf("\">\n");
 
-       if (!strncasecmp(m_subject, "Re:", 2)) {
-               wprintf("<INPUT TYPE=\"hidden\" NAME=\"subject\" VALUE=\"");
-               escputs(m_subject);
-               wprintf("\">\n");
-       }
-       else if (strlen(m_subject) > 0) {
-               wprintf("<INPUT TYPE=\"hidden\" NAME=\"subject\" VALUE=\"Re: ");
-               escputs(m_subject);
-               wprintf("\">\n");
-       }
-
-       wprintf("<INPUT TYPE=\"submit\" NAME=\"msg_oper\" STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif; font-size: 7pt; background: blue; color: #FFFFFF;\" VALUE=\"Reply\">\n");
+       /* Reply */
+       wprintf("<a href=\"/display_enter?recp=");
+       urlescputs(reply_to);
+       wprintf("&subject=");
+       if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+       urlescputs(m_subject);
+       wprintf("\">[Reply]</a> ");
 
        if (WC->is_room_aide)  {
-               wprintf("<INPUT TYPE=\"submit\" NAME=\"msg_oper\" STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif; font-size: 7pt; background: blue; color: #FFFFFF;\"VALUE=\"Move\">\n"
-                       "<INPUT TYPE=\"submit\" NAME=\"msg_oper\" STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif; font-size: 7pt; background: blue; color: #FFFFFF;\" VALUE=\"Delete\""
-                       "onClick=\"return confirm('Delete this message?');\">\n");
+       
+               /* Move */
+               wprintf("<a href=\"/confirm_move_msg?msgid=%ld\">[Move]</a> ",
+                       msgnum);
+
+               /* Delete */
+               wprintf("<a href=\"/delete_msg?msgid=%ld\" "
+                       "onClick=\"return confirm('Delete this message?');\">"
+                       "[Delete]</a>", msgnum);
+                       
        }
 
-       wprintf("</FORM>\n"
-               "</TD></TR></TABLE>\n");
+       wprintf("</TD></TR></TABLE>\n");
 
        /* Begin body */
        wprintf("<TABLE BORDER=0 WIDTH=100%% BGCOLOR=#FFFFFF "
@@ -617,12 +678,14 @@ void read_message(long msgnum) {
                if (part_source != NULL) {
 
                        /* If it's my vCard I can edit it */
-                       if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
-                          || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
+                       if (    (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
+                               || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))
+                               || (WC->wc_view == VIEW_ADDRESSBOOK)
+                       ) {
                                wprintf("<A HREF=\"/edit_vcard?"
                                        "msgnum=%ld&partnum=%s\">",
                                        msgnum, vcard_partnum);
-                               wprintf("(edit)</A>");
+                               wprintf("[edit]</A>");
                        }
 
                        /* In all cases, display the full card */
@@ -648,7 +711,8 @@ ENDBODY:
        wprintf("</TD></TR></TABLE>\n");
 
        /* end everythingamundo table */
-       wprintf("</TD></TR></TABLE></center><br />\n");
+       wprintf("</TD></TR></TABLE>\n");
+       wprintf("</div><br />\n");
 }
 
 
@@ -757,10 +821,10 @@ void display_addressbook(long msgnum, char alpha) {
 
        while (serv_gets(buf), strcmp(buf, "000")) {
                if (!strncasecmp(buf, "part=", 5)) {
-                       extract(mime_filename, &buf[5], 1);
-                       extract(mime_partnum, &buf[5], 2);
-                       extract(mime_disposition, &buf[5], 3);
-                       extract(mime_content_type, &buf[5], 4);
+                       extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+                       extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+                       extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+                       extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
                        mime_length = extract_int(&buf[5], 5);
 
                        if (!strcasecmp(mime_content_type, "text/x-vcard")) {
@@ -778,12 +842,14 @@ void display_addressbook(long msgnum, char alpha) {
                        display_vcard(vcard_source, alpha, 0, NULL);
 
                        /* If it's my vCard I can edit it */
-                       if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
-                          || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
+                       if (    (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
+                               || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))
+                               || (WC->wc_view == VIEW_ADDRESSBOOK)
+                       ) {
                                wprintf("<A HREF=\"/edit_vcard?"
                                        "msgnum=%ld&partnum=%s\">",
                                        msgnum, vcard_partnum);
-                               wprintf("(edit)</A>");
+                               wprintf("[edit]</A>");
                        }
 
                        free(vcard_source);
@@ -808,7 +874,7 @@ void lastfirst_firstlast(char *namebuf) {
        i = num_tokens(namebuf, ' ');
        if (i < 2) return;
 
-       extract_token(lastname, namebuf, i-1, ' ');
+       extract_token(lastname, namebuf, i-1, ' ', sizeof lastname);
        remove_token(namebuf, i-1, ' ');
        strcpy(firstname, namebuf);
        sprintf(namebuf, "%s; %s", lastname, firstname);
@@ -847,10 +913,10 @@ void fetch_ab_name(long msgnum, char *namebuf) {
 
        while (serv_gets(buf), strcmp(buf, "000")) {
                if (!strncasecmp(buf, "part=", 5)) {
-                       extract(mime_filename, &buf[5], 1);
-                       extract(mime_partnum, &buf[5], 2);
-                       extract(mime_disposition, &buf[5], 3);
-                       extract(mime_content_type, &buf[5], 4);
+                       extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+                       extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+                       extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+                       extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
                        mime_length = extract_int(&buf[5], 5);
 
                        if (!strcasecmp(mime_content_type, "text/x-vcard")) {
@@ -981,6 +1047,7 @@ void do_addrbook_view(struct addrbookent *addrbook, int num_ab) {
                        wprintf("<A HREF=\"/readfwd?startmsg=%ld&is_singlecard=1",
                                addrbook[i].ab_msgnum);
                        wprintf("&maxmsgs=1&summary=0&alpha=%s\">", bstr("alpha"));
+                       vcard_n_prettyize(addrbook[i].ab_name);
                        escputs(addrbook[i].ab_name);
                        wprintf("</A></TD>\n");
                        ++displayed;
@@ -1141,12 +1208,12 @@ void readloop(char *oper)
                }
        }
 
-       wprintf("<FORM NAME=\"msgomatic\" "
+       wprintf("<form name=\"msgomatic\" "
                "METHOD=\"POST\" ACTION=\"/do_stuff_to_msgs\">\n");
        if (is_summary) {
-               wprintf(
-                       "<center><table border=0 cellspacing=0 "
-                       "cellpadding=0 width=99%%>\n"
+               wprintf("<div id=\"fix_scrollbar_bug\">"
+                       "<table border=0 cellspacing=0 "
+                       "cellpadding=0 width=100%%>\n"
                        "<TR>"
                        "<TD><I>Subject</I></TD>"
                        "<TD><I>Sender</I></TD>"
@@ -1223,7 +1290,7 @@ void readloop(char *oper)
        }
 
        if (is_summary) {
-               wprintf("</table></center>\n");
+               wprintf("</table></div>\n");
        }
 
        /* Bump these because although we're thinking in zero base, the user
@@ -1236,8 +1303,8 @@ void readloop(char *oper)
        if (num_displayed == 1) {
           if ((!is_tasks) && (!is_calendar) && (!is_addressbook) && (!is_notes) && (!is_singlecard)) {
 
-               wprintf("<CENTER>"
-                       "<TABLE BORDER=0 WIDTH=99%% BGCOLOR=\"#DDDDDD\"><TR><TD>"
+               wprintf("<div id=\"fix_scrollbar_bug\">"
+                       "<table border=0 width=100%% bgcolor=\"#dddddd\"><tr><td>"
                        "Reading #%d of %d messages.</TD>\n"
                        "<TD ALIGN=RIGHT><FONT SIZE=+1>",
                        lowest_displayed, nummsgs);
@@ -1274,6 +1341,7 @@ void readloop(char *oper)
                        oper,
                        WC->msgarr[0]);
 
+               wprintf("</td></tr></table></div>\n");
            }
        }
 
@@ -1315,13 +1383,6 @@ void readloop(char *oper)
                        oper,
                        WC->msgarr[0], is_summary);
 
-               wprintf("<OPTION VALUE=\"/%s?startmsg=%ld"
-                       "&maxmsgs=999999&summary=1\">"
-                       "Summary"
-                       "</OPTION>",
-                       oper,
-                       WC->msgarr[0]);
-
                wprintf("</SELECT> of %d messages.", nummsgs);
 
                if (is_summary) {
@@ -1331,7 +1392,7 @@ void readloop(char *oper)
 
            }
        }
-       if (is_summary) wprintf("</FORM>\n");
+       wprintf("</form>\n");
 
 DONE:
        if (is_tasks) {
@@ -1557,7 +1618,9 @@ void display_enter(void)
        wprintf("<div id=\"banner\">\n");
        embed_room_banner(NULL, navbar_none);
        wprintf("</div>\n");
-       wprintf("<div id=\"content\">\n");
+       wprintf("<div id=\"content\">\n"
+               "<div id=\"fix_scrollbar_bug\">"
+               "<table width=100%% border=0 bgcolor=\"#ffffff\"><tr><td>");
 
        sprintf(buf, "ENT0 0|%s|0|0", bstr("recp"));
        serv_puts(buf);
@@ -1590,7 +1653,7 @@ void display_enter(void)
        stresc(&buf[strlen(buf)], WC->wc_roomname, 1, 1);
 
        /* begin message entry screen */
-       wprintf("<div style=\"position:absolute; left:1%%; width:96%%; height:100%%\">\n");
+       // wprintf("<div style=\"position:absolute; left:1%%; width:96%%; height:100%%\">\n");
 
        wprintf("<form enctype=\"multipart/form-data\" "
                "method=\"POST\" action=\"/post\" "
@@ -1621,10 +1684,7 @@ void display_enter(void)
        wprintf("\">&nbsp;"
                "<input type=\"submit\" name=\"sc\" value=\"Cancel\">\n");
 
-       /* begin richedit box */
-       wprintf("<div style=\"position:absolute; left:0%%; width:100%%; top:15%; height:80%%\">\n");
-
-       wprintf("<script type=\"text/javascript\" "
+       wprintf("<center><script type=\"text/javascript\" "
                "src=\"static/richtext.js\"></script>\n"
                "<script type=\"text/javascript\">\n"
                "function submitForm() { \n"
@@ -1634,37 +1694,36 @@ void display_enter(void)
                "  \n"
                "initRTE(\"static/\", \"static/\", \"\"); \n"
                "</script> \n"
-               "<noscript>JAVAscript MUST BE ENABLED.</noscript> \n"
+               "<noscript>JavaScript must be enabled.</noscript> \n"
                "<script type=\"text/javascript\"> \n"
                "writeRichText('msgtext', '");
        msgescputs(bstr("msgtext"));
-       wprintf("', '100%%', '80%%', true, false); \n"
-               "</script> \n");
-       wprintf("</div>\n");    /* end richedit box */
-
-       /* Here comes the "do attachments" section on the bottom */
-       wprintf("<div style=\"position:absolute; bottom:0px; left:0px; width:100%%\">\n");
+       wprintf("', '96%%', '200', true, false); \n"
+               "</script></center><br />\n");
 
        /* Enumerate any attachments which are already in place... */
+       wprintf("<img src=\"/static/attachment.gif\" border=0 "
+               "align=middle height=16 width=16> Attachments: ");
+       wprintf("<select name=\"which_attachment\" size=1>");
        for (att = WC->first_attachment; att != NULL; att = att->next) {
-               wprintf("<IMG SRC=\"/static/attachment.gif\" "
-                       "BORDER=0 ALIGN=MIDDLE> Attachment: ");
+               wprintf("<option value=\"");
+               urlescputs(att->filename);
+               wprintf("\">");
                escputs(att->filename);
-               wprintf(" (%s, %d bytes)<br />\n",
-                       att->content_type, att->length);
+               /* wprintf(" (%s, %d bytes)",att->content_type,att->length); */
+               wprintf("</option>\n");
        }
+       wprintf("</select>");
 
        /* Now offer the ability to attach additional files... */
        wprintf("&nbsp;&nbsp;&nbsp;"
                "Attach file: <input NAME=\"attachfile\" "
-               "SIZE=48 TYPE=\"file\">\n&nbsp;&nbsp;"
+               "SIZE=16 TYPE=\"file\">\n&nbsp;&nbsp;"
                "<input type=\"submit\" name=\"attach\" value=\"Add\">\n");
 
-       wprintf("</div>\n");    /* end attachments section */
+       wprintf("</form>\n");
 
-       wprintf("</FORM>\n");
-
-       wprintf("</div>\n");
+       wprintf("</td></tr></table></div>\n");
 DONE:  wDumpContent(1);
 }
 
@@ -1708,16 +1767,17 @@ void confirm_move_msg(void)
 
        output_headers(1, 1, 1, 0, 0, 0, 0);
 
-       wprintf("<center><table width=99%% border=0 bgcolor=\"#444455\"><tr><td>");
+       wprintf("<div id=\"fix_scrollbar_bug\">"
+               "<table width=100%% border=0 bgcolor=\"#444455\"><tr><td>");
        wprintf("<font size=+1 color=\"#ffffff\"");
        wprintf("<b>Confirm move of message</b>\n");
-       wprintf("</font></td></tr></table></center>\n");
+       wprintf("</font></td></tr></table></div>\n");
 
        wprintf("<CENTER>");
 
        wprintf("Move this message to:<br />\n");
 
-       wprintf("<FORM METHOD=\"POST\" ACTION=\"/move_msg\">\n");
+       wprintf("<form METHOD=\"POST\" ACTION=\"/move_msg\">\n");
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n",
                bstr("msgid"));
 
@@ -1727,7 +1787,7 @@ void confirm_move_msg(void)
        serv_gets(buf);
        if (buf[0] == '1') {
                while (serv_gets(buf), strcmp(buf, "000")) {
-                       extract(targ, buf, 0);
+                       extract_token(targ, buf, 0, '|', sizeof targ);
                        wprintf("<OPTION>");
                        escputs(targ);
                        wprintf("\n");
@@ -1739,7 +1799,7 @@ void confirm_move_msg(void)
        wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Move\">");
        wprintf("&nbsp;");
        wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Cancel\">");
-       wprintf("</FORM></CENTER>\n");
+       wprintf("</form></CENTER>\n");
 
        wprintf("</CENTER>\n");
        wDumpContent(1);
@@ -1768,32 +1828,6 @@ void move_msg(void)
        wDumpContent(1);
 }
 
-/*
- * This gets called when a user selects Reply/Move/Del etc. on *one* message.
- */
-void do_stuff_to_one_msg(void) {
-       char *msg_oper;
-
-       msg_oper = bstr("msg_oper");
-
-       if (!strcasecmp(msg_oper, "Delete")) {
-               delete_msg();   /* It's already been confirmed using JS */
-               return;
-       }
-       if (!strcasecmp(msg_oper, "Move")) {
-               confirm_move_msg();
-               return;
-       }
-       if (!strcasecmp(msg_oper, "Reply")) {
-               display_enter();        /* recp and subject already set */
-               return;
-       }
-
-       /* should never get here.  FIXME: display an error */
-
-}
-
-
 /*
  * This gets called when a user selects multiple messages in a summary
  * list and then clicks to perform a transformation of some sort on them