- if (!printable_view) {
- wprintf("<div class=\"fix_scrollbar_bug message\" ");
- wprintf("onMouseOver=document.getElementById(\"msg%ld\").style.visibility=\"visible\" ", msgnum);
- wprintf("onMouseOut=document.getElementById(\"msg%ld\").style.visibility=\"hidden\" >", msgnum);
- }
-
- /** begin message header table */
- wprintf("<div class=\"message_header\">");
-
- strcpy(m_subject, "");
- strcpy(m_cc, "");
-
- while (serv_getln(buf, sizeof buf), strcasecmp(buf, "text")) {
- if (!strcmp(buf, "000")) {
- wprintf("<i>");
- wprintf(_("unexpected end of message"));
- wprintf(" (1)</i><br /><br />\n");
- wprintf("</div>\n");
- return;
- }
- if (!strncasecmp(buf, "nhdr=yes", 8))
- nhdr = 1;
- if (nhdr == 1)
- buf[0] = '_';
- if (!strncasecmp(buf, "type=", 5))
- format_type = atoi(&buf[5]);
- if (!strncasecmp(buf, "from=", 5)) {
- strcpy(from, &buf[5]);
- wprintf(_("from "));
- wprintf("<a href=\"showuser?who=");
- utf8ify_rfc822_string(from);
- urlescputs(from);
- wprintf("\">");
- escputs(from);
- wprintf("</a> ");
- }
- if (!strncasecmp(buf, "subj=", 5)) {
- safestrncpy(m_subject, &buf[5], sizeof m_subject);
- }
- if (!strncasecmp(buf, "msgn=", 5)) {
- safestrncpy(reply_inreplyto, &buf[5], sizeof reply_inreplyto);
- }
- if (!strncasecmp(buf, "wefw=", 5)) {
- safestrncpy(reply_references, &buf[5], sizeof reply_references);
- }
- if (!strncasecmp(buf, "cccc=", 5)) {
- int len;
- safestrncpy(m_cc, &buf[5], sizeof m_cc);
- if (!IsEmptyStr(reply_all)) {
- strcat(reply_all, ", ");
- }
- len = strlen(reply_all);
- safestrncpy(&reply_all[len], &buf[5],
- (sizeof reply_all - len) );
- }
- if ((!strncasecmp(buf, "hnod=", 5))
- && (strcasecmp(&buf[5], serv_info.serv_humannode))) {
- wprintf("(%s) ", &buf[5]);
- }
- if ((!strncasecmp(buf, "room=", 5))
- && (strcasecmp(&buf[5], WC->wc_roomname))
- && (!IsEmptyStr(&buf[5])) ) {
- wprintf(_("in "));
- wprintf("%s> ", &buf[5]);
- }
- if (!strncasecmp(buf, "rfca=", 5)) {
- strcpy(rfca, &buf[5]);
- wprintf("<");
- escputs(rfca);
- wprintf("> ");
- }
-
- if (!strncasecmp(buf, "node=", 5)) {
- strcpy(node, &buf[5]);
- if ( ((WC->room_flags & QR_NETWORK)
- || ((strcasecmp(&buf[5], serv_info.serv_nodename)
- && (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
- && (IsEmptyStr(rfca))
- ) {
- wprintf("@%s ", &buf[5]);
- }
- }
- if (!strncasecmp(buf, "rcpt=", 5)) {
- int len;
- wprintf(_("to "));
- if (!IsEmptyStr(reply_all)) {
- strcat(reply_all, ", ");
- }
- len = strlen(reply_all);
- safestrncpy(&reply_all[len], &buf[5],
- (sizeof reply_all - len) );
- utf8ify_rfc822_string(&buf[5]);
- escputs(&buf[5]);
- wprintf(" ");
- }
- if (!strncasecmp(buf, "time=", 5)) {
- webcit_fmt_date(now, atol(&buf[5]), 0);
- wprintf("<span>");
- wprintf("%s ", now);
- wprintf("</span>");
- }
-
- if (!strncasecmp(buf, "part=", 5)) {
- extract_token(mime_name, &buf[5], 0, '|', sizeof mime_filename);
- 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);
-
- striplt(mime_name);
- striplt(mime_filename);
- if ( (IsEmptyStr(mime_filename)) && (!IsEmptyStr(mime_name)) ) {
- strcpy(mime_filename, mime_name);
- }
-
- if (!strcasecmp(mime_content_type, "message/rfc822")) {
- if (!IsEmptyStr(mime_submessages)) {
- strcat(mime_submessages, "|");
- }
- strcat(mime_submessages, mime_partnum);
- }
- else if ((!strcasecmp(mime_disposition, "inline"))
- && (!strncasecmp(mime_content_type, "image/", 6)) ){
- ++num_attach_links;
- attach_links = realloc(attach_links,
- (num_attach_links*sizeof(struct attach_link)));
- safestrncpy(attach_links[num_attach_links-1].partnum, mime_partnum, 32);
- snprintf(attach_links[num_attach_links-1].html, 1024,
- "<img src=\"mimepart/%ld/%s/%s\">",
- msgnum, mime_partnum, mime_filename);
- }
- else if ( ( (!strcasecmp(mime_disposition, "attachment"))
- || (!strcasecmp(mime_disposition, "inline"))
- || (!strcasecmp(mime_disposition, ""))
- ) && (!IsEmptyStr(mime_content_type))
- ) {
- ++num_attach_links;
- attach_links = realloc(attach_links,
- (num_attach_links*sizeof(struct attach_link)));
- safestrncpy(attach_links[num_attach_links-1].partnum, mime_partnum, 32);
- utf8ify_rfc822_string(mime_filename);
-
- mime_content_type_ptr = mime_content_type;
- if (strcasecmp(mime_content_type, "application/octet-stream") == 0) {
- mime_content_type_ptr = GuessMimeByFilename(mime_filename,
- strlen(mime_filename));
- }
- urlesc(escaped_mime_filename, 265, mime_filename);
- snprintf(attach_links[num_attach_links-1].html, 1024,
- "<img src=\"display_mime_icon?type=%s\" "
- "border=0 align=middle>\n"
- "%s (%s, %d bytes) [ "
- "<a href=\"mimepart/%ld/%s/%s\""
- "target=\"wc.%ld.%s\">%s</a>"
- " | "
- "<a href=\"mimepart_download/%ld/%s/%s\">%s</a>"
- " ]<br />\n",
- mime_content_type_ptr,
- mime_filename,
- mime_content_type, mime_length,
- msgnum, mime_partnum, escaped_mime_filename,
- msgnum, mime_partnum,
- _("View"),
- msgnum, mime_partnum, escaped_mime_filename,
- _("Download")
- );
- }
-
- /** begin handler prep ***/
- if ( (!strcasecmp(mime_content_type, "text/x-vcard"))
- || (!strcasecmp(mime_content_type, "text/vcard")) ) {
- strcpy(vcard_partnum, mime_partnum);
- }
-
- if ( (!strcasecmp(mime_content_type, "text/calendar"))
- || (!strcasecmp(mime_content_type, "application/ics")) ) {
- strcpy(cal_partnum, mime_partnum);
- }
-
- /** end handler prep ***/