Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
766a0247
Kaydet (Commit)
766a0247
authored
Agu 15, 2012
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tubes: also prepare the Account Manager when creating; and simplify
Change-Id: I7705d627d17f20c3c81de7aa4debbefc127354b0
üst
bd465b57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
116 deletions
+44
-116
manager.hxx
tubes/inc/tubes/manager.hxx
+3
-24
test_manager.cxx
tubes/qa/test_manager.cxx
+0
-11
contact-list.cxx
tubes/source/contact-list.cxx
+0
-23
manager.cxx
tubes/source/manager.cxx
+41
-58
No files found.
tubes/inc/tubes/manager.hxx
Dosyayı görüntüle @
766a0247
...
...
@@ -57,16 +57,8 @@ class TeleManager
{
TeleManager
();
~
TeleManager
();
public
:
enum
AccountManagerStatus
{
AMS_UNINITIALIZED
=
0
,
AMS_INPREPARATION
,
AMS_UNPREPARABLE
,
AMS_PREPARED
};
public
:
/** Prepare tube manager with account and service to be offered/listened
to.
*/
...
...
@@ -80,23 +72,12 @@ public:
/** Get a conference with current UUID to set a session. */
TUBES_DLLPUBLIC
static
TeleConference
*
getConference
();
/** Connect to DBus
and create Account
Manager. */
/** Connect to DBus
, create and prepare the Telepathy Account
Manager. */
static
bool
createAccountManager
();
/** Setup client handlers. */
static
bool
registerClients
();
/** Prepare the Telepathy Account Manager.
Requires createAccountManager() to have succeeded.
Invokes an async call that is not ready until meAccountManagerStatus is
set! Until that is AMS_PREPARED nothing else will work.
TODO: this needs some signalling mechanism
*/
static
void
prepareAccountManager
();
static
AccountManagerStatus
getAccountManagerStatus
();
/** Fetches the contact list. Returns 0 before connect() is called successfully.
Is non-functional until prepareAccountManager().
*/
...
...
@@ -151,12 +132,10 @@ public:
static
void
addConference
(
TeleConference
*
pConference
);
static
void
setChannelReadyHandlerInvoked
(
bool
b
);
static
bool
isChannelReadyHandlerInvoked
();
static
void
setAccountManagerReady
(
bool
bPrepared
);
static
void
setAccountManagerReadyHandlerInvoked
(
bool
b
);
static
bool
isAccountManagerReadyHandlerInvoked
();
/** Only the callback of prepareAccountManager() is to set this. */
static
void
setAccountManagerReady
(
bool
bPrepared
);
/// "LibreOfficeWhatEver"
static
rtl
::
OString
getFullClientName
();
...
...
tubes/qa/test_manager.cxx
Dosyayı görüntüle @
766a0247
...
...
@@ -55,7 +55,6 @@ public:
void
testCreateAccountManager
();
void
testRegisterClients
();
void
testContactList
();
void
testPrepareAccountManager
();
void
testStartBuddySession
();
void
testSendPacket
();
void
testReceivePacket
();
...
...
@@ -70,7 +69,6 @@ public:
CPPUNIT_TEST
(
testInitialize
);
CPPUNIT_TEST
(
testCreateAccountManager
);
CPPUNIT_TEST
(
testRegisterClients
);
CPPUNIT_TEST
(
testPrepareAccountManager
);
CPPUNIT_TEST
(
testContactList
);
CPPUNIT_TEST
(
testStartBuddySession
);
CPPUNIT_TEST
(
testSendPacket
);
...
...
@@ -129,8 +127,6 @@ void TestTeleTubes::testInitialize()
void
TestTeleTubes
::
testContactList
()
{
CPPUNIT_ASSERT
(
TeleManager
::
getAccountManagerStatus
()
==
TeleManager
::
AMS_PREPARED
);
ContactList
*
cl
=
TeleManager
::
getContactList
();
AccountContactPairV
pairs
;
...
...
@@ -172,13 +168,6 @@ void TestTeleTubes::testContactList()
mpAccepterContact
);
}
void
TestTeleTubes
::
testPrepareAccountManager
()
{
TeleManager
::
prepareAccountManager
();
TeleManager
::
AccountManagerStatus
eStatus
=
TeleManager
::
getAccountManagerStatus
();
CPPUNIT_ASSERT
(
eStatus
==
TeleManager
::
AMS_PREPARED
);
}
void
TestTeleTubes
::
testStartBuddySession
()
{
TpAccount
*
pAcc1
=
TeleManager
::
getAccount
(
maOffererIdentifier
);
...
...
tubes/source/contact-list.cxx
Dosyayı görüntüle @
766a0247
...
...
@@ -40,29 +40,6 @@ ContactList::ContactList(TpAccountManager *pAccountManager)
SAL_WARN_IF
(
!
mpAccountManager
,
"tubes"
,
"ContactList::ContactList: passed a null account manager"
);
g_object_ref
(
mpAccountManager
);
/* Tell the client factory (which creates and prepares proxy objects) to
* get the features we need ready before giving us any objects.
*/
TpSimpleClientFactory
*
factory
=
tp_proxy_get_factory
(
mpAccountManager
);
/* We need every online account's connection object to be available... */
tp_simple_client_factory_add_account_features_varargs
(
factory
,
TP_ACCOUNT_FEATURE_CONNECTION
,
0
);
/* ...and we want those connection objects to have the contact list
* available... */
tp_simple_client_factory_add_connection_features_varargs
(
factory
,
TP_CONNECTION_FEATURE_CONTACT_LIST
,
0
);
/* ...and those contacts should have their alias and their capabilities
* available.
*/
tp_simple_client_factory_add_contact_features_varargs
(
factory
,
TP_CONTACT_FEATURE_ALIAS
,
TP_CONTACT_FEATURE_AVATAR_DATA
,
TP_CONTACT_FEATURE_CAPABILITIES
,
TP_CONTACT_FEATURE_PRESENCE
,
TP_CONTACT_FEATURE_INVALID
);
}
ContactList
::~
ContactList
()
...
...
tubes/source/manager.cxx
Dosyayı görüntüle @
766a0247
...
...
@@ -83,11 +83,11 @@ using namespace osl;
class
TeleManagerImpl
{
public
:
Tp
AutomaticClientFactory
*
mpFactory
;
Tp
SimpleClientFactory
*
mpFactory
;
TpBaseClient
*
mpClient
;
TpBaseClient
*
mpFileTransferClient
;
TpAccountManager
*
mpAccountManager
;
TeleManager
::
AccountManagerStatus
meAccountManagerStatus
;
bool
mbAccountManagerReady
:
1
;
bool
mbAccountManagerReadyHandlerInvoked
:
1
;
bool
mbChannelReadyHandlerInvoked
:
1
;
ContactList
*
mpContactList
;
...
...
@@ -441,7 +441,6 @@ bool TeleManager::init( bool bListen )
{
if
(
createAccountManager
())
{
prepareAccountManager
();
if
(
bListen
&&
!
registerClients
())
SAL_WARN
(
"tubes"
,
"TeleManager::init: Could not register client handlers."
);
...
...
@@ -478,22 +477,41 @@ bool TeleManager::createAccountManager()
return
false
;
}
pImpl
->
mpFactory
=
tp_automatic_client_factory_new
(
pDBus
);
pImpl
->
mpFactory
=
TP_SIMPLE_CLIENT_FACTORY
(
tp_automatic_client_factory_new
(
pDBus
)
);
g_object_unref
(
pDBus
);
SAL_WARN_IF
(
!
pImpl
->
mpFactory
,
"tubes"
,
"TeleManager::createAccountManager: no client factory"
);
if
(
!
pImpl
->
mpFactory
)
return
false
;
TpAccountManager
*
pAccountManager
=
tp_account_manager_new_with_factory
(
TP_SIMPLE_CLIENT_FACTORY
(
pImpl
->
mpFactory
));
tp_account_manager_set_default
(
pAccountManager
);
/* Takes our ref. */
pImpl
->
mpAccountManager
=
pAccountManager
;
/* Tell the client factory (which creates and prepares proxy objects) to
* get the features we need ready before giving us any objects.
*/
/* We need every online account's connection object to be available... */
tp_simple_client_factory_add_account_features_varargs
(
pImpl
->
mpFactory
,
TP_ACCOUNT_FEATURE_CONNECTION
,
0
);
/* ...and we want those connection objects to have the contact list
* available... */
tp_simple_client_factory_add_connection_features_varargs
(
pImpl
->
mpFactory
,
TP_CONNECTION_FEATURE_CONTACT_LIST
,
0
);
/* ...and those contacts should have their alias and their capabilities
* available.
*/
tp_simple_client_factory_add_contact_features_varargs
(
pImpl
->
mpFactory
,
TP_CONTACT_FEATURE_ALIAS
,
TP_CONTACT_FEATURE_AVATAR_DATA
,
TP_CONTACT_FEATURE_CAPABILITIES
,
TP_CONTACT_FEATURE_PRESENCE
,
TP_CONTACT_FEATURE_INVALID
);
pImpl
->
mpContactList
=
new
ContactList
(
pAccountManager
);
pImpl
->
mpAccountManager
=
tp_account_manager_new_with_factory
(
pImpl
->
mpFactory
);
tp_account_manager_set_default
(
pImpl
->
mpAccountManager
);
return
true
;
setAccountManagerReadyHandlerInvoked
(
false
);
tp_proxy_prepare_async
(
pImpl
->
mpAccountManager
,
NULL
,
TeleManager_AccountManagerReadyHandler
,
NULL
);
lcl_iterateLoop
(
&
TeleManager
::
isAccountManagerReadyHandlerInvoked
);
return
pImpl
->
mbAccountManagerReady
;
}
bool
TeleManager
::
registerClients
()
...
...
@@ -508,7 +526,7 @@ bool TeleManager::registerClients()
return
true
;
pImpl
->
mpClient
=
tp_simple_handler_new_with_factory
(
TP_SIMPLE_CLIENT_FACTORY
(
pImpl
->
mpFactory
),
// factory
pImpl
->
mpFactory
,
// factory
FALSE
,
// bypass_approval
FALSE
,
// requests
getFullClientName
().
getStr
(),
// name
...
...
@@ -556,7 +574,7 @@ bool TeleManager::registerClients()
* user isn't prompted before the channel gets passed to us.
*/
pImpl
->
mpFileTransferClient
=
tp_simple_handler_new_with_factory
(
TP_SIMPLE_CLIENT_FACTORY
(
pImpl
->
mpFactory
),
// factory
pImpl
->
mpFactory
,
// factory
TRUE
,
// bypass_approval
FALSE
,
// requests
getFullClientName
().
getStr
(),
// name
...
...
@@ -731,45 +749,6 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
return
pConference
;
}
void
TeleManager
::
prepareAccountManager
()
{
INFO_LOGGER_F
(
"TeleManager::prepareAccountManager"
);
MutexGuard
aGuard
(
GetMutex
());
SAL_INFO_IF
(
pImpl
->
meAccountManagerStatus
==
AMS_PREPARED
,
"tubes"
,
"TeleManager::prepareAccountManager: already prepared"
);
if
(
pImpl
->
meAccountManagerStatus
==
AMS_PREPARED
)
return
;
SAL_WARN_IF
(
pImpl
->
meAccountManagerStatus
==
AMS_INPREPARATION
,
"tubes"
,
"TeleManager::prepareAccountManager: already in preparation"
);
if
(
pImpl
->
meAccountManagerStatus
==
AMS_INPREPARATION
)
return
;
SAL_WARN_IF
(
pImpl
->
meAccountManagerStatus
!=
AMS_UNINITIALIZED
,
"tubes"
,
"TeleManager::prepareAccountManager: yet another attempt"
);
SAL_WARN_IF
(
!
pImpl
->
mpAccountManager
,
"tubes"
,
"TeleManager::prepareAccountManager: called before ::connect()"
);
if
(
!
pImpl
->
mpAccountManager
)
return
;
pImpl
->
meAccountManagerStatus
=
AMS_INPREPARATION
;
setAccountManagerReadyHandlerInvoked
(
false
);
tp_proxy_prepare_async
(
pImpl
->
mpAccountManager
,
NULL
,
TeleManager_AccountManagerReadyHandler
,
NULL
);
lcl_iterateLoop
(
&
TeleManager
::
isAccountManagerReadyHandlerInvoked
);
}
TeleManager
::
AccountManagerStatus
TeleManager
::
getAccountManagerStatus
()
{
return
pImpl
->
meAccountManagerStatus
;
}
void
TeleManager
::
setAccountManagerReadyHandlerInvoked
(
bool
b
)
{
pImpl
->
mbAccountManagerReadyHandlerInvoked
=
b
;
...
...
@@ -792,6 +771,9 @@ bool TeleManager::isChannelReadyHandlerInvoked()
ContactList
*
TeleManager
::
getContactList
()
{
if
(
!
pImpl
->
mpContactList
)
pImpl
->
mpContactList
=
new
ContactList
(
pImpl
->
mpAccountManager
);
return
pImpl
->
mpContactList
;
}
...
...
@@ -799,9 +781,9 @@ TpAccount* TeleManager::getAccount( const rtl::OString& rAccountID )
{
INFO_LOGGER_F
(
"TeleManager::getMyAccount"
);
SAL_WARN_IF
(
pImpl
->
meAccountManagerStatus
!=
AMS_PREPARED
,
"tubes"
,
SAL_WARN_IF
(
!
pImpl
->
mbAccountManagerReady
,
"tubes"
,
"TeleManager::getMyAccount: Account Manager not prepared"
);
if
(
pImpl
->
meAccountManagerStatus
!=
AMS_PREPARED
)
if
(
!
pImpl
->
mbAccountManagerReady
)
return
NULL
;
GList
*
pAccounts
=
tp_account_manager_get_valid_accounts
(
pImpl
->
mpAccountManager
);
...
...
@@ -832,7 +814,7 @@ TpAccount* TeleManager::getAccount( const rtl::OString& rAccountID )
void
TeleManager
::
setAccountManagerReady
(
bool
bPrepared
)
{
pImpl
->
m
eAccountManagerStatus
=
(
bPrepared
?
AMS_PREPARED
:
AMS_UNPREPARABLE
)
;
pImpl
->
m
bAccountManagerReady
=
bPrepared
;
}
...
...
@@ -898,9 +880,10 @@ TeleManagerImpl::TeleManagerImpl()
mpClient
(
NULL
),
mpFileTransferClient
(
NULL
),
mpAccountManager
(
NULL
),
m
eAccountManagerStatus
(
TeleManager
::
AMS_UNINITIALIZED
),
m
bAccountManagerReady
(
false
),
mbAccountManagerReadyHandlerInvoked
(
false
),
mbChannelReadyHandlerInvoked
(
false
)
mbChannelReadyHandlerInvoked
(
false
),
mpContactList
(
NULL
)
{
g_type_init
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment