From 681297e10b666e13cc463f6fbb16236f36c3266c Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Jul 2005 22:28:02 +0000 Subject: Reference counting and smart pointers. --- src/messaging/service.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/messaging/service.cpp') diff --git a/src/messaging/service.cpp b/src/messaging/service.cpp index c8872758..eab4db8a 100644 --- a/src/messaging/service.cpp +++ b/src/messaging/service.cpp @@ -26,39 +26,41 @@ namespace vmime { namespace messaging { -service::service(session* sess, const serviceInfos& infos, authenticator* auth) - : m_deleteAuth(auth == NULL), m_session(sess), m_auth(auth ? auth : - new defaultAuthenticator(sess->getProperties(), infos.getPropertyPrefix())) +service::service(ref sess, const serviceInfos& infos, ref auth) + : m_session(sess), m_auth(auth) { + if (!auth) + { + m_auth = vmime::create + (sess, infos.getPropertyPrefix()); + } } service::~service() { - if (m_deleteAuth) - delete (m_auth); } -const session* service::getSession() const +ref service::getSession() const { return (m_session); } -session* service::getSession() +ref service::getSession() { return (m_session); } -const authenticator* service::getAuthenticator() const +ref service::getAuthenticator() const { return (m_auth); } -authenticator* service::getAuthenticator() +ref service::getAuthenticator() { return (m_auth); } -- cgit