X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a23c00470ee904d3958b4fec2b540bf119e28367..a6c129111b38341eb561b110fd1566b260740675:/contrib/src/net/email.cpp diff --git a/contrib/src/net/email.cpp b/contrib/src/net/email.cpp index 7f314927fc..7ca1633ab7 100644 --- a/contrib/src/net/email.cpp +++ b/contrib/src/net/email.cpp @@ -9,10 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "email.h" -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -36,11 +32,11 @@ #include "wx/timer.h" #include "wx/wfstream.h" #include "stdlib.h" -#include "process.h" +#include "unistd.h" #endif // Send a message. -// Specify profile, or leave it to wxWindows to find the current user name +// Specify profile, or leave it to wxWidgets to find the current user name #ifdef __WXMSW__ bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wxString& WXUNUSED(sendMail)) @@ -61,29 +57,31 @@ bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wx return session.Send(message); } #elif defined(__UNIX__) -bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wxString& sendMail) +bool +wxEmail::Send(wxMailMessage& message, + const wxString& profileName, + const wxString& sendMail) { - wxASSERT (message.m_to.GetCount() > 0) ; + wxASSERT_MSG( !message.m_to.IsEmpty(), _T("no recipients to send mail to") ) ; + // The 'from' field is optionally supplied by the app; it's not needed // by MAPI, and on Unix, will be guessed if not supplied. wxString from = message.m_from; - if (from.IsEmpty()) + if ( from.empty() ) { from = wxGetEmailAddress(); } - wxASSERT (!from.IsEmpty()); - wxString msg; msg << wxT("To: "); - size_t i; - for (i = 0; i < message.m_to.GetCount(); i++) + const size_t rcptCount = message.m_to.GetCount(); + for (size_t rcpt = 0; rcpt < rcptCount; rcpt++) { - msg << message.m_to[i]; - if (i < message.m_to.GetCount()) + if ( rcpt ) msg << wxT(", "); + msg << message.m_to[rcpt]; } msg << wxT("\nFrom: ") << from << wxT("\nSubject: ") << message.m_subject;