* [PATCH 1/2] index group state parameters together for generation
@ 2014-09-15 4:23 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2014-09-15 4:23 UTC (permalink / raw)
To: meta; +Cc: Eric Wong
This allows us to more-easily group and pass parameters.
---
lib/PublicInbox/Feed.pm | 15 +++++++--------
lib/PublicInbox/View.pm | 5 +++--
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 385e573..1fa38bf 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -86,14 +86,14 @@ sub generate_html_index {
} @_;
});
- my %seen;
# except we sort top-level messages reverse chronologically
+ my $state = [ time, {}, $first ];
for (sort { (eval { $b->message->header('X-PI-Date') } || 0) <=>
(eval { $a->message->header('X-PI-Date') } || 0)
} $th->rootset) {
- dump_msg($_, 0, \$html, time, \%seen, $first);
+ dump_msg($_, 0, \$html, $state);
}
-
+ $state = undef;
Email::Address->purge_cache;
my $footer = nav_footer($args->{cgi}, $first, $last, $feed_opts);
@@ -287,14 +287,13 @@ sub add_to_feed {
}
sub dump_msg {
- my ($self, $level, $html, $now, $seen, $first) = @_;
+ my ($self, $level, $html, $state) = @_;
my $mime = $self->message;
if ($mime) {
- $$html .= PublicInbox::View->index_entry($mime, $now, $level,
- $seen, $first);
+ $$html .= PublicInbox::View->index_entry($mime, $level, $state);
}
- dump_msg($self->child, $level+1, $html, $now, $seen, $first) if $self->child;
- dump_msg($self->next, $level, $html, $now, $seen, $first) if $self->next;
+ dump_msg($self->child, $level+1, $html, $state) if $self->child;
+ dump_msg($self->next, $level, $html, $state) if $self->next;
}
sub do_cat_mail {
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index d3849dc..b3797d3 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -43,8 +43,9 @@ sub feed_entry {
# this is already inside a <pre>
sub index_entry {
- my ($class, $mime, $now, $level, $seen, $first) = @_;
- my $rv = "";
+ my ($class, $mime, $level, $state) = @_;
+ my ($now, $seen, $first) = @$state;
+ my $rv = '';
my $part_nr = 0;
my $enc_msg = enc_for($mime->header("Content-Type"));
my $subj = $mime->header('Subject');
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-09-15 4:23 7% [PATCH 1/2] index group state parameters together for generation Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).