[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:07:56 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=5e9c577
The following commit has been merged in the master branch:
commit 5e9c577800a69fdbf0107178d5fb57997a7255ec
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Wed Dec 18 16:18:19 2013 +0100
Expose DbusProxy factories as singleton objects
Having a singleton AccountManager is problematic because we often
need advanced channel factories for applications and don't want
to increase dbus traffic in other applications.
By exposing factories individually we can create custom client
registrars with differnet channel factories whilst sharing the
expensive account, connection and contact objects.
REVIEW: 114526
---
KTp/core.cpp | 48 ++++++++++++++++++++++++++++++++++++------------
KTp/core.h | 41 +++++++++++++++++++++++++++++++++--------
2 files changed, 69 insertions(+), 20 deletions(-)
diff --git a/KTp/core.cpp b/KTp/core.cpp
index 783b7cd..a221e68 100644
--- a/KTp/core.cpp
+++ b/KTp/core.cpp
@@ -36,6 +36,11 @@ class CorePrivate
public:
CorePrivate();
bool m_kPeopleEnabled;
+ Tp::AccountFactoryPtr m_accountFactory;
+ Tp::ConnectionFactoryPtr m_connectionFactory;
+ Tp::ContactFactoryPtr m_contactFactory;
+ Tp::ChannelFactoryPtr m_channelFactory ;
+
Tp::AccountManagerPtr m_accountManager;
KTp::GlobalContactManager *m_contactManager;
};
@@ -49,29 +54,21 @@ CorePrivate::CorePrivate()
m_kPeopleEnabled = true;
#endif
- Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
+ m_accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
Tp::Features() << Tp::Account::FeatureCore
- << Tp::Account::FeatureCapabilities
- << Tp::Account::FeatureProtocolInfo
<< Tp::Account::FeatureProfile);
- Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
+ m_connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
Tp::Features() << Tp::Connection::FeatureCore
<< Tp::Connection::FeatureSelfContact);
- Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(Tp::Features() << Tp::Contact::FeatureAlias
+ m_contactFactory = KTp::ContactFactory::create(Tp::Features() << Tp::Contact::FeatureAlias
<< Tp::Contact::FeatureSimplePresence
<< Tp::Contact::FeatureCapabilities
<< Tp::Contact::FeatureClientTypes
<< Tp::Contact::FeatureAvatarData);
- Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
-
- m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
- accountFactory,
- connectionFactory,
- channelFactory,
- contactFactory);
+ m_channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
}
K_GLOBAL_STATIC(CorePrivate, s_instance)
@@ -81,8 +78,35 @@ bool KTp::kpeopleEnabled()
return s_instance->m_kPeopleEnabled;
}
+Tp::AccountFactoryConstPtr KTp::accountFactory()
+{
+ return s_instance->m_accountFactory;
+}
+
+Tp::ConnectionFactoryConstPtr KTp::connectionFactory()
+{
+ return s_instance->m_connectionFactory;
+}
+
+Tp::ChannelFactoryConstPtr KTp::channelFactory()
+{
+ return s_instance->m_channelFactory;
+}
+
+Tp::ContactFactoryConstPtr KTp::contactFactory()
+{
+ return s_instance->m_contactFactory;
+}
+
Tp::AccountManagerPtr KTp::accountManager()
{
+ if (!s_instance->m_accountManager) {
+ s_instance->m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
+ KTp::accountFactory(),
+ KTp::connectionFactory(),
+ KTp::channelFactory(),
+ KTp::contactFactory());
+ }
return s_instance->m_accountManager;
}
diff --git a/KTp/core.h b/KTp/core.h
index 9db9cf4..02c4cbe 100644
--- a/KTp/core.h
+++ b/KTp/core.h
@@ -28,18 +28,43 @@ class GlobalContactManager;
KTP_EXPORT bool kpeopleEnabled();
+ /**
+ * Returns an accountFactory with the following features set:
+ * - FeatureCore
+ * - FeatureProfile
+ *
+ * FeatureConnection is not set, accounts will be created with a null connection at startup
+ *
+ */
+
+ KTP_EXPORT Tp::AccountFactoryConstPtr accountFactory();
- //FIXME for 0.8
- /* For 0.8 we have a plan to have a singleton accountManager
- (or accountFactory/contactFactory/channelFactory/connectionFactory).
+ /**
+ * Returns a connectionFactory with the following features set:
+ * - FeatureCore
+ * - FeatureSelfContact
+ *
+ * FeatureRoster is expensive and should be called manually in becomeReady(Feature::Connection::FeatureRoster)
+ *
+ */
- We didn't get this done for everyone to use this in time for 0.7.
- However we still need the contact list and kpeople to share the connectionFactory
- This is an initial half-completed version.
+ KTP_EXPORT Tp::ConnectionFactoryConstPtr connectionFactory();
- It is best not to use this method. It's only half complete.
+ /**
+ * Returns a default channelFactory with no special features.
+ * Applications are expected to create a custom channel factories for their clientRegistrars
*/
- KTP_EXPORT Tp::AccountManagerPtr accountManager();
+ KTP_EXPORT Tp::ChannelFactoryConstPtr channelFactory();
+ /**
+ * Returns a contactFactory with the following features set:
+ * - FeatureSimplePresence
+ * - FeatureCapabilities
+ * - FeatureClientTypes
+ * - FeatureAvatarData
+ */
+ KTP_EXPORT Tp::ContactFactoryConstPtr contactFactory();
+
+ KTP_EXPORT Tp::AccountManagerPtr accountManager();
KTP_EXPORT KTp::GlobalContactManager* contactManager();
}
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list