Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: brong/Mail-JMAPTalk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: cyrusimap/Mail-JMAPTalk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 18, 2024

  1. Copy the full SHA
    6c12757 View commit details

Commits on Jan 24, 2025

  1. Copy the full SHA
    99abbcb View commit details

Commits on Jan 26, 2025

  1. Merge pull request #1 from elliefm/ssl-options

    pass SSL_options through to HTTP::Tiny
    brong authored Jan 26, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a3448ae View commit details
  2. Version 0.17

    brong committed Jan 26, 2025
    Copy the full SHA
    55b4b84 View commit details
Showing with 25 additions and 6 deletions.
  1. +6 −0 Changes
  2. +19 −6 lib/Mail/JMAPTalk.pm
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Revision history for Perl extension Mail::JMAPTalk.

0.17 Sun Jan 26 23:31:00 AEST 2025
- pass through SSL_options to HTTP::Tiny

0.16 Thu Oct 17 20:01:00 EDT 2024
- add the ability to pass extra headers to the Upload function

0.15 Tue May 26 11:01:00 AEST 2019
- Actually encode the filename when creating a URI

25 changes: 19 additions & 6 deletions lib/Mail/JMAPTalk.pm
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ use File::LibMagic;
use Carp qw(confess);
use Data::Dumper;

our $VERSION = '0.15';
our $VERSION = '0.17';

our $CLIENT = "Mail-JMAPTalk";
our $AGENT = "$CLIENT/$VERSION";
@@ -25,7 +25,7 @@ Mail::JMAPTalk - Basic interface to talk to JMAP Servers
=head1 VERSION
Version 0.15
Version 0.17
=head1 SYNOPSIS
@@ -100,6 +100,11 @@ Authentication Options: (basic auth)
* user => $username
* password => $password
Other Options:
* SSL_options => a hashref of SSL options to pass down to the default user
agent
Request Defaults:
* using => \@urns (default ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'])
@@ -135,7 +140,8 @@ e.g.
sub ua {
my $Self = shift;
unless ($Self->{ua}) {
$Self->{ua} = HTTP::Tiny->new(agent => $AGENT);
$Self->{ua} = HTTP::Tiny->new(agent => $AGENT,
SSL_options => $Self->{SSL_options});
}
return $Self->{ua};
}
@@ -513,7 +519,10 @@ sub _get_type {
return $info->{mime_type};
}

=head2 $Self->Upload($data, $mimetype, $accountId)
=head2 $Self->Upload($Headers?, $data, $mimetype, $accountId)
If the first argument is a hash reference, it will be shifted
and used as additional headers.
Uploads the bytes in $data with either the given mimetype or
if the mimetype is not given, the type picked by File::LibMagic.
@@ -562,9 +571,13 @@ Example:
=cut

sub Upload {
my ($Self, $data, $type, $accountId) = @_;

my $Self = shift;
my %Headers;
if (ref($_[0]) eq 'HASH') {
%Headers = %{ (shift) };
}
my ($data, $type, $accountId) = @_;

$Headers{'Content-Type'} = $type || _get_type($data);
$accountId = $accountId || $Self->{user};