[Bug 25035] New: Add API to Tp::AccountManager to get a list of Tp::Accounts, all ready.
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Nov 11 16:22:38 CET 2009
http://bugs.freedesktop.org/show_bug.cgi?id=25035
Summary: Add API to Tp::AccountManager to get a list of
Tp::Accounts, all ready.
Product: Telepathy
Version: unspecified
Platform: Other
OS/Version: All
Status: NEW
Severity: enhancement
Priority: medium
Component: tp-qt4
AssignedTo: telepathy-bugs at lists.freedesktop.org
ReportedBy: will.thompson at collabora.co.uk
I keep assuming when giving examples of how to use TpQt4 that, given a ready
Tp::AccountManager, you can get a list of Tp::Accounts corresponding to
ValidAccounts, all of which are ready. But currently, you have to iterate
am->validAccounts, constructing a Tp::Account for each one, wait for them all
to become ready, and only then do whatever you wanted to do in the first place.
You need to make sure you cope correctly with an account being deleted while
you wait. While it's not rocket science, it's something people will get wrong,
and this is something the binding should do for us.
Potential API for this would need a way to say what features you want to be
ready on the list of Tp::Accounts. I guess this is why it's non-trivial. I can
think of two ways the API could work off-hand:
• Add a Feature to Tp::AM saying that you want it to keep the Tp::Accounts
ready for you, and an extra argument to becomeReady to say which features you
want ready on those Tp::Accounts. Then, make am->validAccounts() and friends on
a Tp::AM with FeatureReadyAccounts enabled always give you ready accounts back.
• Add am->prepareValidAccounts(AccountFeatures f), an asynchronous operation.
I think the former would make life easier for the programmer. Compare:
mAM = Tp::AccountManager::create();
connect(mAM->becomeReady(Tp::AccountManager::FeatureReadyAccounts,
Tp::Account::FeatureProtocolInfo),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onAMReady(Tp::PendingOperation *)));
void onAMReady(...) {
QList<AccountPtr> accounts = mAM->validAccounts();
// do whatever you wanted to do
}
to:
mAM = Tp::AccountManager::create();
connect(mAM->becomeReady(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onAMReady(Tp::PendingOperation *)));
void onAMReady(...) {
connect(mAM->prepareValidAccounts(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onAccountsReady(Tp::PendingOperation *)));
}
void onAccountsReady(...) {
// do whatever you wanted to do
}
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list