Curl wrapper round two

jdrewsen jdrewsen at nospam.com
Sun Jun 19 03:29:54 PDT 2011


Den 19-06-2011 05:16, Jimmy Cao skrev:
> On Sat, Jun 18, 2011 at 4:16 PM, jdrewsen <jdrewsen at nospam.com
> <mailto:jdrewsen at nospam.com>> wrote:
>
>     Den 18-06-2011 22:52, Jimmy Cao skrev:
>
>         Would an SMTP protocol struct be beneficial?
>
>
>     My immediate goal is to provide HTTP support and basic FTP support
>     through libcurl. I believe these are the most important protocols to
>     get in place in order to improve the adoption of D.
>
>     I have currently no plans of adding more protocols to the curl
>     wrapper. Patches are welcome :)
>
>
> Here's a crude implementation for supporting the SMTP protocol:
> https://gist.github.com/1033711
>
> What do you think?

Very nice. A couple of things I believe would help:
1, Get rid of MailMessageData and use curl.onSend() and a delegate that 
keeps a reference to the message. That way you don't have to use the 
lower level Curl.set(infile/readfunction) calls as well.

2, It would be nice if the static sendMail(...) function worked like the 
Http/Ftp counterparts. They return a Result object that you can change 
before performing the actual task. That way you can easily set timeouts 
etc. If there shouldn't be support for async smtp then this is probably 
not important though.

> My biggest concern is whether SMTP protocol support would really be
> necessary within this module.

Personally it is not very high on my list. Initially I would like to 
have the curl wrapper accepted with only Http and basic Ftp just to 
reach a milestone. After that other protocols could be added. But thats 
just how I imagine the process.

/Jonas


More information about the Digitalmars-d mailing list