X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FEdwardNG.pm;h=a9cac089365c515bf4f89e67d2b7a7c3d17b1d8d;hb=3da0c4584fcdf90a95ec43fdcffc083b9c1a90c1;hp=9a01dc03458e4a19f5b6c64e2f4cf402a4951cb9;hpb=b26648112dbe0c44bae7ef96ed762157b8e3351b;p=app-edwardng.git
diff --git a/lib/App/EdwardNG.pm b/lib/App/EdwardNG.pm
index 9a01dc0..a9cac08 100644
--- a/lib/App/EdwardNG.pm
+++ b/lib/App/EdwardNG.pm
@@ -33,7 +33,7 @@ sub mg {
sub first_part{
my ($ent) = @_;
return first_part $ent->parts(0) if $ent->parts;
- $ent->bodyhandle->as_string
+ stringify [$ent->bodyhandle->as_lines]
}
sub process_message {
@@ -105,6 +105,7 @@ sub run {
$parser->decode_bodies(0);
$parser->output_to_core(1);
my $in = $parser->parse(\*STDIN);
+ debug 'Received mail from ', $in->get('From');
my ($tmpl, %params);
try {
@@ -112,6 +113,7 @@ sub run {
} catch {
($tmpl, %params) = (error => message => $_)
};
+ debug "Result is $tmpl, GnuPG said:\n", $params{message};
$params{plaintext} = first_part $params{decrypted} if $params{decrypted};
@@ -127,7 +129,7 @@ sub run {
my $email_unencrypted = $email->dup;
my $mg = mg always_trust => 1;
my $encrypt_failed = $mg->mime_signencrypt($email, $in->get('From') =~ /<(.*)>/);
- debug 'Could not encrypt message, sending unencrypted. GnuPG said ', stringify $mg->{last_message} if $encrypt_failed;
+ debug 'Could not encrypt message, sending unencrypted. GnuPG said:', "\n", stringify $mg->{last_message} if $encrypt_failed;
sendmail $encrypt_failed ? $email_unencrypted : $email
}
@@ -166,8 +168,6 @@ App::EdwardNG - GnuPG email sign/encrypt testing bot
EdwardNG is a reimplementation of the Edward reply bot referenced in L.
-It takes mail messages, checks them for PGP signatures and encryption, then replies appropriately.
-
This module exports a single function, B, which takes a single parameter representing the message. This parameter can be:
=over