aboutsummaryrefslogtreecommitdiffstats
path: root/src/messaging/session.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2004-12-26 16:46:52 +0000
committerVincent Richard <[email protected]>2004-12-26 16:46:52 +0000
commitf5f15e5076b979e1c532bf03a12cda96c42bf0b1 (patch)
treef35b0ed8fd175d08101f0a0cb09cc9db26ebe75d /src/messaging/session.cpp
parentFixed bug in URL parsing. (diff)
downloadvmime-f5f15e5076b979e1c532bf03a12cda96c42bf0b1.tar.gz
vmime-f5f15e5076b979e1c532bf03a12cda96c42bf0b1.zip
Allow creating a service from an URL.
Diffstat (limited to 'src/messaging/session.cpp')
-rw-r--r--src/messaging/session.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/messaging/session.cpp b/src/messaging/session.cpp
index 76d3c07a..8edfcab4 100644
--- a/src/messaging/session.cpp
+++ b/src/messaging/session.cpp
@@ -64,6 +64,20 @@ transport* session::getTransport(const string& protocol, authenticator* auth)
}
+transport* session::getTransport(const messaging::url& url, authenticator* auth)
+{
+ service* sv = serviceFactory::getInstance()->create(this, url, auth);
+
+ if (sv->getType() != service::TYPE_TRANSPORT)
+ {
+ delete (sv);
+ throw exceptions::no_service_available();
+ }
+
+ return static_cast<transport*>(sv);
+}
+
+
store* session::getStore(authenticator* auth)
{
return (getStore(m_props["store.protocol"], auth));
@@ -84,6 +98,20 @@ store* session::getStore(const string& protocol, authenticator* auth)
}
+store* session::getStore(const messaging::url& url, authenticator* auth)
+{
+ service* sv = serviceFactory::getInstance()->create(this, url, auth);
+
+ if (sv->getType() != service::TYPE_STORE)
+ {
+ delete (sv);
+ throw exceptions::no_service_available();
+ }
+
+ return static_cast<store*>(sv);
+}
+
+
const propertySet& session::getProperties() const
{
return (m_props);