Gentoo Archives: gentoo-commits

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