vmime/src/net/service.cpp

88 lines
1.9 KiB
C++
Raw Normal View History

//
// VMime library (http://www.vmime.org)
// Copyright (C) 2002-2005 Vincent Richard <vincent@vincent-richard.net>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
2005-09-17 10:10:29 +00:00
// You should have received a copy of the GNU General Public License along along
// with this program; if not, write to the Free Software Foundation, Inc., Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA..
//
2005-09-17 09:08:45 +00:00
#include "vmime/config.hpp"
#include "vmime/net/service.hpp"
2005-09-17 09:08:45 +00:00
#if VMIME_HAVE_SASL_SUPPORT
#include "vmime/security/sasl/defaultSASLAuthenticator.hpp"
#else
#include "vmime/security/defaultAuthenticator.hpp"
#endif // VMIME_HAVE_SASL_SUPPORT
namespace vmime {
namespace net {
2005-09-17 09:08:45 +00:00
service::service(ref <session> sess, const serviceInfos& /* infos */,
ref <security::authenticator> auth)
: m_session(sess), m_auth(auth)
{
if (!auth)
{
2005-09-17 09:08:45 +00:00
#if VMIME_HAVE_SASL_SUPPORT
m_auth = vmime::create
<security::sasl::defaultSASLAuthenticator>();
#else
m_auth = vmime::create
<security::defaultAuthenticator>();
#endif // VMIME_HAVE_SASL_SUPPORT
}
}
service::~service()
{
}
ref <const session> service::getSession() const
{
return (m_session);
}
ref <session> service::getSession()
{
return (m_session);
}
2005-09-17 09:08:45 +00:00
ref <const security::authenticator> service::getAuthenticator() const
{
return (m_auth);
}
2005-09-17 09:08:45 +00:00
ref <security::authenticator> service::getAuthenticator()
{
return (m_auth);
}
2005-09-17 09:08:45 +00:00
void service::setAuthenticator(ref <security::authenticator> auth)
{
m_auth = auth;
}
} // net
} // vmime