More enum class additions.
[dcpomatic.git] / src / lib / emailer.cc
index 6fe537eb1ce759d8a1f43ee44f1a651be9051058..8a061738bd14c86bfd6658bc5b194def845c94b0 100644 (file)
@@ -25,7 +25,6 @@
 #include <curl/curl.h>
 #include <boost/algorithm/string.hpp>
 #include <boost/date_time/c_local_time_adjustor.hpp>
-#include <boost/foreach.hpp>
 
 #include "i18n.h"
 
@@ -34,7 +33,7 @@ using std::min;
 using std::list;
 using std::cout;
 using std::pair;
-using boost::shared_ptr;
+using std::shared_ptr;
 using dcp::ArrayData;
 
 Emailer::Emailer (string from, list<string> to, string subject, string body)
@@ -144,7 +143,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
 
        _email += _body;
 
-       BOOST_FOREACH (Attachment i, _attachments) {
+       for (auto i: _attachments) {
                _email += "\r\n\r\n--" + boundary + "\r\n"
                        "Content-Type: " + i.mime_type + "; name=" + i.name + "\r\n"
                        "Content-Transfer-Encoding: Base64\r\n"
@@ -177,7 +176,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
                throw NetworkError ("Could not initialise libcurl");
        }
 
-       if ((protocol == EMAIL_PROTOCOL_AUTO && port == 465) || protocol == EMAIL_PROTOCOL_SSL) {
+       if ((protocol == EmailProtocol::AUTO && port == 465) || protocol == EmailProtocol::SSL) {
                /* "SSL" or "Implicit TLS"; I think curl wants us to use smtps here */
                curl_easy_setopt (curl, CURLOPT_URL, String::compose("smtps://%1:%2", server, port).c_str());
        } else {
@@ -194,13 +193,13 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
        curl_easy_setopt (curl, CURLOPT_MAIL_FROM, _from.c_str());
 
        struct curl_slist* recipients = 0;
-       BOOST_FOREACH (string i, _to) {
+       for (auto i: _to) {
                recipients = curl_slist_append (recipients, i.c_str());
        }
-       BOOST_FOREACH (string i, _cc) {
+       for (auto i: _cc) {
                recipients = curl_slist_append (recipients, i.c_str());
        }
-       BOOST_FOREACH (string i, _bcc) {
+       for (auto i: _bcc) {
                recipients = curl_slist_append (recipients, i.c_str());
        }
 
@@ -210,7 +209,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str
        curl_easy_setopt (curl, CURLOPT_READDATA, this);
        curl_easy_setopt (curl, CURLOPT_UPLOAD, 1L);
 
-       if (protocol == EMAIL_PROTOCOL_AUTO || protocol == EMAIL_PROTOCOL_STARTTLS) {
+       if (protocol == EmailProtocol::AUTO || protocol == EmailProtocol::STARTTLS) {
                curl_easy_setopt (curl, CURLOPT_USE_SSL, (long) CURLUSESSL_TRY);
        }
        curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
@@ -233,7 +232,7 @@ string
 Emailer::address_list (list<string> addresses)
 {
        string o;
-       BOOST_FOREACH (string i, addresses) {
+       for (auto i: addresses) {
                o += i + ", ";
        }