diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-20 14:17:51 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-20 17:35:59 +0200 |
commit | 24209be305acc24a0432bcda21a8919a309ac9ea (patch) | |
tree | 4ee7b448efe4d860eb4b13cbe3342ac539284695 /tubes/source | |
parent | 466edaa9fb54f7f976c176635fb836f7cd85b456 (diff) |
tubes: fix indentation and scope of variables
Change-Id: Ibd0b000d2a8f216e0eb202f7fa7795903e5e18e8
Diffstat (limited to 'tubes/source')
-rw-r--r-- | tubes/source/manager.cxx | 69 |
1 files changed, 30 insertions, 39 deletions
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index fde9281da516..80899767bc97 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -792,54 +792,45 @@ static void presence_changed_cb( TpContact* /* contact */, AccountContactPairV TeleManager::getContacts() { - GList *accounts; - AccountContactPairV pairs; + AccountContactPairV pairs; - for (accounts = tp_account_manager_get_valid_accounts (pImpl->mpAccountManager); - accounts != NULL; - accounts = g_list_delete_link (accounts, accounts)) + for (GList *accounts = tp_account_manager_get_valid_accounts (pImpl->mpAccountManager); + accounts != NULL; accounts = g_list_delete_link (accounts, accounts)) { - TpAccount *account = reinterpret_cast<TpAccount *>(accounts->data); - TpConnection *connection = tp_account_get_connection (account); - TpContact *self; - GPtrArray *contacts; - guint i; - - /* Verify account is online and received its contact list. If state is not - * SUCCESS this means we didn't received the roster from server yet and - * we would have to wait for the "notify:contact-list-state" signal. */ - if (connection == NULL || - tp_connection_get_contact_list_state (connection) != - TP_CONTACT_LIST_STATE_SUCCESS) - continue; - - self = tp_connection_get_self_contact (connection); - contacts = tp_connection_dup_contact_list (connection); - for (i = 0; i < contacts->len; i++) + TpAccount *account = reinterpret_cast<TpAccount *>(accounts->data); + TpConnection *connection = tp_account_get_connection (account); + + /* Verify account is online and received its contact list. If state is not + * SUCCESS this means we didn't received the roster from server yet and + * we would have to wait for the "notify:contact-list-state" signal. */ + if (connection == NULL || tp_connection_get_contact_list_state (connection) != + TP_CONTACT_LIST_STATE_SUCCESS) + continue; + + TpContact *self = tp_connection_get_self_contact (connection); + GPtrArray *contacts = tp_connection_dup_contact_list (connection); + for (guint i = 0; i < contacts->len; i++) { - TpContact *contact = - reinterpret_cast<TpContact *>(g_ptr_array_index (contacts, i)); - if (pImpl->maRegisteredContacts.find (contact) == pImpl->maRegisteredContacts.end()) - { - pImpl->maRegisteredContacts.insert (contact); - g_signal_connect (contact, "presence-changed", - G_CALLBACK (presence_changed_cb), NULL ); - } - - if (contact != self && - tb_contact_is_online (contact)) + TpContact *contact = reinterpret_cast<TpContact *>(g_ptr_array_index (contacts, i)); + if (pImpl->maRegisteredContacts.find (contact) == pImpl->maRegisteredContacts.end()) + { + pImpl->maRegisteredContacts.insert (contact); + g_signal_connect (contact, "presence-changed", + G_CALLBACK (presence_changed_cb), NULL ); + } + if (contact != self && tb_contact_is_online (contact)) { - g_object_ref (account); - g_object_ref (contact); + g_object_ref (account); + g_object_ref (contact); - AccountContactPair pair(account, contact); - pairs.push_back(pair); + AccountContactPair pair(account, contact); + pairs.push_back(pair); } } - g_ptr_array_unref (contacts); + g_ptr_array_unref (contacts); } - return pairs; + return pairs; } rtl::OString TeleManager::getFullClientName() |