mhonarc-gentoo-2.6.18-archives-gentoo.patch 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. diff -Nuar a/lib/mhamain.pl b/lib/mhamain.pl
  2. --- a/lib/mhamain.pl 2006-06-10 02:42:58.000000000 +0000
  3. +++ b/lib/mhamain.pl 2008-01-27 14:12:48.000000000 +0000
  4. @@ -73,6 +73,8 @@
  5. TERM TRAP USR1 USR2 VTALRM XCPU XFSZ
  6. );
  7. +use Carp;
  8. +
  9. ###############################################################################
  10. ## Public routines
  11. ###############################################################################
  12. @@ -934,6 +936,16 @@
  13. } else {
  14. $ctype = 'text/plain';
  15. }
  16. +
  17. + ##-----------------------------##
  18. + ## Get Custom Archives headers ##
  19. + ##-----------------------------##
  20. + if (defined($fields->{'x-archives-hash'})) {
  21. + $msghash = $fields->{'x-archives-hash'}[0];
  22. + }
  23. + if(!defined($msghash)) {
  24. + confess("No X-Archives-Hash header in $handle");
  25. + }
  26. ## Insure uniqueness of index
  27. $index .= $X . sprintf('%d',(defined($msgnum)?$msgnum:($LastMsgNum+1)));
  28. @@ -955,6 +967,7 @@
  29. $Subject{$index} = $sub;
  30. $MsgHead{$index} = htmlize_header($fields);
  31. $ContentType{$index} = $ctype;
  32. + $MsgHash{$index} = $msghash;
  33. if ($msgid) {
  34. $MsgId{$msgid} = $index;
  35. $NewMsgId{$msgid} = $index; # Track new message-ids
  36. @@ -966,6 +979,7 @@
  37. } else {
  38. $IndexNum{$index} = getNewMsgNum();
  39. }
  40. + #$MsgHash{$IndexNum{$index}} = $msghash;
  41. $Refs{$index} = [ @refs ] if (@refs);
  42. @@ -1102,7 +1116,7 @@
  43. my $adding = ($ADD && !$force && !$SINGLE);
  44. my $i_p0 = fmt_msgnum($msgnum);
  45. - my $filename = msgnum_filename($msgnum);
  46. + my $filename = msgnum_filename($index);
  47. my $filepathname = join($DIRSEP, $OUTDIR, $filename);
  48. my $tmppathname;
  49. @@ -1160,7 +1174,9 @@
  50. "<!--X-Message-Id: ",
  51. commentize($Index2MsgId{$index}), " -->\n",
  52. "<!--X-Content-Type: ",
  53. - commentize($ContentType{$index}), " -->\n";
  54. + commentize($ContentType{$index}), " -->\n",
  55. + "<!--X-Archives-Hash: ",
  56. + commentize($MsgHash{$index}), " -->\n";
  57. if (defined($Refs{$index})) {
  58. foreach (@{$Refs{$index}}) {
  59. @@ -1456,8 +1472,9 @@
  60. #&defineIndex2MsgId();
  61. my $msgnum = $IndexNum{$key};
  62. return (undef, undef) if ($msgnum eq '');
  63. - my $filename = join($DIRSEP, $OUTDIR, &msgnum_filename($msgnum));
  64. + my $filename = join($DIRSEP, $OUTDIR, &msgnum_filename($key));
  65. + delete $MsgHash{$key};
  66. delete $ContentType{$key};
  67. delete $Date{$key};
  68. delete $From{$key};
  69. diff -Nuar a/lib/mhdb.pl b/lib/mhdb.pl
  70. --- a/lib/mhdb.pl 2005-12-20 21:28:15.000000000 +0000
  71. +++ b/lib/mhdb.pl 2008-01-27 13:25:52.000000000 +0000
  72. @@ -61,6 +61,7 @@
  73. ## Meta-data
  74. print_var($db,'ContentType', \%ContentType);
  75. +print_var($db,'MsgHash', \%MsgHash);
  76. print_var($db,'Date', \%Date);
  77. print_var($db,'Derived', \%Derived);
  78. print_var($db,'FollowOld', \%Follow);
  79. diff -Nuar a/lib/mhinit.pl b/lib/mhinit.pl
  80. --- a/lib/mhinit.pl 2005-07-08 06:34:03.000000000 +0000
  81. +++ b/lib/mhinit.pl 2008-01-27 13:25:52.000000000 +0000
  82. @@ -247,6 +247,7 @@
  83. %Follow = (); # Index key to follow-ups
  84. %FolCnt = (); # Index key to number of follow-ups
  85. %ContentType = (); # Index key to base content-type of message
  86. +%MsgHash = (); # Custom hash from header in mail
  87. %Icons = (); # Index key to icon URL for content-type
  88. %AddIndex = (); # Flags for messages that must be written
  89. diff -Nuar a/lib/mhmsgfile.pl b/lib/mhmsgfile.pl
  90. --- a/lib/mhmsgfile.pl 2001-09-17 16:10:28.000000000 +0000
  91. +++ b/lib/mhmsgfile.pl 2008-01-27 14:12:16.000000000 +0000
  92. @@ -123,6 +123,10 @@
  93. if (defined($href->{'derived'})) {
  94. $Derived{$index} = $href->{'derived'};
  95. }
  96. +
  97. + if (defined($href->{'archives-hash'})) {
  98. + $MsgHash{$index} = $href->{'archives-hash'};
  99. + }
  100. $IndexNum{$index} = int($msgnum);
  101. diff -Nuar a/lib/mhopt.pl b/lib/mhopt.pl
  102. --- a/lib/mhopt.pl 2005-07-08 06:34:03.000000000 +0000
  103. +++ b/lib/mhopt.pl 2008-01-27 13:25:52.000000000 +0000
  104. @@ -764,6 +764,7 @@
  105. delete($MsgId{''});
  106. delete($FollowOld{''});
  107. delete($ContentType{''});
  108. + delete($MsgHash{''});
  109. delete($Refs{''});
  110. # update DOCURL if default old value
  111. diff -Nuar a/lib/mhrcvars.pl b/lib/mhrcvars.pl
  112. --- a/lib/mhrcvars.pl 2005-07-08 05:27:52.000000000 +0000
  113. +++ b/lib/mhrcvars.pl 2008-01-27 14:11:19.000000000 +0000
  114. @@ -195,7 +195,7 @@
  115. }
  116. if ($var eq 'MSG') { ## Filename of message page
  117. ($lref, $key, $pos) = compute_msg_pos($index, $var, $arg);
  118. - $tmp = defined($key) ? &msgnum_filename($IndexNum{$key}) : "";
  119. + $tmp = defined($key) ? &msgnum_filename($key) : "";
  120. last REPLACESW;
  121. }
  122. if ($var eq 'MSGHFIELD') { ## Message header field
  123. @@ -417,7 +417,7 @@
  124. if (!defined($key)) { $tmp = ""; last REPLACESW; }
  125. $tmp = qq/name="/ . &fmt_msgnum($IndexNum{$key}) .
  126. qq/" href="/ .
  127. - &msgnum_filename($IndexNum{$key}) .
  128. + &msgnum_filename($key) .
  129. qq/"/;
  130. last REPLACESW;
  131. }
  132. @@ -432,7 +432,7 @@
  133. $isurl = 0;
  134. ($lref, $key, $pos) = compute_msg_pos($index, $var, $arg);
  135. if (!defined($key)) { $tmp = ""; last REPLACESW; }
  136. - $tmp = qq/href="/ . &msgnum_filename($IndexNum{$key}) . qq/"/;
  137. + $tmp = qq/href="/ . &msgnum_filename($key) . qq/"/;
  138. last REPLACESW;
  139. }
  140. if ($var eq 'IDXFNAME') { ## Filename of index page
  141. @@ -730,7 +730,7 @@
  142. $ret = qq|<a name="| .
  143. &fmt_msgnum($IndexNum{$index}) .
  144. qq|" href="| .
  145. - &msgnum_filename($IndexNum{$index}) .
  146. + &msgnum_filename($index) .
  147. qq|">$ret</a>|
  148. if $var eq 'SUBJECT' && $arg eq "" && !$mailto;
  149. diff -Nuar a/lib/mhutil.pl b/lib/mhutil.pl
  150. --- a/lib/mhutil.pl 2005-07-08 05:27:53.000000000 +0000
  151. +++ b/lib/mhutil.pl 2008-01-27 14:11:50.000000000 +0000
  152. @@ -28,6 +28,7 @@
  153. package mhonarc;
  154. use MHonArc::RFC822;
  155. +use Carp;
  156. ## RFC 2369 header fields to check for URLs
  157. %HFieldsList = (
  158. @@ -304,16 +305,20 @@
  159. ## Routine to get filename of a message number.
  160. ##
  161. sub msgnum_filename {
  162. - my($fmtstr) = "$MsgPrefix%05d.$HtmlExt";
  163. + my $msgnum = $_[0];
  164. + my($fmtstr) = "$MsgPrefix%s.$HtmlExt";
  165. $fmtstr .= ".gz" if $GzipLinks;
  166. - sprintf($fmtstr, $_[0]);
  167. + if(!defined($MsgHash{$msgnum})) {
  168. + confess("Could not find X-Archives-Hash for msgnum=$msgnum");
  169. + }
  170. + sprintf($fmtstr, $MsgHash{$msgnum});
  171. }
  172. ##---------------------------------------------------------------------------
  173. ## Routine to get filename of an index
  174. ##
  175. sub get_filename_from_index {
  176. - &msgnum_filename($IndexNum{$_[0]});
  177. + &msgnum_filename($_[0]);
  178. }
  179. ##---------------------------------------------------------------------------