From 90f11ce471c53365a77896c847d0a39b0995b5b5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 10 Jun 2020 07:04:00 +0000 Subject: preliminary imap server implementation It shares a bit of code with NNTP. It's copy+pasted for now since this provides new ground to experiment with APIs for dealing with slow storage and many inboxes. --- lib/PublicInbox/Smsg.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Smsg.pm') diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm index e8f9c9a3..725d4206 100644 --- a/lib/PublicInbox/Smsg.pm +++ b/lib/PublicInbox/Smsg.pm @@ -131,14 +131,20 @@ sub populate { my @DoW = qw(Sun Mon Tue Wed Thu Fri Sat); my @MoY = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); -sub date ($) { +sub date ($) { # for NNTP my ($self) = @_; my $ds = $self->{ds}; return unless defined $ds; my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($ds); "$DoW[$wday], " . sprintf("%02d $MoY[$mon] %04d %02d:%02d:%02d +0000", $mday, $year+1900, $hour, $min, $sec); +} +sub internaldate { # for IMAP + my ($self) = @_; + my ($sec, $min, $hour, $mday, $mon, $year) = gmtime($self->{ts} // 0); + sprintf("%02d-$MoY[$mon]-%04d %02d:%02d:%02d +0000", + $mday, $year+1900, $hour, $min, $sec); } our $REPLY_RE = qr/^re:\s+/i; -- cgit v1.2.3-24-ge0c7