From: Andrew DeFaria Date: Wed, 15 Jul 2020 17:31:11 +0000 (-0700) Subject: Added friendly greetings X-Git-Url: https://defaria.com/gitweb/?a=commitdiff_plain;h=32417054f901f250101c04fc7d28b25b16bef9d5;hp=56813f152ca6be3f803b1363bbe2afddfc1329b0;p=clearscm.git Added friendly greetings --- diff --git a/bin/announceEmail.pl b/bin/announceEmail.pl index 7e840e1..31c7596 100755 --- a/bin/announceEmail.pl +++ b/bin/announceEmail.pl @@ -76,6 +76,19 @@ my $IMAP; my %unseen; my $log; +my @greetings = ( + 'Incoming message', + 'You have received a new message', + 'Hey I found this in your inbox', + 'For some unknown reason this guy send you a message', + 'Did you know you just got a message', + 'Potential spam', + 'You received a communique', + 'I was looking in your inbox and found a message', + 'Not sure you want to hear this message', + 'Good news', +); + my %opts = ( usage => sub { pod2usage }, help => sub { pod2usage(-verbose => 2)}, @@ -117,7 +130,7 @@ sub unseenMsgs() { } # unseenMsgs sub Connect2IMAP() { - $log->msg("Connecting to $opts{imap} as $opts{username}...", 1); + $log->msg("Connecting to $opts{imap} as $opts{username}"); $IMAP = Mail::IMAPTalk->new( Server => $opts{imap}, @@ -125,7 +138,7 @@ sub Connect2IMAP() { Password => $opts{password}, ) or $log->err("Unable to connect to IMAP server $opts{imap}: $@", 1); - $log->msg(' connected'); + $log->msg('Connected'); # Focus on INBOX only $IMAP->select('inbox'); @@ -184,10 +197,12 @@ sub MonitorMail() { # Now speak it! debugit "Speaking message from $from"; + my $logmsg = "From $from $subject"; - my $msg = "Message from $from... " . quotemeta $subject; - $msg =~ s/\"/\\"/g; + my $greeting = $greetings[int rand $#greetings]; + my $msg = "$greeting from $from... " . quotemeta $subject; + $msg =~ s/\"/\\"/g; # Log it $log->msg($logmsg);