4 use POSIX qw/strftime/;
14 if (!Blerg::Database::exists($username)) {
18 my $email_conf_path = Blerg::Database::configuration->{data_path} . "/$username/email";
19 if (!-f $email_conf_path) {
23 open CONF, $email_conf_path;
27 my $blerg = Blerg::Database->open_existing($username);
28 my @items = $blerg->subscription_list;
38 $blerg = Blerg::Database->open_existing($i->{author})
41 my $ts = $blerg->timestamp($i->{record});
42 if ($ts >= $t0 && $ts < $t1) {
43 my $data = $blerg->fetch($i->{record});
44 next if !defined $data;
45 my $date = strftime('%T %b %-d %Y (%Z)', localtime($ts));
46 $feeditems .= "== $i->{author} at $date\n\n$data\n\n\n";
52 if (!defined $feeditems) {
57 From => Mail::Address->new('BlergBot', 'noreply@blerg.cc'),
58 To => Mail::Address->new($username, $email),
59 Subject => 'Blërg Daily Digest',
60 Mail::Message::Field->new('Content-Type', 'text/plain', 'charset="utf8"'),
62 Hello, $username! Here is your daily digest:
70 # TODO: Be smarter about this. Maybe maintain a list of users with email addresses?
71 opendir USERS, Blerg::Database::configuration->{data_path};
72 while (my $user = readdir USERS) {
73 next if $user =~ /^\./;