diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-05-18 18:06:09 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-05-18 18:06:09 +0400 |
commit | 79ea8ac42400da0f153dd0e66ca14f8d10c65508 (patch) | |
tree | 30779661a07a1217e1cbde9f8eedc50f0cdd07cf /perl/lib | |
parent | dbc2966a053cfb6b49821f2c5a7c5f486e1a5ece (diff) | |
download | rspamd-79ea8ac42400da0f153dd0e66ca14f8d10c65508.tar.gz rspamd-79ea8ac42400da0f153dd0e66ca14f8d10c65508.zip |
* Add sections about rspamc client, controller protocol, classifiers and statfiles, fuzzy hashes
* Fix imap handling in Mail::Rspamd::Client
Diffstat (limited to 'perl/lib')
-rw-r--r-- | perl/lib/Mail/Rspamd/Client.pm | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/perl/lib/Mail/Rspamd/Client.pm b/perl/lib/Mail/Rspamd/Client.pm index 529a2bf9b..5c6182868 100644 --- a/perl/lib/Mail/Rspamd/Client.pm +++ b/perl/lib/Mail/Rspamd/Client.pm @@ -1251,7 +1251,7 @@ sub _parse_imap_sequences { } -sub process_imap { +sub _process_imap { my ($self, $ssl, $user, $password, $host, $mbox) = @_; my $seq = 1; my $sock; @@ -1259,13 +1259,13 @@ sub process_imap { if (!$password) { eval { require Term::ReadKey; - Term::ReadKey->import( LIST ); - $self->{error} = "Enter IMAP password: "; - Term::ReadKey->ReadMode('noecho'); - $password = Term::ReadKey->ReadLine(0); + Term::ReadKey->import( qw(ReadMode ReadLine) ); + print "Enter IMAP password: "; + ReadMode(2); + $password = ReadLine(0); chomp $password; - Term::ReadKey->ReadMode('normal'); - $self->{error} = "\n"; + ReadMode(0); + print "\n"; } or croak "cannot get password. Check that Term::ReadKey is installed"; } @@ -1274,7 +1274,15 @@ sub process_imap { $sock = $self->_make_ssl_socket ($host, 'imaps'); } else { - $sock = $self->_make_tcp_socket ($host, 143); + $sock = IO::Socket::INET->new( Proto => "tcp", + PeerAddr => $host, + PeerPort => 'imap', + Blocking => 1, + ); + } + unless ($sock) { + $self->{error} = "Cannot connect to imap server: $!"; + return; } my $reply = <$sock>; if (!defined ($reply) || $reply !~ /^\* OK/) { |