Skip to content

Commit

Permalink
Add mail options
Browse files Browse the repository at this point in the history
  • Loading branch information
CurtTilmes committed Oct 31, 2018
1 parent 035ee61 commit 1392795
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion META6.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "LibCurl",

"version" : "0.5.2",
"version" : "0.5.3",

"source-url" : "https://github.com/CurtTilmes/perl6-libcurl.git",

Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
NAME := $(shell jq -r .name META6.json)
VERSION := $(shell jq -r .version META6.json)
ARCHIVENAME := $(subst ::,-,$(NAME))

check:
git diff-index --check HEAD
prove6

tag:
git tag $(VERSION)
git push origin --tags

dist:
git archive --prefix=$(ARCHIVENAME)-$(VERSION)/ \
-o ../$(ARCHIVENAME)-$(VERSION).tar.gz $(VERSION)
13 changes: 12 additions & 1 deletion lib/LibCurl/Easy.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ BEGIN for <
> { EXPORT::DEFAULT::{$_} = ::($_) }

enum CURLOPT_TYPE <CURLOPT_BOOL CURLOPT_STR CURLOPT_LONG CURLOPT_OFF_T
LIBCURL_HEADER LIBCURL_DOWNLOAD LIBCURL_UPLOAD LIBCURL_SEND
CURLOPT_SLIST LIBCURL_HEADER LIBCURL_DOWNLOAD LIBCURL_UPLOAD LIBCURL_SEND
LIBCURL_DEBUG LIBCURL_XFER LIBCURL_PRIVATE>;

my %opts =
Expand Down Expand Up @@ -185,6 +185,8 @@ my %opts =
infilesize => (CURLOPT_INFILESIZE_LARGE, CURLOPT_OFF_T ),
low-speed-limit => (CURLOPT_LOW_SPEED_LIMIT, CURLOPT_LONG ),
low-speed-time => (CURLOPT_LOW_SPEED_TIME, CURLOPT_LONG ),
mail-from => (CURLOPT_MAIL_FROM, CURLOPT_STR ),
mail-rcpt => (CURLOPT_MAIL_RCPT, CURLOPT_SLIST ),
maxconnects => (CURLOPT_MAXCONNECTS, CURLOPT_LONG ),
maxfilesize => (CURLOPT_MAXFILESIZE_LARGE, CURLOPT_OFF_T ),
maxredirs => (CURLOPT_MAXREDIRS, CURLOPT_LONG ),
Expand Down Expand Up @@ -378,6 +380,7 @@ class LibCurl::Easy
has &.debugfunction;
has &.xferinfofunction;
has $.private;
has @.slists;

sub fopen(Str $path, Str $mode) returns Pointer is native { * }

Expand Down Expand Up @@ -447,6 +450,12 @@ class LibCurl::Easy
}
}

when CURLOPT_SLIST {
my $slist = LibCurl::slist.append(@$param);
$!handle.setopt($code, $slist);
@.slists.push($slist);
}

when LIBCURL_HEADER {
self.set-header(|($option => $param));
}
Expand Down Expand Up @@ -670,6 +679,8 @@ class LibCurl::Easy
.cleanup with $!handle;
$!handle = LibCurl::EasyHandle;
self.clear-form;
.free for @!slists;
@!slists = ();
}

submethod DESTROY
Expand Down

0 comments on commit 1392795

Please sign in to comment.