diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/imap/IMAPConnection.cpp | 5 | ||||
-rw-r--r-- | src/net/imap/IMAPServiceInfos.cpp | 3 | ||||
-rw-r--r-- | src/net/pop3/POP3ServiceInfos.cpp | 3 | ||||
-rw-r--r-- | src/net/pop3/POP3Store.cpp | 13 | ||||
-rw-r--r-- | src/net/service.cpp | 15 | ||||
-rw-r--r-- | src/net/serviceInfos.cpp | 3 | ||||
-rw-r--r-- | src/net/smtp/SMTPServiceInfos.cpp | 3 | ||||
-rw-r--r-- | src/net/smtp/SMTPTransport.cpp | 5 | ||||
-rw-r--r-- | src/platforms/posix/posixHandler.cpp | 10 | ||||
-rw-r--r-- | src/platforms/windows/windowsHandler.cpp | 10 |
10 files changed, 28 insertions, 42 deletions
diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp index b0716f45..180caa4b 100644 --- a/src/net/imap/IMAPConnection.cpp +++ b/src/net/imap/IMAPConnection.cpp @@ -94,10 +94,7 @@ void IMAPConnection::connect() } // Create and connect the socket - socketFactory* sf = platformDependant::getHandler()-> - getSocketFactory(GET_PROPERTY(string, PROPERTY_SERVER_SOCKETFACTORY)); - - m_socket = sf->create(); + m_socket = m_store->getSocketFactory()->create(); #if VMIME_HAVE_TLS_SUPPORT if (m_store->isSecuredConnection()) // dedicated port/IMAPS diff --git a/src/net/imap/IMAPServiceInfos.cpp b/src/net/imap/IMAPServiceInfos.cpp index d8164ce1..a5d1ca5a 100644 --- a/src/net/imap/IMAPServiceInfos.cpp +++ b/src/net/imap/IMAPServiceInfos.cpp @@ -61,7 +61,6 @@ const IMAPServiceInfos::props& IMAPServiceInfos::getProperties() const property(serviceInfos::property::SERVER_ADDRESS, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::SERVER_PORT, "143"), - property(serviceInfos::property::SERVER_SOCKETFACTORY), property(serviceInfos::property::TIMEOUT_FACTORY) }; @@ -85,7 +84,6 @@ const IMAPServiceInfos::props& IMAPServiceInfos::getProperties() const property(serviceInfos::property::SERVER_ADDRESS, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::SERVER_PORT, "993"), - property(serviceInfos::property::SERVER_SOCKETFACTORY), property(serviceInfos::property::TIMEOUT_FACTORY) }; @@ -119,7 +117,6 @@ const std::vector <serviceInfos::property> IMAPServiceInfos::getAvailablePropert list.push_back(p.PROPERTY_SERVER_ADDRESS); list.push_back(p.PROPERTY_SERVER_PORT); - list.push_back(p.PROPERTY_SERVER_SOCKETFACTORY); list.push_back(p.PROPERTY_TIMEOUT_FACTORY); diff --git a/src/net/pop3/POP3ServiceInfos.cpp b/src/net/pop3/POP3ServiceInfos.cpp index 52387c5d..54a44771 100644 --- a/src/net/pop3/POP3ServiceInfos.cpp +++ b/src/net/pop3/POP3ServiceInfos.cpp @@ -63,7 +63,6 @@ const POP3ServiceInfos::props& POP3ServiceInfos::getProperties() const property(serviceInfos::property::SERVER_ADDRESS, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::SERVER_PORT, "110"), - property(serviceInfos::property::SERVER_SOCKETFACTORY), property(serviceInfos::property::TIMEOUT_FACTORY) }; @@ -89,7 +88,6 @@ const POP3ServiceInfos::props& POP3ServiceInfos::getProperties() const property(serviceInfos::property::SERVER_ADDRESS, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::SERVER_PORT, "995"), - property(serviceInfos::property::SERVER_SOCKETFACTORY), property(serviceInfos::property::TIMEOUT_FACTORY) }; @@ -125,7 +123,6 @@ const std::vector <serviceInfos::property> POP3ServiceInfos::getAvailablePropert list.push_back(p.PROPERTY_SERVER_ADDRESS); list.push_back(p.PROPERTY_SERVER_PORT); - list.push_back(p.PROPERTY_SERVER_SOCKETFACTORY); list.push_back(p.PROPERTY_TIMEOUT_FACTORY); diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp index 4f373268..4c3ba224 100644 --- a/src/net/pop3/POP3Store.cpp +++ b/src/net/pop3/POP3Store.cpp @@ -132,10 +132,7 @@ void POP3Store::connect() } // Create and connect the socket - socketFactory* sf = platformDependant::getHandler()-> - getSocketFactory(GET_PROPERTY(string, PROPERTY_SERVER_SOCKETFACTORY)); - - m_socket = sf->create(); + m_socket = getSocketFactory()->create(); #if VMIME_HAVE_TLS_SUPPORT if (m_secured) // dedicated port/POP3S @@ -272,13 +269,12 @@ void POP3Store::authenticate(const messageId& randomMID) } else { - // Some servers close the connection after an - // unsuccessful APOP command, so the fallback - // may not always work... + // Some servers close the connection after an unsuccessful APOP + // command, so the fallback may not always work... // // S: +OK Qpopper (version 4.0.5) at xxx starting. <30396.1126730747@xxx> // C: APOP plop c5e0a87d088ec71d60e32692d4c5bdf4 - // S: -ERR [AUTH] Password supplied for "o" is incorrect. + // S: -ERR [AUTH] Password supplied for "plop" is incorrect. // S: +OK Pop server at xxx signing off. // [Connection closed by foreign host.] @@ -298,6 +294,7 @@ void POP3Store::authenticate(const messageId& randomMID) } catch (exceptions::socket_exception&) { + internalDisconnect(); throw exceptions::authentication_error(response); } } diff --git a/src/net/service.cpp b/src/net/service.cpp index 35e8aa55..1589f3f2 100644 --- a/src/net/service.cpp +++ b/src/net/service.cpp @@ -20,6 +20,8 @@ #include "vmime/config.hpp" #include "vmime/net/service.hpp" +#include "vmime/platformDependant.hpp" + #if VMIME_HAVE_SASL_SUPPORT #include "vmime/security/sasl/defaultSASLAuthenticator.hpp" #else @@ -54,6 +56,7 @@ service::service(ref <session> sess, const serviceInfos& /* infos */, m_certVerifier = vmime::create <tls::defaultCertificateVerifier>(); #endif // VMIME_HAVE_TLS_SUPPORT + m_socketFactory = platformDependant::getHandler()->getSocketFactory(); } @@ -108,5 +111,17 @@ ref <tls::certificateVerifier> service::getCertificateVerifier() #endif // VMIME_HAVE_TLS_SUPPORT +void service::setSocketFactory(ref <socketFactory> sf) +{ + m_socketFactory = sf; +} + + +ref <socketFactory> service::getSocketFactory() +{ + return m_socketFactory; +} + + } // net } // vmime diff --git a/src/net/serviceInfos.cpp b/src/net/serviceInfos.cpp index 306c1ec3..c76744a2 100644 --- a/src/net/serviceInfos.cpp +++ b/src/net/serviceInfos.cpp @@ -34,9 +34,6 @@ const serviceInfos::property serviceInfos::property::SERVER_PORT const serviceInfos::property serviceInfos::property::SERVER_ROOTPATH ("server.rootpath", serviceInfos::property::TYPE_STRING); -const serviceInfos::property serviceInfos::property::SERVER_SOCKETFACTORY - ("server.socket-factory", serviceInfos::property::TYPE_STRING, "default"); - const serviceInfos::property serviceInfos::property::AUTH_USERNAME ("auth.username", serviceInfos::property::TYPE_STRING); diff --git a/src/net/smtp/SMTPServiceInfos.cpp b/src/net/smtp/SMTPServiceInfos.cpp index 1f0bca6c..5563608d 100644 --- a/src/net/smtp/SMTPServiceInfos.cpp +++ b/src/net/smtp/SMTPServiceInfos.cpp @@ -62,7 +62,6 @@ const SMTPServiceInfos::props& SMTPServiceInfos::getProperties() const property(serviceInfos::property::SERVER_ADDRESS, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::SERVER_PORT, "25"), - property(serviceInfos::property::SERVER_SOCKETFACTORY), property(serviceInfos::property::TIMEOUT_FACTORY) }; @@ -87,7 +86,6 @@ const SMTPServiceInfos::props& SMTPServiceInfos::getProperties() const property(serviceInfos::property::SERVER_ADDRESS, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::SERVER_PORT, "465"), - property(serviceInfos::property::SERVER_SOCKETFACTORY), property(serviceInfos::property::TIMEOUT_FACTORY) }; @@ -122,7 +120,6 @@ const std::vector <serviceInfos::property> SMTPServiceInfos::getAvailablePropert list.push_back(p.PROPERTY_SERVER_ADDRESS); list.push_back(p.PROPERTY_SERVER_PORT); - list.push_back(p.PROPERTY_SERVER_SOCKETFACTORY); list.push_back(p.PROPERTY_TIMEOUT_FACTORY); diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp index d0c72a13..645f6aa2 100644 --- a/src/net/smtp/SMTPTransport.cpp +++ b/src/net/smtp/SMTPTransport.cpp @@ -98,10 +98,7 @@ void SMTPTransport::connect() } // Create and connect the socket - socketFactory* sf = platformDependant::getHandler()-> - getSocketFactory(GET_PROPERTY(string, PROPERTY_SERVER_SOCKETFACTORY)); - - m_socket = sf->create(); + m_socket = getSocketFactory()->create(); #if VMIME_HAVE_TLS_SUPPORT if (m_secured) // dedicated port/SMTPS diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp index ef7e55cc..8703d4c0 100644 --- a/src/platforms/posix/posixHandler.cpp +++ b/src/platforms/posix/posixHandler.cpp @@ -48,7 +48,7 @@ namespace posix { posixHandler::posixHandler() { #if VMIME_HAVE_MESSAGING_FEATURES - m_socketFactory = new posixSocketFactory(); + m_socketFactory = vmime::create <posixSocketFactory>(); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES m_fileSysFactory = new posixFileSystemFactory(); @@ -59,9 +59,6 @@ posixHandler::posixHandler() posixHandler::~posixHandler() { -#if VMIME_HAVE_MESSAGING_FEATURES - delete (m_socketFactory); -#endif #if VMIME_HAVE_FILESYSTEM_FEATURES delete (m_fileSysFactory); delete (m_childProcFactory); @@ -172,10 +169,9 @@ const unsigned int posixHandler::getProcessId() const #if VMIME_HAVE_MESSAGING_FEATURES -vmime::net::socketFactory* posixHandler::getSocketFactory - (const vmime::string& /* name */) const +ref <vmime::net::socketFactory> posixHandler::getSocketFactory() const { - return (m_socketFactory); + return m_socketFactory.dynamicCast <vmime::net::socketFactory>(); } diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp index d67b9d5a..4f5a94b5 100644 --- a/src/platforms/windows/windowsHandler.cpp +++ b/src/platforms/windows/windowsHandler.cpp @@ -42,7 +42,7 @@ namespace windows { windowsHandler::windowsHandler() { #if VMIME_HAVE_MESSAGING_FEATURES - m_socketFactory = new windowsSocketFactory(); + m_socketFactory = vmime::create <windowsSocketFactory>(); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES m_fileSysFactory = new windowsFileSystemFactory(); @@ -52,9 +52,6 @@ windowsHandler::windowsHandler() windowsHandler::~windowsHandler() { -#if VMIME_HAVE_MESSAGING_FEATURES - delete (m_socketFactory); -#endif #if VMIME_HAVE_FILESYSTEM_FEATURES delete (m_fileSysFactory); #endif @@ -237,10 +234,9 @@ const unsigned int windowsHandler::getProcessId() const #if VMIME_HAVE_MESSAGING_FEATURES -vmime::net::socketFactory* windowsHandler::getSocketFactory - (const vmime::string& /* name */) const +ref <vmime::net::socketFactory> windowsHandler::getSocketFactory() const { - return (m_socketFactory); + return m_socketFactory.dynamicCast <vmime::net::socketFactory>(); } |