Only in src: Makefile
Only in src: defaults.h
Common subdirectories: src.orig/fnv and src/fnv
diff -c src.orig/hypermail.h src/hypermail.h
*** src.orig/hypermail.h	Wed May 26 02:50:43 2004
--- src/hypermail.h	Mon Nov 22 18:44:12 2004
***************
*** 256,261 ****
--- 256,262 ----
      char *unre_subject;
      char *inreplyto;
      char *charset;		/* added in 2b10 */
+     char *subject_charset;
  
      long datenum;		/* moved here from 'struct header' */
      long flags;			/* added 1999-03-19 for the new thread output functions */
diff -c src.orig/parse.c src/parse.c
*** src.orig/parse.c	Tue May 25 10:38:08 2004
--- src/parse.c	Mon Nov 22 18:44:12 2004
***************
*** 793,799 ****
  ** Returns the newly allcated string, or the previous if nothing changed 
  */
  
! static char *mdecodeRFC2047(char *string, int length)
  {
      char *iptr = string;
      char *oldptr;
--- 793,799 ----
  ** Returns the newly allcated string, or the previous if nothing changed 
  */
  
! static char *mdecodeRFC2047(char *string, int length, char **subjchar)
  {
      char *iptr = string;
      char *oldptr;
***************
*** 804,809 ****
--- 804,812 ----
      char charset[129];
      char encoding[33];
      char dummy[129];
+     char *ptr;
+     char *blurb;
+ 
  #ifdef NOTUSED
      char equal;
  #endif
***************
*** 816,823 ****
  	    (3 == sscanf(iptr + 2, "%128[^?]?%32[^?]?%128[^ ]",
  			 charset, encoding, dummy))) {
  	    /* This is a full, valid 'encoded-word'. Decode! */
! 	    char *ptr;
! 	    char *blurb = extract_rfc2047_content(iptr);
  	    if (!blurb) {
  		*output++ = *iptr++;
  		/* it wasn't a real encoded-word */
--- 819,829 ----
  	    (3 == sscanf(iptr + 2, "%128[^?]?%32[^?]?%128[^ ]",
  			 charset, encoding, dummy))) {
  	    /* This is a full, valid 'encoded-word'. Decode! */
! 	  if (!strncmp(string, "Subject:",8)){
! 	    *subjchar=(char *)malloc(strlen(charset)+1);
! 	    strcpy(*subjchar,charset);
! 	  }
! 	  blurb = extract_rfc2047_content(iptr);
  	    if (!blurb) {
  		*output++ = *iptr++;
  		/* it wasn't a real encoded-word */
***************
*** 1229,1234 ****
--- 1235,1241 ----
      int binfile = -1;
  
      char *charset = NULL;	/* this is the LOCAL charset used in the mail */
+     char *subjc = NULL;
  
      char *boundary_id = NULL;
      char type[129];		/* for Content-Type type */
***************
*** 1390,1396 ****
  		    char head_name[128];
  		    if (head->header && !head->demimed) {
  			head->line =
! 			    mdecodeRFC2047(head->line, strlen(head->line));
  			head->demimed = TRUE;	/* don't do this again */
  		    }
  
--- 1397,1403 ----
  		    char head_name[128];
  		    if (head->header && !head->demimed) {
  			head->line =
! 			    mdecodeRFC2047(head->line, strlen(head->line),&subjc);
  			head->demimed = TRUE;	/* don't do this again */
  		    }
  
***************
*** 2038,2044 ****
  		if (!emp)
  		  emp =
  		    addhash(num, date, namep, emailp, msgid, subject,
! 			    inreply, fromdate, charset, NULL, NULL, bp);
                  /* 
                   * dp, if it has a value, has a date from the "From " line of
                   * the message after the one we are just finishing. 
--- 2045,2051 ----
  		if (!emp)
  		  emp =
  		    addhash(num, date, namep, emailp, msgid, subject,
! 			    inreply, fromdate, charset, subjc, NULL, NULL, bp);
                  /* 
                   * dp, if it has a value, has a date from the "From " line of
                   * the message after the one we are just finishing. 
***************
*** 2079,2084 ****
--- 2086,2095 ----
  		    free(charset);
  		    charset = NULL;
  		}
+ 		if (subjc) {
+ 		  free(subjc);
+ 		  subjc = NULL;
+ 		}
  		if (msgid) {
  		    free(msgid);
  		    msgid = NULL;
***************
*** 2527,2539 ****
  					inlinecontent(type)) {
  					/* if we know our browsers can show this type of context
  					   as-is, we make a <img> tag instead of <a href>! */
! 
  					trio_snprintf(buffer, sizeof(buffer),
  						 "<img src=\"%s%s%c%s\" alt=\"%s\" />\n",
  						 subdir ? subdir->rel_path_to_top : "",
  						 &att_dir[strlen(dir) + 1],
  						 PATH_SEPARATOR, file,
  						 desc);
  				    }
  				    else {
  					char *created_link =
--- 2538,2567 ----
  					inlinecontent(type)) {
  					/* if we know our browsers can show this type of context
  					   as-is, we make a <img> tag instead of <a href>! */
! 				      if(set_force_link_inlines){
! 					char *created_link =
! 					    createlink(set_attachmentlink,
! 						       &att_dir[strlen(dir)
! 								+ 1],
! 						       file, num, type);
! 					trio_snprintf(buffer, sizeof(buffer),
! 						 "<p><img src=\"%s%s%c%s\" alt=\"%s\" />\n<br />\n(%s %s: <a href=\"%s%s\">%s</a>)</p>\n",
! 						 subdir ? subdir->rel_path_to_top : "",
! 						 &att_dir[strlen(dir) + 1],
! 						 PATH_SEPARATOR, file,
! 						 desc, type,
! 						 lang[MSG_ATTACHMENT],
! 						 subdir ? subdir->rel_path_to_top : "",
! 						 created_link, file);
! 					free(created_link);
! 				      }else{
  					trio_snprintf(buffer, sizeof(buffer),
  						 "<img src=\"%s%s%c%s\" alt=\"%s\" />\n",
  						 subdir ? subdir->rel_path_to_top : "",
  						 &att_dir[strlen(dir) + 1],
  						 PATH_SEPARATOR, file,
  						 desc);
+ 				      }
  				    }
  				    else {
  					char *created_link =
***************
*** 2626,2632 ****
  
  	strcpymax(fromdate, dp ? dp : "", DATESTRLEN);
  	emp = addhash(num, date, namep, emailp, msgid, subject, inreply,
! 		      fromdate, charset, NULL, NULL, bp);
  	if (emp) {
  	    emp->exp_time = exp_time;
  	    emp->is_deleted = is_deleted;
--- 2654,2660 ----
  
  	strcpymax(fromdate, dp ? dp : "", DATESTRLEN);
  	emp = addhash(num, date, namep, emailp, msgid, subject, inreply,
! 		      fromdate, charset, subjc, NULL, NULL, bp);
  	if (emp) {
  	    emp->exp_time = exp_time;
  	    emp->is_deleted = is_deleted;
***************
*** 2653,2658 ****
--- 2681,2690 ----
  	    free(charset);
  	    charset = NULL;
  	}
+ 	if (subjc) {
+ 	  free(subjc);
+ 	  subjc = NULL;
+ 	}
  	if (msgid) {
  	    free(msgid);
  	    msgid = NULL;
***************
*** 2972,2978 ****
  	else
  	    emp = addhash(num, date ? date : NODATE,
  			  name, email, msgid, subject, inreply,
! 			  fromdate, charset, isodate, isofromdate, bp);
  	if (cmp_msgid)
  	    msgids_are_same = !strcmp(ep->msgid, msgid);
  	if (emp != NULL && replylist_tmp != NULL) {
--- 3004,3010 ----
  	else
  	    emp = addhash(num, date ? date : NODATE,
  			  name, email, msgid, subject, inreply,
! 			  fromdate, charset, NULL, isodate, isofromdate, bp);
  	if (cmp_msgid)
  	    msgids_are_same = !strcmp(ep->msgid, msgid);
  	if (emp != NULL && replylist_tmp != NULL) {
***************
*** 3314,3320 ****
  	  }
  
  	  if ((emp = addhash(num, date, name, email, msgid, subject, inreply,
! 			   fromdate, charset, isodate, isofromdate, bp))) {
  	      emp->exp_time = exp_time;
  	      emp->is_deleted = is_deleted;
  	      emp->deletion_completed = old_delete_level;
--- 3346,3352 ----
  	  }
  
  	  if ((emp = addhash(num, date, name, email, msgid, subject, inreply,
! 			   fromdate, charset, NULL, isodate, isofromdate, bp))) {
  	      emp->exp_time = exp_time;
  	      emp->is_deleted = is_deleted;
  	      emp->deletion_completed = old_delete_level;
Common subdirectories: src.orig/pcre and src/pcre
diff -c src.orig/print.c src/print.c
*** src.orig/print.c	Thu Mar 25 11:19:16 2004
--- src/print.c	Mon Nov 22 18:44:12 2004
***************
*** 183,189 ****
  
      if (set_mailcommand) {
  	if (set_hmail) {
! 			ptr = makemailcommand(set_newmsg_command, set_hmail, currentid, cursub);
  			if (strcmp(ptr, "NONE") != 0)
  				fprintf(fp, "<th><a href=\"%s\">%s</a></th>\n", ptr ? ptr : "", lang[MSG_NEW_MESSAGE]);
  	    if (ptr)
--- 183,189 ----
  
      if (set_mailcommand) {
  	if (set_hmail) {
! 			ptr = makemailcommand(set_newmsg_command, set_hmail, currentid, cursub,NULL);
  			if (strcmp(ptr, "NONE") != 0)
  				fprintf(fp, "<th><a href=\"%s\">%s</a></th>\n", ptr ? ptr : "", lang[MSG_NEW_MESSAGE]);
  	    if (ptr)
***************
*** 191,197 ****
  
  			if ((currentid != NULL && currentid[0] != '\0') || (cursub != NULL && cursub[0] != '\0')) {
  
! 				ptr = makemailcommand(set_replymsg_command, set_hmail, currentid, cursub);
  				if (strcmp(ptr, "NONE") != 0)
  					fprintf(fp, "<th><a href=\"%s\">%s</a></th>\n", ptr ? ptr : "", lang[MSG_REPLY]);
  		if (ptr)
--- 191,197 ----
  
  			if ((currentid != NULL && currentid[0] != '\0') || (cursub != NULL && cursub[0] != '\0')) {
  
! 				ptr = makemailcommand(set_replymsg_command, set_hmail, currentid, NULL);
  				if (strcmp(ptr, "NONE") != 0)
  					fprintf(fp, "<th><a href=\"%s\">%s</a></th>\n", ptr ? ptr : "", lang[MSG_REPLY]);
  		if (ptr)
***************
*** 269,280 ****
      fprintf(fp, "<li><a name=\"options2\" id=\"options2\"></a><dfn>%s</dfn>:", 
  	    lang[MSG_MAIL_ACTIONS]);
      if ((email->msgid && email->msgid[0]) || (email->subject && email->subject[0])) {
!       ptr = makemailcommand(set_replymsg_command, set_hmail, email->msgid, email->subject);
        fprintf(fp, " [ <a href=\"%s\">%s</a> ]", ptr ? ptr : "", lang[MSG_MA_REPLY]);
        if (ptr)
  	free(ptr);
      }
!     ptr = makemailcommand(set_newmsg_command, set_hmail, email->msgid, email->subject);
      fprintf(fp, " [ <a href=\"%s\">%s</a> ]", ptr ? ptr : "", lang[MSG_MA_NEW_MESSAGE]);
      if (ptr)
        free(ptr);
--- 269,280 ----
      fprintf(fp, "<li><a name=\"options2\" id=\"options2\"></a><dfn>%s</dfn>:", 
  	    lang[MSG_MAIL_ACTIONS]);
      if ((email->msgid && email->msgid[0]) || (email->subject && email->subject[0])) {
!       ptr = makemailcommand(set_replymsg_command, set_hmail, email->msgid, email->subject, email->subject_charset);
        fprintf(fp, " [ <a href=\"%s\">%s</a> ]", ptr ? ptr : "", lang[MSG_MA_REPLY]);
        if (ptr)
  	free(ptr);
      }
!     ptr = makemailcommand(set_newmsg_command, set_hmail, email->msgid, email->subject,email->subject_charset);
      fprintf(fp, " [ <a href=\"%s\">%s</a> ]", ptr ? ptr : "", lang[MSG_MA_NEW_MESSAGE]);
      if (ptr)
        free(ptr);
***************
*** 303,316 ****
        fprintf(fp, " [ <a href=\"%s#%d\" title=\"%s\">%s</a> ]", 
  	      index_name[dlev][AUTHOR_INDEX], num, 
  	      lang[MSG_LTITLE_BY_AUTHOR], lang[MSG_BY_AUTHOR]);
!     if (show_index[dlev][ATTACHMENT_INDEX]) {
        fprintf(fp, " [ <a href=\"%s\" title=\"%s\">%s</a> ]", 
  	      index_name[dlev][ATTACHMENT_INDEX], 
  	      lang[MSG_LTITLE_BY_ATTACHMENT], lang[MSG_BY_ATTACHMENT]);
!       fprintf (fp, "</li>\n");
!       if (ihtmlhelpupfile)
  	fprintf(fp, "<li><dfn>%s</dfn>: %s</li>", lang[MSG_HELP], ihtmlhelpupfile);
!     }
    }
    
    if (set_custom_archives && *set_custom_archives)
--- 303,316 ----
        fprintf(fp, " [ <a href=\"%s#%d\" title=\"%s\">%s</a> ]", 
  	      index_name[dlev][AUTHOR_INDEX], num, 
  	      lang[MSG_LTITLE_BY_AUTHOR], lang[MSG_BY_AUTHOR]);
!     if (show_index[dlev][ATTACHMENT_INDEX]) 
        fprintf(fp, " [ <a href=\"%s\" title=\"%s\">%s</a> ]", 
  	      index_name[dlev][ATTACHMENT_INDEX], 
  	      lang[MSG_LTITLE_BY_ATTACHMENT], lang[MSG_BY_ATTACHMENT]);
!     fprintf (fp, "</li>\n");
!     if (ihtmlhelpupfile)
  	fprintf(fp, "<li><dfn>%s</dfn>: %s</li>", lang[MSG_HELP], ihtmlhelpupfile);
!     
    }
    
    if (set_custom_archives && *set_custom_archives)
***************
*** 440,446 ****
  
      /* print the mail actions */
      if (set_mailcommand && set_hmail) {
!       ptr = makemailcommand("mailto:$TO", set_hmail, "", "");
        fprintf (fp, "<li><dfn>%s</dfn>: [ <a href=\"%s\" accesskey=\"n\">%s</a> ]</li>\n",
  	       lang[MSG_MAIL_ACTIONS], ptr ? ptr : "", lang[MSG_MA_NEW_MESSAGE]);
        if (ptr)
--- 440,446 ----
  
      /* print the mail actions */
      if (set_mailcommand && set_hmail) {
!       ptr = makemailcommand("mailto:$TO", set_hmail, "", "",NULL);
        fprintf (fp, "<li><dfn>%s</dfn>: [ <a href=\"%s\" accesskey=\"n\">%s</a> ]</li>\n",
  	       lang[MSG_MAIL_ACTIONS], ptr ? ptr : "", lang[MSG_MA_NEW_MESSAGE]);
        if (ptr)
***************
*** 517,523 ****
      printcomment(fp, "index_footer_links", "begin");
  #endif
  
!     fprintf (fp, "<a name=\"end\"></a><div class=\"foot\">\n");
      fprintf (fp, "<map title=\"%s\" id=\"navbarfoot\" name=\"navbarfoot\">\n", lang[MSG_NAVBAR]);
      fprintf (fp, "<ul>\n");
      
--- 517,523 ----
      printcomment(fp, "index_footer_links", "begin");
  #endif
  
!     fprintf (fp, "<div class=\"foot\">\n");
      fprintf (fp, "<map title=\"%s\" id=\"navbarfoot\" name=\"navbarfoot\">\n", lang[MSG_NAVBAR]);
      fprintf (fp, "<ul>\n");
      
***************
*** 576,582 ****
  
      /* print the mail actions */
      if (set_mailcommand && set_hmail) {
!       ptr = makemailcommand("mailto:$TO", set_hmail, "", "");
        fprintf (fp, "<li><dfn>%s</dfn>: [ <a href=\"%s\">%s</a> ]</li>\n",
  	       lang[MSG_MAIL_ACTIONS], ptr ? ptr : "", lang[MSG_MA_NEW_MESSAGE]);
        if (ptr)
--- 576,582 ----
  
      /* print the mail actions */
      if (set_mailcommand && set_hmail) {
!       ptr = makemailcommand("mailto:$TO", set_hmail, "", "",NULL);
        fprintf (fp, "<li><dfn>%s</dfn>: [ <a href=\"%s\">%s</a> ]</li>\n",
  	       lang[MSG_MAIL_ACTIONS], ptr ? ptr : "", lang[MSG_MA_NEW_MESSAGE]);
        if (ptr)
***************
*** 791,797 ****
        }
        fprintf(fp,"%s<a href=\"%s\">%s%s%s</a>%s<a name=\"%d\"><em>%s</em></a>%s%s%s\n",
  	      startline, msg_href(em, subdir_email, FALSE), 
! 	      subj_tag, subj, subj_end_tag, break_str, em->msgnum, em->name,
  	      break_str, date_str, endline);
        free(subj);
      }
--- 791,797 ----
        }
        fprintf(fp,"%s<a href=\"%s\">%s%s%s</a>%s<a name=\"%d\"><em>%s</em></a>%s%s%s\n",
  	      startline, msg_href(em, subdir_email, FALSE), 
! 	      subj_tag, subj, subj_end_tag, break_str, em->msgnum, convchars(em->name,em->charset),
  	      break_str, date_str, endline);
        free(subj);
      }
***************
*** 829,841 ****
  		/* consider that if there's an attachment directory, there are attachments */
  		nb_attach++;
  		if (set_indextable) {
! 		  fprintf(fp, "<tr><td>%s%s</a></td><td><a name=\"%d\"><em>%s</em></a></td>" "<td>%s</td></tr>\n", msg_href(em, subdir_email, TRUE), subj, em->msgnum, em->name, getindexdatestr(em->date));
  		}
  		else {
  		  fprintf(fp, "<li>%s%s<dfn>%s</dfn></a>&nbsp;" 
  			  "<a name=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", 
  			  (*is_first) ? first_attributes : "",
! 			  msg_href(em, subdir_email, TRUE), subj, em->msgnum, em->name, 
  			  getindexdatestr(em->date));
  		  if (*is_first)
  		    *is_first = FALSE;
--- 829,841 ----
  		/* consider that if there's an attachment directory, there are attachments */
  		nb_attach++;
  		if (set_indextable) {
! 		  fprintf(fp, "<tr><td>%s%s</a></td><td><a name=\"%d\"><em>%s</em></a></td>" "<td>%s</td></tr>\n", msg_href(em, subdir_email, TRUE), subj, em->msgnum, convchars(em->name,em->charset), getindexdatestr(em->date));
  		}
  		else {
  		  fprintf(fp, "<li>%s%s<dfn>%s</dfn></a>&nbsp;" 
  			  "<a name=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", 
  			  (*is_first) ? first_attributes : "",
! 			  msg_href(em, subdir_email, TRUE), subj, em->msgnum, convchars(em->name,em->charset), 
  			  getindexdatestr(em->date));
  		  if (*is_first)
  		    *is_first = FALSE;
***************
*** 995,1001 ****
  
  void ConvURLs(FILE *fp, char *line, char *mailid, char *mailsubject, char *charset)
  {
!     char *parsed = ConvURLsString(line, mailid, mailsubject, charset);
      if (parsed) {
  	/* write it to the file! */
        /* add a call to convchars with charset */
--- 995,1070 ----
  
  void ConvURLs(FILE *fp, char *line, char *mailid, char *mailsubject, char *charset)
  {
! #define conv_writechar 0x20
!   unsigned char *p; /* must be unsigned! */
!   int keepesc=1; /* if 0, will remove ESC */
!   int keepsiso=1; /* if 0, will remove SI/SO */
!   int keepother=1; /* if 0, will remove other control char */
!   char *parsed;
! 
!   if (*charset==0){ keepesc=0; keepsiso=0; keepother=0; } 
!   else if
!     (strcasecmp(charset,"iso-8859")==0) { keepesc=0; keepsiso=0; keepother=0; 
! }
!   else if
!     (strcasecmp(charset,"us-ascii")==0) { keepesc=0; keepsiso=0; keepother=0; 
! }
!   else if
!     (strcasecmp(charset,"euc")==0) { keepesc=0; keepsiso=0; keepother=0; }
!   /* Unicode */
!   else if
!     (strcasecmp(charset,"utf-8")==0) { keepesc=0; keepsiso=0; keepother=0; }
!   else if
!     (strcasecmp(charset,"utf-7")==0) { keepesc=0; keepsiso=0; keepother=0; }
! 
!   /* Japanese */
!   else if
!     (strcasecmp(charset,"iso-2022")==0) { keepesc=1; keepsiso=1; keepother=0; 
! }
!   else if
!     (strcasecmp(charset,"shift_jis")==0) { keepesc=0; keepsiso=0; keepother=0;
!  }
! 
!   /* Chinese */
!   else if
!     (strcasecmp(charset,"GB2312")==0) { keepesc=0; keepsiso=0; keepother=0; }
!   else if
!     (strcasecmp(charset,"Big5")==0) { keepesc=0; keepsiso=0; keepother=0; }
! 
!   p=(unsigned char *)line;
!   while (*p!=0x0){
!     if(*p<0x20){
!       switch(*p){
!       case 0x09:
!       break;
!       case 0x0a:
!       break;
!       case 0x0c:
!       break;
!       case 0x0d:
!       break;
!       case 0x0f:
!       if(keepsiso)
!         break;
!       case 0x0e:
!       if(keepsiso)
!         break;
!       case 0x1b:
!       if(keepesc)
!         break;
!       default:
!       if(keepother){
!         break;
!       }else{
!         *p= conv_writechar;
!       }
!       break;
!       }
!     }
!     p++;
!   }
! 
!     parsed = ConvURLsString(line, mailid, mailsubject, charset);
      if (parsed) {
  	/* write it to the file! */
        /* add a call to convchars with charset */
***************
*** 1070,1076 ****
        if (email->is_deleted == 4 || email->is_deleted == 8)
  	d_index = MSG_FILTERED_OUT;
        fprintf(fp, "<a name=\"start\" accesskey=\"j\" id=\"start\"></a>");
!       fprintf(fp, "<p>%s</p>\n", lang[d_index]);  /* AUDIT biege: No more warnings about format-bug */
        return;
      }
      
--- 1139,1145 ----
        if (email->is_deleted == 4 || email->is_deleted == 8)
  	d_index = MSG_FILTERED_OUT;
        fprintf(fp, "<a name=\"start\" accesskey=\"j\" id=\"start\"></a>");
!       fprintf(fp, "<span id=\"deleted\">(%s)</span>\n", lang[d_index]);  /* AUDIT biege: No more warnings about format-bug */
        return;
      }
      
***************
*** 1164,1171 ****
  	d_index = MSG_EXPIRED;
        if (email->is_deleted == 4 || email->is_deleted == 8)
  	d_index = MSG_FILTERED_OUT;
!       fprintf(fp, "<a name=\"start\" accesskey=\"j\" id=\"start\"></a>");
!       fprintf(fp, "<p>%s</p>\n", lang[d_index]);	/* AUDIT biege: No more warnings about format-bug */
        return;
      }
      
--- 1233,1248 ----
  	d_index = MSG_EXPIRED;
        if (email->is_deleted == 4 || email->is_deleted == 8)
  	d_index = MSG_FILTERED_OUT;
!       switch(d_index){
!       case MSG_DELETED:
! 	if(set_htmlmessage_deleted){
! 	  fprintf(fp,"%s\n",set_htmlmessage_deleted);
! 	  break;
! 	}
!       default:
! 	fprintf(fp, "<a name=\"start\" accesskey=\"j\" id=\"start\"></a>");
! 	fprintf(fp, "<p>%s</p>\n", lang[d_index]);
!       }
        return;
      }
      
***************
*** 1380,1406 ****
      if (use_mailcommand) {
        char *ptr = makemailcommand(set_mailcommand,
  				  email->emailaddr,
! 				  email->msgid, email->subject);
        fprintf(fp, "&lt;<a href=\"%s\">%s</a>&gt;", ptr ? ptr : "",
! 	      email->name);
        if (ptr)
  	free(ptr);
      }
      else
!       fprintf(fp, "%s", email->name);
    }
    else {
      if (use_mailcommand && strcmp(email->emailaddr, "(no email)") != 0) {
        char *ptr = makemailcommand(set_mailcommand,
  				  email->emailaddr,
! 				  email->msgid, email->subject);
!       fprintf(fp, "%s &lt;<a href=\"%s\">%s</a>&gt;", email->name, ptr ? ptr : "",
! 	      email->emailaddr);
        if (ptr)
  	free(ptr);
      }
      else {
!       fprintf(fp, "%s &lt;<em>%s</em>&gt;", email->name, 
  	      (strcmp(email->emailaddr, "(no email)") != 0) ? email->emailaddr : "no email");
      }
    }
--- 1457,1483 ----
      if (use_mailcommand) {
        char *ptr = makemailcommand(set_mailcommand,
  				  email->emailaddr,
! 				  email->msgid, email->subject,email->subject_charset);
        fprintf(fp, "&lt;<a href=\"%s\">%s</a>&gt;", ptr ? ptr : "",
! 	      convchars(email->name,email->charset));
        if (ptr)
  	free(ptr);
      }
      else
!       fprintf(fp, "%s", convchars(email->name,email->charset));
    }
    else {
      if (use_mailcommand && strcmp(email->emailaddr, "(no email)") != 0) {
        char *ptr = makemailcommand(set_mailcommand,
  				  email->emailaddr,
! 				  email->msgid, email->subject,email->subject_charset);
!       fprintf(fp, "%s &lt;<a href=\"%s\">%s</a>&gt;", convchars(email->name,email->charset), ptr ? ptr : "",
! 	      convchars(email->emailaddr,email->charset));
        if (ptr)
  	free(ptr);
      }
      else {
!       fprintf(fp, "%s &lt;<em>%s</em>&gt;", convchars(email->name,email->charset),
  	      (strcmp(email->emailaddr, "(no email)") != 0) ? email->emailaddr : "no email");
      }
    }
***************
*** 1501,1507 ****
  	    if (set_mailcommand && set_hmail) {
  	      if ((email->msgid && email->msgid[0]) || (email->subject && email->subject[0])) {
  		ptr = makemailcommand(set_replymsg_command, set_hmail, email->msgid, 
! 				      email->subject);
  		fprintf(fp, " [ <a href=\"%s\" accesskey=\"r\" title=\"%s\">%s</a> ]\n",
  			ptr, lang[MSG_MA_REPLY], lang[MSG_RESPOND]);
  		if (ptr)
--- 1578,1584 ----
  	    if (set_mailcommand && set_hmail) {
  	      if ((email->msgid && email->msgid[0]) || (email->subject && email->subject[0])) {
  		ptr = makemailcommand(set_replymsg_command, set_hmail, email->msgid, 
! 				      email->subject,email->subject_charset);
  		fprintf(fp, " [ <a href=\"%s\" accesskey=\"r\" title=\"%s\">%s</a> ]\n",
  			ptr, lang[MSG_MA_REPLY], lang[MSG_RESPOND]);
  		if (ptr)
***************
*** 1525,1531 ****
  	      ptr = convchars(email2->subject, email2->charset);
  	      fprintf(fp, "[ <a href=\"%s\" title=\"%s: &quot;%s&quot;\">%s</a> ]\n", 
  		      msg_href (email2, email, FALSE), 
! 		      email2->name, ptr ? ptr : "", 
  		      lang[MSG_NEXT_MESSAGE]);
  	      if (ptr)
  		free(ptr);
--- 1602,1608 ----
  	      ptr = convchars(email2->subject, email2->charset);
  	      fprintf(fp, "[ <a href=\"%s\" title=\"%s: &quot;%s&quot;\">%s</a> ]\n", 
  		      msg_href (email2, email, FALSE), 
! 		      convchars(email2->name,email2->charset), ptr ? ptr : "", 
  		      lang[MSG_NEXT_MESSAGE]);
  	      if (ptr)
  		free(ptr);
***************
*** 1545,1551 ****
  	      ptr = convchars(email2->subject, email2->charset);
  	      fprintf(fp, "[ <a href=\"%s\" title=\"%s: &quot;%s&quot;\">%s</a> ]\n", 
  		      msg_relpath(email2, email), 
! 		      email2->name, ptr ? ptr : "", 
  		      lang[MSG_PREVIOUS_MESSAGE]);
  	      if (ptr)
  		free(ptr);
--- 1622,1628 ----
  	      ptr = convchars(email2->subject, email2->charset);
  	      fprintf(fp, "[ <a href=\"%s\" title=\"%s: &quot;%s&quot;\">%s</a> ]\n", 
  		      msg_relpath(email2, email), 
! 		      convchars(email2->name,email2->charset), ptr ? ptr : "", 
  		      lang[MSG_PREVIOUS_MESSAGE]);
  	      if (ptr)
  		free(ptr);
***************
*** 1564,1570 ****
  		ptr = convchars(email2->subject, email2->charset);
  		fprintf(fp, "[ <a href=\"%s\" title=\"%s%s: &quot;%s&quot;\">%s</a> ]\n", 
  			 href01(email, email2, in_thread_file, FALSE), 
! 			del_msg, email2->name, ptr ? ptr : "", 
  			(subjmatch) ? lang[MSG_MAYBE_IN_REPLY_TO] : lang[MSG_IN_REPLY_TO]);
  		if (ptr)
  		  free (ptr);
--- 1641,1647 ----
  		ptr = convchars(email2->subject, email2->charset);
  		fprintf(fp, "[ <a href=\"%s\" title=\"%s%s: &quot;%s&quot;\">%s</a> ]\n", 
  			 href01(email, email2, in_thread_file, FALSE), 
! 			del_msg, convchars(email2->name,email2->charset), ptr ? ptr : "", 
  			(subjmatch) ? lang[MSG_MAYBE_IN_REPLY_TO] : lang[MSG_IN_REPLY_TO]);
  		if (ptr)
  		  free (ptr);
***************
*** 1579,1585 ****
  	      ptr = convchars(email_next_in_thread->subject, email_next_in_thread->charset);
  	      fprintf(fp, "[ <a href=\"%s\" title=\"%s: &quot;%s&quot;\">%s</a> ]\n", 
  		      href01(email, email_next_in_thread, in_thread_file, FALSE),
! 		      email_next_in_thread->name, ptr, 
  		      lang[MSG_NEXT_IN_THREAD]);
  	      if (ptr)
  		free(ptr);
--- 1656,1662 ----
  	      ptr = convchars(email_next_in_thread->subject, email_next_in_thread->charset);
  	      fprintf(fp, "[ <a href=\"%s\" title=\"%s: &quot;%s&quot;\">%s</a> ]\n", 
  		      href01(email, email_next_in_thread, in_thread_file, FALSE),
! 		      convchars(email_next_in_thread->name,email_next_in_thread->charset), ptr, 
  		      lang[MSG_NEXT_IN_THREAD]);
  	      if (ptr)
  		free(ptr);
***************
*** 1652,1658 ****
  	    fprintf(fp, "<li><dfn>%s</dfn>: ", lang[MSG_NEXT_MESSAGE]);
  	    fprintf(fp, "<a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		    msg_href(email2, email, FALSE), lang[MSG_LTITLE_NEXT],
! 		    email2->name, ptr ? ptr : "");
  	    if (ptr)
  	      free(ptr);
  	  }
--- 1729,1735 ----
  	    fprintf(fp, "<li><dfn>%s</dfn>: ", lang[MSG_NEXT_MESSAGE]);
  	    fprintf(fp, "<a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		    msg_href(email2, email, FALSE), lang[MSG_LTITLE_NEXT],
! 		    convchars(email2->name,email2->charset), ptr ? ptr : "");
  	    if (ptr)
  	      free(ptr);
  	  }
***************
*** 1672,1678 ****
  	    fprintf(fp, "<li><dfn>%s</dfn>: ", lang[MSG_PREVIOUS_MESSAGE]);
  	    fprintf(fp, "<a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		    msg_href(email2, email, FALSE), lang[MSG_LTITLE_PREVIOUS],
! 		    email2->name, ptr);
  	    if (ptr)
  	      free(ptr);
  	  }
--- 1749,1755 ----
  	    fprintf(fp, "<li><dfn>%s</dfn>: ", lang[MSG_PREVIOUS_MESSAGE]);
  	    fprintf(fp, "<a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		    msg_href(email2, email, FALSE), lang[MSG_LTITLE_PREVIOUS],
! 		    convchars(email2->name,email2->charset), ptr);
  	    if (ptr)
  	      free(ptr);
  	  }
***************
*** 1694,1700 ****
  	      fprintf(fp, "<li><dfn>%s</dfn>:", lang[MSG_IN_REPLY_TO]);
  	    fprintf(fp, "%s <a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		    del_msg, href01(email, email2, in_thread_file, FALSE), 
! 		    lang[MSG_LTITLE_IN_REPLY_TO], email2->name, ptr);
  	    if (ptr)
  	      free(ptr);
  	  }
--- 1771,1777 ----
  	      fprintf(fp, "<li><dfn>%s</dfn>:", lang[MSG_IN_REPLY_TO]);
  	    fprintf(fp, "%s <a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		    del_msg, href01(email, email2, in_thread_file, FALSE), 
! 		    lang[MSG_LTITLE_IN_REPLY_TO], convchars(email2->name,email2->charset), ptr);
  	    if (ptr)
  	      free(ptr);
  	  }
***************
*** 1710,1716 ****
  	  fprintf(fp, "<a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		  href01(email, email_next_in_thread, in_thread_file, FALSE), 
  		  lang[MSG_LTITLE_NEXT_IN_THREAD], 
! 		  email_next_in_thread->name, ptr);
  	  if (ptr)
  	    free(ptr);
  	  email->initial_next_in_thread = email_next_in_thread->msgnum;
--- 1787,1793 ----
  	  fprintf(fp, "<a href=\"%s\" title=\"%s\">%s: \"%s\"</a></li>\n", 
  		  href01(email, email_next_in_thread, in_thread_file, FALSE), 
  		  lang[MSG_LTITLE_NEXT_IN_THREAD], 
! 		  convchars(email_next_in_thread->name,email_next_in_thread->charset), ptr);
  	  if (ptr)
  	    free(ptr);
  	  email->initial_next_in_thread = email_next_in_thread->msgnum;
***************
*** 1945,1951 ****
  	 */
  
  	print_msg_header(fp, set_label, email->subject, set_dir, email->name, email->emailaddr, 
! 			 email->msgid, email->charset, email->date, filename);
  
  	fprintf (fp, "<div class=\"head\">\n");
  
--- 2022,2028 ----
  	 */
  
  	print_msg_header(fp, set_label, email->subject, set_dir, email->name, email->emailaddr, 
! 			 email->msgid, email->charset, email->date, filename, email->is_deleted);
  
  	fprintf (fp, "<div class=\"head\">\n");
  
***************
*** 2420,2426 ****
  	}
  	fprintf(fp,
  		"%s%s%s</a>%s <a name=\"%d\">%s</a>%s\n", startline,
! 		msg_href(hp->data, subdir_email, TRUE), hp->data->name, break_str,
  		hp->data->msgnum, date_str, endline);
  	*oldsubject = hp->data->unre_subject;
        
--- 2497,2503 ----
  	}
  	fprintf(fp,
  		"%s%s%s</a>%s <a name=\"%d\">%s</a>%s\n", startline,
! 		msg_href(hp->data, subdir_email, TRUE), convchars(hp->data->name,hp->data->charset), break_str,
  		hp->data->msgnum, date_str, endline);
  	*oldsubject = hp->data->unre_subject;
        
***************
*** 2537,2543 ****
  	if(set_indextable)
  	  fprintf(fp,
  		  "<tr><td colspan=\"3\"><strong>%s</strong></td></tr>",
! 		  hp->data->name);
  	else {
  	  bool is_first;
  
--- 2614,2620 ----
  	if(set_indextable)
  	  fprintf(fp,
  		  "<tr><td colspan=\"3\"><strong>%s</strong></td></tr>",
! 		  convchars(hp->data->name,hp->data->charset));
  	else {
  	  bool is_first;
  
***************
*** 2550,2556 ****
  
  	  fprintf(fp, "<li>%s<dfn>%s</dfn>\n", 
  		  (is_first) ? first_attributes : "",
! 		  hp->data->name);
  	  fprintf(fp, "<ul>\n");
  	}
        }
--- 2627,2633 ----
  
  	  fprintf(fp, "<li>%s<dfn>%s</dfn>\n", 
  		  (is_first) ? first_attributes : "",
! 		  convchars(hp->data->name,hp->data->charset));
  	  fprintf(fp, "<ul>\n");
  	}
        }
diff -c src.orig/printfile.c src/printfile.c
*** src.orig/printfile.c	Thu Aug 14 00:12:28 2003
--- src/printfile.c	Fri Dec 17 21:07:48 2004
***************
*** 75,81 ****
  		if (email && name) {
  		    fprintf(fp,
  			    "<meta name=\"Author\" content=\"%s (%s)\" />",
! 			    name, email);
  		}
  		continue;
  	    case 'a':		/* %a - Other Archives URL */
--- 75,81 ----
  		if (email && name) {
  		    fprintf(fp,
  			    "<meta name=\"Author\" content=\"%s (%s)\" />",
! 			    convchars(name,charset), convcharsnospamprotect(email,charset));
  		}
  		continue;
  	    case 'a':		/* %a - Other Archives URL */
***************
*** 194,200 ****
  
  void print_main_header(FILE *fp, bool index_header, char *label, char *name,
  		       char *email, char *subject, char *charset,
! 		       char *date, char *filename)
  {
      char *title;
      char *rp;
--- 194,200 ----
  
  void print_main_header(FILE *fp, bool index_header, char *label, char *name,
  		       char *email, char *subject, char *charset,
! 		       char *date, char *filename,int is_deleted)
  {
      char *title;
      char *rp;
***************
*** 266,272 ****
      free(title);
  
      if (name && email)
! 	fprintf(fp, "<meta name=\"Author\" content=\"%s (%s)\" />\n",name,email);
      fprintf(fp, "<meta name=\"Subject\" content=\"%s\" />\n", rp =
  	    convchars(subject, charset));
      free(rp);
--- 266,272 ----
      free(title);
  
      if (name && email)
! 	fprintf(fp, "<meta name=\"Author\" content=\"%s (%s)\" />\n",convchars(name,charset),convcharsnospamprotect(email,charset));
      fprintf(fp, "<meta name=\"Subject\" content=\"%s\" />\n", rp =
  	    convchars(subject, charset));
      free(rp);
***************
*** 275,280 ****
--- 275,285 ----
      if (use_mailto)
  	fprintf(fp, "<link rev=\"made\" href=\"mailto:%s\" />\n", set_mailto);
  
+     /* to avoid bots */
+     if (is_deleted){
+       fprintf(fp,"<meta name=\"ROBOTS\" content=\"noindex\" />\n");
+     }
+ 
      /* print the css url according to the type of header */
      if (index_header && set_icss_url && *set_icss_url) {
        fprintf(fp, "<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\" />\n",
***************
*** 342,355 ****
  
  void print_msg_header(FILE *fp, char *label, char *subject,
  		      char *dir, char *name, char *email, char *msgid,
! 		      char *charset, time_t date, char *filename)
  {
      if (mhtmlheaderfile)
  	printfile(fp, mhtmlheaderfile, set_label, subject, set_dir, name, 
  		  email, msgid, charset, secs_to_iso_meta(date), filename);
      else {
  	print_main_header(fp, FALSE, set_label, name, email, subject,
! 			  charset, secs_to_iso_meta(date), filename);
      }
  }
  
--- 347,360 ----
  
  void print_msg_header(FILE *fp, char *label, char *subject,
  		      char *dir, char *name, char *email, char *msgid,
! 		      char *charset, time_t date, char *filename, int is_deleted)
  {
      if (mhtmlheaderfile)
  	printfile(fp, mhtmlheaderfile, set_label, subject, set_dir, name, 
  		  email, msgid, charset, secs_to_iso_meta(date), filename);
      else {
  	print_main_header(fp, FALSE, set_label, name, email, subject,
! 			  charset, secs_to_iso_meta(date), filename,is_deleted);
      }
  }
  
***************
*** 365,371 ****
  		  NULL, NULL, NULL, filename);
      else {
  	/* print the navigation bar to upper levels */
! 	print_main_header(fp, TRUE, label, NULL, NULL, subject, NULL, NULL, NULL);
  	
  	fprintf (fp, "<div class=\"head\">\n");
  	if (ihtmlnavbar2upfile)
--- 370,376 ----
  		  NULL, NULL, NULL, filename);
      else {
  	/* print the navigation bar to upper levels */
! 	print_main_header(fp, TRUE, label, NULL, NULL, subject, NULL, NULL, NULL,0);
  	
  	fprintf (fp, "<div class=\"head\">\n");
  	if (ihtmlnavbar2upfile)
***************
*** 392,397 ****
--- 397,403 ----
  	fprintf(fp, "<p><small><em>\n");
  	fprintf(fp, "%s ", lang[MSG_ARCHIVE_GENERATED_BY]);
  	fprintf(fp, "<a href=\"%s\">%s %s</a> \n", HMURL, PROGNAME, VERSION);
+ 	fprintf(fp, "+ <a href=\"http://www.w3.org/2004/12/hypermail-w3c-patch/\">w3c-%s</a>\n",W3CVERSION);
  	fprintf(fp, ": %s\n", getlocaltime());
  	fprintf(fp, "</em></small></p>\n");
      }
Only in src: printfile.c~
diff -c src.orig/printfile.h src/printfile.h
*** src.orig/printfile.h	Tue May 13 18:01:50 2003
--- src/printfile.h	Mon Nov 22 18:44:12 2004
***************
*** 6,15 ****
                char *, char *, char *, char *);
  
  void print_main_header(FILE *, bool, char *, char *, char *, char *, char *,
! 		       char *, char *);
  
  void print_msg_header(FILE *, char *, char *, char *, char *, char *, 
!                       char *, char *, time_t, char *);
  
  void print_index_header(FILE *, char *, char *, char *, char *);
  
--- 6,15 ----
                char *, char *, char *, char *);
  
  void print_main_header(FILE *, bool, char *, char *, char *, char *, char *,
! 		       char *, char *, int);
  
  void print_msg_header(FILE *, char *, char *, char *, char *, char *, 
!                       char *, char *, time_t, char *, int);
  
  void print_index_header(FILE *, char *, char *, char *, char *);
  
diff -c src.orig/proto.h src/proto.h
*** src.orig/proto.h	Fri Aug 15 01:49:06 2003
--- src/proto.h	Mon Nov 22 18:44:12 2004
***************
*** 114,120 ****
  char *convchars(char *, char *);
  char *convcharsnospamprotect(char *, char *);
  char *unconvchars(char *);
! char *makemailcommand(char *, char *, char *, char *);
  char *unspamify(char *);
  char *parseemail(char *, char *, char *);
  char *parseurl(char *, char *);
--- 114,120 ----
  char *convchars(char *, char *);
  char *convcharsnospamprotect(char *, char *);
  char *unconvchars(char *);
! char *makemailcommand(char *, char *, char *, char *, char *);
  char *unspamify(char *);
  char *parseemail(char *, char *, char *);
  char *parseurl(char *, char *);
diff -c src.orig/setup.c src/setup.c
*** src.orig/setup.c	Wed Feb 18 03:48:20 2004
--- src/setup.c	Mon Nov 22 18:49:26 2004
***************
*** 15,20 ****
--- 15,21 ----
  #include "setup.h"
  #include "print.h"
  
+ char *set_htmlmessage_deleted;
  char *set_antispam_at;
  char *set_language;
  char *set_htmlsuffix;
***************
*** 109,114 ****
--- 110,116 ----
  
  struct hmlist *set_text_types = NULL;
  struct hmlist *set_inline_types = NULL;
+ bool set_force_link_inlines;
  struct hmlist *set_prefered_types = NULL;
  struct hmlist *set_ignore_types = NULL;
  struct hmlist *set_show_headers = NULL;
***************
*** 147,152 ****
--- 149,157 ----
  int set_delete_level;
  
  struct Config cfg[] = {
+     {"htmlmessage_deleted", &set_htmlmessage_deleted, NULL, CFG_STRING,
+      "# markuped message for deleted messages.\n",FALSE},
+ 
      {"antispam_at", &set_antispam_at, ANTISPAM_AT, CFG_STRING,
       "# replace any @ sign with this string, if spam flags enabled\n", FALSE},
       
***************
*** 391,397 ****
      {"mailcommand", &set_mailcommand, MAILCOMMAND, CFG_STRING,
       "# This specifies the mail command to use when converting\n"
       "# email addresses to links. The variables $TO, $SUBJECT,\n"
!      "# and $ID can be used in constructing the command string.\n", FALSE},
  
      {"mailto", &set_mailto, NULL, CFG_STRING,
       "# The address of the contact point that is put in the HTML header\n"
--- 396,403 ----
      {"mailcommand", &set_mailcommand, MAILCOMMAND, CFG_STRING,
       "# This specifies the mail command to use when converting\n"
       "# email addresses to links. The variables $TO, $SUBJECT,\n"
!      "# and $ID can be used in constructing the command string.\n"
!      "# This must have mailto: schema at head of line.\n", FALSE},
  
      {"mailto", &set_mailto, NULL, CFG_STRING,
       "# The address of the contact point that is put in the HTML header\n"
***************
*** 774,779 ****
--- 780,787 ----
       "# message was received, for purposes such as putting in folders\n"
       "# or sorting. Details of which purposes this affects may change\n"
       "# in the future.\n", FALSE},
+     {"force_link_inlines", &set_force_link_inlines, BFALSE, CFG_SWITCH,
+      "# Set this to On to add additional links to inline attachments.\n", FALSE},
  };
  
  /* ---------------------------------------------------------------- */
***************
*** 976,982 ****
  int ConfigAddItem(char *cfg_line)
  {
      char keyword[256];
!     char towhat[501];
      char *keywp;
      int i;
      char *line = cfg_line;
--- 984,990 ----
  int ConfigAddItem(char *cfg_line)
  {
      char keyword[256];
!     char towhat[1001]; /* increased from 501! */
      char *keywp;
      int i;
      char *line = cfg_line;
diff -c src.orig/setup.h src/setup.h
*** src.orig/setup.h	Wed Feb 18 02:26:52 2004
--- src/setup.h	Mon Nov 22 18:44:12 2004
***************
*** 34,39 ****
--- 34,40 ----
  void PreConfig(void);
  void PostConfig(void);
  
+ extern char *set_htmlmessage_deleted;
  extern char *set_antispam_at;
  extern char *set_language;
  extern char *set_htmlsuffix;
***************
*** 123,128 ****
--- 124,130 ----
  
  extern struct hmlist *set_text_types;
  extern struct hmlist *set_inline_types;
+ extern bool set_force_link_inlines;
  extern struct hmlist *set_prefered_types;
  extern struct hmlist *set_ignore_types;
  extern struct hmlist *set_show_headers;
diff -c src.orig/string.c src/string.c
*** src.orig/string.c	Mon Aug  4 23:40:53 2003
--- src/string.c	Mon Nov 22 18:57:48 2004
***************
*** 747,784 ****
      }
  }
  
! static char *translateurl(char *url)
  {
!     char *p;
      struct Push buff;
!     unsigned int i;
!     char hexa[5];
  
!     INIT_PUSH(buff);
  
!     for (p = url; *p; p++) {
! 	if (*p == '&')
! 	    PushString(&buff, "&amp;");
! 	else if (*p == '@' && set_mailcommand) 	/* we need to code @ as such to
! 						   avoid a misconvertion */
! 	  PushString(&buff, "&#64;");
! 	else if ((unsigned char) *p > 127 && set_mailcommand) {
! 	  i = (unsigned char) *p & 0xFF;
! 	  snprintf (hexa, sizeof (hexa) -1, "%%%02x", i);
! 	  PushString (&buff, hexa);
! 	}
! 	else {
! 	  /* JK: reaching this point means that we didn't need to do any of the
! 	     special conversions for URLs, but we still need to make
! 	     sure that it's a valid character. */
! 	  char s[2] = "a";
! 	  char *ptr;
! 	  s[0] = *p;
! 	  ptr = convchars (s, NULL);
! 	  PushString (&buff, ptr);
! 	  free (ptr);
  	}
!     }
      RETURN_PUSH(buff);
  }
  
--- 747,818 ----
      }
  }
  
! /*
!  * translateurl() is to escape mailto: URI strings only.
!  */
! 
! static char *translateurl(char *line)
  {
!     int srcsize,hexbuflen;
!     char hexbuf[16];
      struct Push buff;
!     INIT_PUSH(buff);		/* init macro */
  
!     srcsize=strlen(line);
  
!     for(; *line; line++){
!       if(isalnum((int)*line)){
! 	PushByte(&buff,*line);
!       }else{
! 	switch (*line){
! 	  /* we can use unreserved characters, others should be escaped */
! 	  /*  RFC2396: */
! 	  /*  unreserved = alphanum | mark */
! 	  /*  mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" */
! 	case '-':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '_':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '.':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '!':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '~':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '*':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '\'':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case '(':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case ')':
! 	  PushByte(&buff,*line);
! 	  break;
! 	  /* following came from discussion on uri@w3.org */
! 	  /* http://lists.w3.org/Archives/Public/uri/2004Nov/0042.html */
! 	case '@':
! 	  PushByte(&buff,*line);
! 	  break;
! 	case ':':
! 	  PushByte(&buff,*line);
! 	  break;
! 	default:
! 	  /* URIs MUST NOT have non-ascii characters */
! 	  /* otherwise, we must use IRI */
! 	  hexbuflen=snprintf(hexbuf,4,"%%%02X",*line);
! 	  PushString(&buff,hexbuf);
! 	  break;
  	}
!       }
!     } 
      RETURN_PUSH(buff);
  }
  
***************
*** 859,921 ****
  }
  
  /*
! ** Generates the mail command to use from the default mail command,
! ** the current recipient's email address, the current ID of the
! ** message, and the current subject.
! **
! ** Returns an ALLOCATED string!
  */
  
! char *makemailcommand(char *mailcommand, char *email, char *id, char *subject)
! {
!     int hasre;
!     char *cp;
!     char *tmpsubject;
!     char *convsubj;
! 
!     char *newcmd = NULL;
!     char *newcmd2;
! 
!     if (subject && isre(subject, NULL))
! 	hasre = 1;
!     else
! 	hasre = 0;
! 
!     convsubj = convchars(subject, NULL);
! 
!     /* remade to deal with any-length strings */
!     /* tmpsubject = maprintf("%s%s", (hasre) ? "" : "Re: ", (convsubj) ? convsubj : ""); */
!     trio_asprintf(&tmpsubject, "%s%s", (convsubj && !hasre)
! 		  ? "Re: " : "", (convsubj) ? convsubj : "");
  
  
! 	if ((cp = strrchr(email, ' ')) != NULL)
! 	    *cp = '\0';
  
! 	newcmd = replace(mailcommand, "$TO", email);
! 	newcmd2 = replace(newcmd, "$ID", id);
! 	free(newcmd);
  
! 	newcmd = replace(newcmd2, "$SUBJECT", (tmpsubject) ? tmpsubject : "");
! 	free(newcmd2);
  
! 	newcmd2 = replacechar(newcmd, '%', "%25");
! 	free(newcmd);
  
! 	newcmd = replacechar(newcmd2, ' ', "%20");
! 	free(newcmd2);
  
! 	newcmd2 = replacechar(newcmd, '+', "%2B");
! 	free(newcmd);
  
! 	/* escape the special characters following the URL convention */
! 	newcmd = translateurl (newcmd2);
! 	free (newcmd2);
  
! 	free(tmpsubject);
  
!     free(convsubj);
!     return newcmd;
  }
  
  char *unspamify(char *s)
--- 893,1066 ----
  }
  
  /*
! ** MIME Encoding for Subject header
  */
  
! char *str2base64(unsigned char *src,long int len){
  
+   struct Push buf;
+   unsigned long int t=0;
+   int i=0;
+   char *base64table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ 
+   INIT_PUSH(buf);
+   while(len){
+ 
+     t=(t<<8)+*src;
+ 
+     i++;
+     src++;
+     len--;
+ 
+     if (i>2 || len<1){
+       switch(i){
+       case 1:
+ 	t=t<<4;
+ 	PushByte(&buf,base64table[t>>6]);
+ 	PushByte(&buf,base64table[t&0x3f]);
+ 	PushByte(&buf,0x3d);
+ 	PushByte(&buf,0x3d);
+ 	break;
+ 	
+       case 2:
+ 	t=t<<2;
+ 	PushByte(&buf,base64table[t>>12]);
+ 	PushByte(&buf,base64table[(t>>6)&0x3f]);
+ 	PushByte(&buf,base64table[t&0x3f]);
+ 	PushByte(&buf,0x3d);
+ 	break;
+ 		
+       case 3:
+ 	PushByte(&buf,base64table[t>>18]);
+ 	PushByte(&buf,base64table[(t>>12)&0x3f]);
+ 	PushByte(&buf,base64table[(t>>6)&0x3f]);
+ 	PushByte(&buf,base64table[t&0x3f]);
+ 	break;
+ 	
+       default:
+ 	break;
+       }
+       i=0;
+       t=0;
+     }
+   }
+   RETURN_PUSH(buf);
+ }
  
! char *str2qp(unsigned char *src){
  
!   unsigned char t;
!   struct Push buf;
!   char sbuf[4];
  
!   INIT_PUSH(buf);
  
!   while(*src!=0){
!     
!     /* ASCII */
!     if (*src>32 && *src<61){
!       PushByte(&buf,*src++);
!       continue;
!     }
!     if (*src>61 && *src<127){
!       PushByte(&buf,*src++);
!       continue;
!     }
!     
!     t=*src;
!     snprintf(sbuf,4,"=%02X",t);
!     PushByte(&buf,sbuf[0]);
!     PushByte(&buf,sbuf[1]);
!     PushByte(&buf,sbuf[2]);
!     memset(sbuf,0,4);
!     src++;
!   }
  
!   RETURN_PUSH(buf);
! }
  
! /*
! ** Generates the mail command to use from the default mail command,
! ** the current recipient's email address, the current ID of the
! ** message, and the current subject.
! **
! ** Returns an ALLOCATED string!
! */
  
! char *makemailcommand(char *mailcommand, char *email, char *id, char *subject, char *subjcharset)
! {
!   int hasre, enc=0;
!   char *newcmd = NULL, *newcmd2=NULL, *cp;
!   char *tmpsubject=NULL,*tmpmailcommand=NULL,*convqsubj=NULL,*convbsubj=NULL;
!   char *convsubj=NULL,*convemail=NULL,*convid=NULL,*qsubj=NULL,*bsubj=NULL;
!   char *qtsubj=NULL,*btsubj=NULL;
! 
!   if (!subjcharset || *subjcharset==0)
!     subjcharset="us-ascii";
!   
!   if (strstr(subjcharset,"us-ascii") || strstr(subjcharset,"US-ASCII")){
!     if(subject && isre(subject,NULL)){
!       trio_asprintf(&tmpsubject, "%s",subject);
!     }else{
!       trio_asprintf(&tmpsubject, "Re: %s",subject);
!     }
!     convsubj=translateurl(tmpsubject);
!     free(tmpsubject);
!   }else{
!     tmpsubject=replace(subject,"Re: ","");
!     qtsubj=str2qp(tmpsubject);
!     trio_asprintf(&qsubj, "Re: =?%s?Q?%s?=",subjcharset,qtsubj);
!     free(qtsubj);
! 
!     btsubj=str2base64(tmpsubject,strlen(tmpsubject));
!     trio_asprintf(&bsubj, "Re: =?%s?B?%s?=",subjcharset,btsubj);
!     free(btsubj);
! 
!     convqsubj=translateurl(qsubj);
!     convbsubj=translateurl(bsubj);
! 
!     free(tmpsubject);
!     free(qsubj);
!     free(bsubj);
! 
!     if(strlen(convqsubj)>strlen(convbsubj)){
!       trio_asprintf(&convsubj, "%s",convbsubj);
!     }else{
!       trio_asprintf(&convsubj, "%s",convqsubj);
!     }
  
!     free(convbsubj);
!     free(convqsubj);
!   }
!   
!   if ((cp = strrchr(email, ' ')) != NULL)
!     *cp = '\0';
!   
!   convemail=translateurl(email);
!   convid=translateurl(id);
!   
!   newcmd = convcharsnospamprotect(mailcommand,"us-ascii");
! 
!   if (strlen(email)>0){
!     newcmd2 = replace(newcmd, "$TO", convemail);
!   }else{
!     newcmd2 = replace(newcmd, "$TO", "");
!   }
!   free(newcmd);
! 
!   if (strlen(id)>0){
!     newcmd = replace(newcmd2, "$ID", convid);
!   }else{
!     newcmd = replace(newcmd2, "$ID", "");
!   }
!   free(convid);
!   free(newcmd2);
!   
!   newcmd2 = replace(newcmd, "$SUBJECT", (convsubj) ? convsubj : "");
!   free(newcmd);
!   free(convsubj);
  
!   return newcmd2;
  }
  
  char *unspamify(char *s)
***************
*** 1028,1034 ****
  		    if (valid_root_domain(mailaddr)) {
  			char *mailcmd = makemailcommand(set_mailcommand,
  							mailaddr, mid,
! 							msubject);
  			trio_snprintf(tempbuff, sizeof(tempbuff),
  				      "<a href=\"%s\">%.*s%s%s</a>", mailcmd,
  				      ptr - email, email, at, mailbuff);
--- 1173,1179 ----
  		    if (valid_root_domain(mailaddr)) {
  			char *mailcmd = makemailcommand(set_mailcommand,
  							mailaddr, mid,
! 							msubject,NULL);
  			trio_snprintf(tempbuff, sizeof(tempbuff),
  				      "<a href=\"%s\">%.*s%s%s</a>", mailcmd,
  				      ptr - email, email, at, mailbuff);
***************
*** 1215,1221 ****
  		}
  	    }
  	    if(accepted) {
! 	        char *urlbuff2 = translateurl(urlbuff);
  		trio_snprintf(tempbuff, sizeof(tempbuff),
  			      "<a href=\"%s%s\">%s%s</a>",
  			      thisprotocol, urlbuff2, thisprotocol, urlbuff2);
--- 1360,1366 ----
  		}
  	    }
  	    if(accepted) {
! 	        char *urlbuff2 = convcharsnospamprotect(urlbuff,"us-ascii");
  		trio_snprintf(tempbuff, sizeof(tempbuff),
  			      "<a href=\"%s%s\">%s%s</a>",
  			      thisprotocol, urlbuff2, thisprotocol, urlbuff2);
diff -c src.orig/struct.c src/struct.c
*** src.orig/struct.c	Thu Mar 25 09:34:33 2004
--- src/struct.c	Mon Nov 22 18:44:12 2004
***************
*** 152,158 ****
  ** handily looked up and retrieved using any of these criteria.
  */
  
! struct emailinfo *addhash(int num, char *date, char *name, char *email, char *msgid, char *subject, char *inreply, char *fromdate, char *charset, char *isodate, char *isofromdate, struct body *sp)
  {
      struct emailinfo *e;
      struct hashemail *h;
--- 152,158 ----
  ** handily looked up and retrieved using any of these criteria.
  */
  
! struct emailinfo *addhash(int num, char *date, char *name, char *email, char *msgid, char *subject, char *inreply, char *fromdate, char *charset, char *subjcharset, char *isodate, char *isofromdate, struct body *sp)
  {
      struct emailinfo *e;
      struct hashemail *h;
***************
*** 264,269 ****
--- 264,270 ----
      e->unre_subject = unre(subject);
      e->inreplyto = strsav(inreply);
      e->charset = strsav(charset);
+     e->subject_charset = strsav(subjcharset);
      e->flags = 0;
      e->is_deleted = 0;
      e->deletion_completed = -1;
diff -c src.orig/struct.h src/struct.h
*** src.orig/struct.h	Sat Dec 27 03:17:55 2003
--- src/struct.h	Mon Nov 22 18:44:12 2004
***************
*** 7,13 ****
  void fill_email_dates(struct emailinfo *, char *, char *, char *, char *);
  
  struct emailinfo *addhash(int, char *, char *, char *, char *, char *, char *,
! 			  char *, char *, char *, char *, struct body *);
  
  int insert_in_lists(struct emailinfo *, const bool *, int);
  
--- 7,13 ----
  void fill_email_dates(struct emailinfo *, char *, char *, char *, char *);
  
  struct emailinfo *addhash(int, char *, char *, char *, char *, char *, char *,
! 			  char *, char *, char *, char *, char *, struct body *);
  
  int insert_in_lists(struct emailinfo *, const bool *, int);
  
diff -c src.orig/threadprint.c src/threadprint.c
*** src.orig/threadprint.c	Thu Sep 11 01:20:32 2003
--- src/threadprint.c	Mon Nov 22 18:44:12 2004
***************
*** 276,282 ****
  		"<td nowrap><a name=\"%d\">%s</a></td>" "<td nowrap>%s</td></tr>\n",
  		level > 1 ? "--&gt; " : "", 
  		href, first_attributes,
! 		subj, email->msgnum, email->name, getindexdatestr(email->date));
      }
      else {
          if (num_open_li[level] != 0) {
--- 276,282 ----
  		"<td nowrap><a name=\"%d\">%s</a></td>" "<td nowrap>%s</td></tr>\n",
  		level > 1 ? "--&gt; " : "", 
  		href, first_attributes,
! 		subj, email->msgnum, convchars(email->name,email->charset), getindexdatestr(email->date));
      }
      else {
          if (num_open_li[level] != 0) {
***************
*** 286,292 ****
  	fprintf(fp, "<li><a href=\"%s\"%s>%s</a>&nbsp;"
  		"<a name=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", 
  		href, first_attributes, 
! 		subj, email->msgnum, email->name, getindexdatestr(email->date));
      }
      free(subj);
      ++num_replies[level];
--- 286,292 ----
  	fprintf(fp, "<li><a href=\"%s\"%s>%s</a>&nbsp;"
  		"<a name=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n", 
  		href, first_attributes, 
! 		subj, email->msgnum, convchars(email->name,email->charset), getindexdatestr(email->date));
      }
      free(subj);
      ++num_replies[level];
*** patchlevel.h.orig	Fri Dec 17 21:06:32 2004
--- patchlevel.h	Fri Dec 17 21:06:57 2004
***************
*** 1,2 ****
--- 1,3 ----
  #define VERSION "2.2.0"
  #define PATCHLEVEL "1"
+ #define W3CVERSION "0.29"
