diff options
author | Daniel Stenberg <daniel@haxx.se> | 2009-12-31 21:52:01 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2009-12-31 21:52:01 +0000 |
commit | 3f3f6be825da333055a1113c4998691b086f4601 (patch) | |
tree | 01585ab30e8a0aa6e5e60168b393f8ba71d1f767 /lib | |
parent | 01682cca550802401aefb0538416a17f8271fc88 (diff) |
turned CURLOPT_MAIL_RCPT into a curl_slist list instead to support multiple
receivers, and made the command line tool thus support the option specified
many times
Diffstat (limited to 'lib')
-rw-r--r-- | lib/smtp.c | 19 | ||||
-rw-r--r-- | lib/url.c | 4 | ||||
-rw-r--r-- | lib/urldata.h | 2 |
3 files changed, 20 insertions, 5 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index 5dd90298b..0f34c4f9e 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -345,8 +345,23 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, } else { /* send RCPT TO */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s", - data->set.str[STRING_MAIL_RCPT]); + struct curl_slist *rcpt; + char *buffer = NULL; + + for(rcpt = data->set.mail_rcpt; rcpt; rcpt=rcpt->next) { + char *add = aprintf("%s%s%s", buffer?buffer:"", buffer?", ":"", + rcpt->data); + if(!add) { + free(buffer); + return CURLE_OUT_OF_MEMORY; + } + buffer = add; + } + + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s", buffer); + + free(buffer); + if(result) return result; @@ -2314,8 +2314,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, break; case CURLOPT_MAIL_RCPT: - result = setstropt(&data->set.str[STRING_MAIL_RCPT], - va_arg(param, char *)); + /* get a list of mail recipients */ + data->set.mail_rcpt = va_arg(param, struct curl_slist *); break; default: diff --git a/lib/urldata.h b/lib/urldata.h index 6c852e8ad..4bcb5bf6f 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1166,7 +1166,6 @@ enum dupstring { STRING_SOCKS5_GSSAPI_SERVICE, /* GSSAPI service name */ #endif STRING_MAIL_FROM, - STRING_MAIL_RCPT, /* -- end of strings -- */ STRING_LAST /* not used, just an end-of-list marker */ @@ -1337,6 +1336,7 @@ struct UserDefined { #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) long socks5_gssapi_nec; /* flag to support nec socks5 server */ #endif + struct curl_slist *mail_rcpt; /* linked list of mail recipients */ }; struct Names { |