about summary refs log tree commit homepage
path: root/lib/PublicInbox/Smsg.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-10 07:04:00 +0000
committerEric Wong <e@yhbt.net>2020-06-13 07:55:45 +0000
commit90f11ce471c53365a77896c847d0a39b0995b5b5 (patch)
treeda22ca9fd8df2a85ed4245812999bd67f0577e49 /lib/PublicInbox/Smsg.pm
parenta7018ba43dec712675d21ace5ea1e19d901fdb0f (diff)
downloadpublic-inbox-90f11ce471c53365a77896c847d0a39b0995b5b5.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/Smsg.pm')
-rw-r--r--lib/PublicInbox/Smsg.pm8
1 files changed, 7 insertions, 1 deletions
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;