aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-07-25 16:23:45 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-07-25 18:51:11 +0200
commitea6122775d01460c3bf9f73bb7b15b5084623dfa (patch)
tree13beba133c0a0968a6c813e345ddeaf109b5d541 /lib
parentcee3792a151b9dab79a24323c1e81e9ad0a7e8f6 (diff)
Add a manpage and improve documentation.
Diffstat (limited to 'lib')
-rw-r--r--lib/Net/IMAP/Sync.pm60
1 files changed, 30 insertions, 30 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index 362d436..9db339b 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -39,17 +39,17 @@ my $RE_TEXT_CHAR = qr/[\x01-\x09\x0B\x0C\x0E-\x7F]/;
my %OPTIONS = (
host => qr/\A([0-9a-zA-Z:.-]+)\z/,
port => qr/\A([0-9]+)\z/,
- type => qr/\A(imaps?|preauth)\z/,
- STARTTLS => qr/\A(true|false)\z/i,
+ type => qr/\A(imaps?|tunnel)\z/,
+ STARTTLS => qr/\A(YES|NO)\z/i,
username => qr/\A([\x01-\x7F]+)\z/,
password => qr/\A([\x01-\x7F]+)\z/,
auth => qr/\A($RE_ATOM_CHAR+(?: $RE_ATOM_CHAR+)*)\z/,
- command => qr/\A(\P{Control}+)\z/,
- 'read-only' => qr/\A(TRUE|FALSE)\z/i,
- SSL_ca_path => qr/\A(\P{Control}+)\z/,
- SSL_cipher_list => qr/\A(\P{Control}+)\z/,
+ command => qr/\A(\/\P{Control}+)\z/,
+ 'read-only' => qr/\A(YES|NO)\z/i,
SSL_fingerprint => qr/\A([A-Za-z0-9]+\$\p{AHex}+)\z/,
- SSL_verify_peer => qr/\A(TRUE|FALSE)\z/i,
+ SSL_cipher_list => qr/\A(\P{Control}+)\z/,
+ SSL_verify_trusted_peer => qr/\A(YES|NO)\z/i,
+ SSL_ca_path => qr/\A(\P{Control}+)\z/,
);
@@ -87,7 +87,7 @@ sub read_config($$%) {
$conf->{host} //= 'localhost';
$conf->{port} //= $conf->{type} eq 'imaps' ? 993 : $conf->{type} eq 'imap' ? 143 : undef;
$conf->{auth} //= 'PLAIN LOGIN';
- $conf->{STARTTLS} //= 'TRUE';
+ $conf->{STARTTLS} //= 'YES';
# untaint and validate the config
foreach my $k (keys %$conf) {
@@ -203,7 +203,7 @@ our $IMAP_text;
#
# - 'enable': An extension or array reference of extensions to ENABLE
# (RFC 5161) after entering AUTH state. Croak if the server did not
-# advertize "ENABLE" in its CAPABILITY list or does not reply with
+# advertise "ENABLE" in its CAPABILITY list or does not reply with
# an untagged ENABLED response with all the given extensions.
#
# - 'STDERR': Where to log debug and informational messages (default:
@@ -225,7 +225,7 @@ sub new($%) {
bless $self, $class;
# whether we're allowed to to use read-write command
- $self->{'read-only'} = uc ($self->{'read-only'} // 'FALSE') ne 'TRUE' ? 0 : 1;
+ $self->{'read-only'} = uc ($self->{'read-only'} // 'NO') ne 'YES' ? 0 : 1;
# where to log
$self->{STDERR} //= \*STDERR;
@@ -234,10 +234,10 @@ sub new($%) {
# (cf RFC 3501 section 3)
$self->{_STATE} = '';
- if ($self->{type} eq 'preauth') {
+ if ($self->{type} eq 'tunnel') {
require 'IPC/Open2.pm';
- my $command = $self->{command} // $self->fail("Missing preauth command");
- my $pid = IPC::Open2::open2(@$self{qw/STDOUT STDIN/}, split(/ /, $command))
+ my $command = $self->{command} // $self->fail("Missing tunnel command");
+ my $pid = IPC::Open2::open2(@$self{qw/STDOUT STDIN/}, $command)
or $self->panic("Can't fork: $!");
}
else {
@@ -252,8 +252,8 @@ sub new($%) {
}
else {
require 'IO/Socket/SSL.pm';
- if (defined (my $vrfy = delete $self->{SSL_verify_peer})) {
- $args{SSL_verify_mode} = 0 if uc $vrfy eq 'FALSE';
+ if (defined (my $vrfy = delete $self->{SSL_verify_trusted_peer})) {
+ $args{SSL_verify_mode} = 0 if uc $vrfy eq 'NO';
}
my $fpr = delete $self->{SSL_fingerprint};
$args{$_} = $self->{$_} foreach grep /^SSL_/, keys %$self;
@@ -311,16 +311,16 @@ sub new($%) {
$self->{_STATE} = 'UNAUTH';
my @caps = $self->capabilities();
- if ($self->{type} eq 'imap' and uc $self->{STARTTLS} ne 'FALSE') { # RFC 2595 section 5.1
- $self->fail("Server did not advertize STARTTLS capability.")
+ if ($self->{type} eq 'imap' and uc $self->{STARTTLS} ne 'NO') { # RFC 2595 section 5.1
+ $self->fail("Server did not advertise STARTTLS capability.")
unless grep {$_ eq 'STARTTLS'} @caps;
require 'IO/Socket/SSL.pm';
$self->_send('STARTTLS');
my %sslargs;
- if (defined (my $vrfy = delete $self->{SSL_verify_peer})) {
- $sslargs{SSL_verify_mode} = 0 if uc $vrfy eq 'FALSE';
+ if (defined (my $vrfy = delete $self->{SSL_verify_trusted_peer})) {
+ $sslargs{SSL_verify_mode} = 0 if uc $vrfy eq 'NO';
}
my $fpr = delete $self->{SSL_fingerprint};
$sslargs{$_} = $self->{$_} foreach grep /^SSL_/, keys %$self;
@@ -373,7 +373,7 @@ sub new($%) {
: ref $self->{enable} eq 'ARRAY' ? @{$self->{enable}}
: ($self->{enable});
if (@extensions) {
- $self->fail("Server did not advertize ENABLE (RFC 5161) capability.") unless $self->_capable('ENABLE');
+ $self->fail("Server did not advertise ENABLE (RFC 5161) capability.") unless $self->_capable('ENABLE');
$self->_send('ENABLE '.join(' ',@extensions));
my @enabled = @{$self->{_ENABLED} // []};
$self->fail("Couldn't ENABLE $_") foreach
@@ -451,7 +451,7 @@ sub capabilities($) {
# $self->incapable(@capabilities)
# In list context, return the list capabilties from @capabilities
-# which were NOT advertized by the server. In scalar context, return
+# which were NOT advertised by the server. In scalar context, return
# the length of said list.
sub incapable($@) {
my ($self, @caps) = @_;
@@ -569,7 +569,7 @@ sub list($$@) {
# $self->remove_message($uid, [...])
-# Remove the given $uid list. Croak if the server did not advertize
+# Remove the given $uid list. Croak if the server did not advertise
# "UIDPLUS" (RFC 4315) in its CAPABILITY list.
# Successfully EXPUNGEd UIDs are removed from the pending VANISHED and
# MODIFIED lists.
@@ -577,7 +577,7 @@ sub list($$@) {
sub remove_message($@) {
my $self = shift;
my @set = @_;
- $self->fail("Server did not advertize UIDPLUS (RFC 4315) capability.")
+ $self->fail("Server did not advertise UIDPLUS (RFC 4315) capability.")
if $self->incapable('UIDPLUS');
my $set = compact_set(@set);
@@ -609,8 +609,8 @@ sub remove_message($@) {
# $self->append($mailbox, $mail, [...])
# Issue an APPEND command with the given mails. Croak if the server
-# did not advertize "UIDPLUS" (RFC 4315) in its CAPABILITY list.
-# Providing multiple mails is only allowed for servers advertizing
+# did not advertise "UIDPLUS" (RFC 4315) in its CAPABILITY list.
+# Providing multiple mails is only allowed for servers advertising
# "MULTIAPPEND" (RFC 3502) in their CAPABILITY list.
# Return the list of UIDs allocated for the new messages.
sub append($$@) {
@@ -618,7 +618,7 @@ sub append($$@) {
my $mailbox = shift;
return unless @_;
$self->fail("Server is read-only.") if $self->{'read-only'};
- $self->fail("Server did not advertize UIDPLUS (RFC 4315) capability.")
+ $self->fail("Server did not advertise UIDPLUS (RFC 4315) capability.")
if $self->incapable('UIDPLUS');
my @appends;
@@ -630,7 +630,7 @@ sub append($$@) {
$append .= "{".length($mail->{RFC822})."}\r\n".$mail->{RFC822};
push @appends, $append;
}
- $self->fail("Server did not advertize MULTIAPPEND (RFC 3502) capability.")
+ $self->fail("Server did not advertise MULTIAPPEND (RFC 3502) capability.")
if $#appends > 0 and $self->incapable('MULTIAPPEND');
# dump the cache before issuing the command if we're appending to the current mailbox
@@ -692,10 +692,10 @@ sub fetch($$$$) {
# $self->notify(@specifications)
# Issue a NOTIFY command with the given mailbox @specifications (cf RFC
# 5465 section 6) to be monitored. Croak if the server did not
-# advertize "NOTIFY" (RFC 5465) in its CAPABILITY list.
+# advertise "NOTIFY" (RFC 5465) in its CAPABILITY list.
sub notify($@) {
my $self = shift;
- $self->fail("Server did not advertize NOTIFY (RFC 5465) capability.")
+ $self->fail("Server did not advertise NOTIFY (RFC 5465) capability.")
if $self->incapable('NOTIFY');
my $events = join ' ', qw/MessageNew MessageExpunge FlagChange MailboxName SubscriptionChange/;
# Be notified of new messages with EXISTS/RECENT responses, but
@@ -1216,7 +1216,7 @@ sub _select_or_examine($$$) {
($pcache->{HIGHESTMODSEQ} // 0) > 0 and ($pcache->{UIDNEXT} // 1) > 1;
if ($self->{_STATE} eq 'SELECTED' and ($self->_capable('CONDSTORE') or $self->_capable('QRESYNC'))) {
- # A mailbox is currently selected and the server advertizes
+ # A mailbox is currently selected and the server advertises
# 'CONDSTORE' or 'QRESYNC' (RFC 7162). Delay the mailbox
# selection until the [CLOSED] response code has been received:
# all responses before the [CLOSED] response code refer to the