void TAccountXmpp::RemoveAllReferencesToObjectsAboutBeingDeleted() { TContact ** ppContactStop; TContact ** ppContact = m_arraypaContacts.PrgpGetContactsStop(OUT &ppContactStop); while (ppContact != ppContactStop) { TContact * pContact = *ppContact++; pContact->Vault_RemoveAllReferencesToObjectsAboutBeingDeleted(); } TGroup ** ppGroupStop; TGroup ** ppGroup = m_arraypaGroups.PrgpGetGroupsStop(OUT &ppGroupStop); while (ppGroup != ppGroupStop) { TGroup * pGroup = *ppGroup++; Assert(pGroup != NULL); Assert(pGroup->EGetRuntimeClass() == RTI(TGroup)); Assert(pGroup->m_pAccount == this); pGroup->Group_RemoveAllReferencesToContactsAboutBeingDeleted(); } // m_arraypaGroups.RemoveAllUnserializableTreeItems(); // m_arraypaContacts.RemoveAllUnserializableTreeItems(); m_arraypContactsComposing.RemoveAllUnserializableTreeItems(); m_arraypContactsMessagesUnread.RemoveAllUnserializableTreeItems(); }
void CEventBallotSent::CalculateStatistics(OUT SEventPollStatistics * pStatistics) { Assert(pStatistics != NULL); InitToZeroes(OUT pStatistics, sizeof(*pStatistics)); pStatistics->cSent = 1; // The ballot was sent to an indivdiual // To determine how many recipients received the ballot, we need to look at the vault. TGroup * pGroup = (TGroup *)m_pVaultParent_NZ->m_pParent; if (pGroup->EGetRuntimeClass() == RTI(TGroup)) { pStatistics->cSent = pGroup->m_arraypaMembers.GetSize(); // TODO: If a new group member was added or removed, the code should look at the timestamps the poll started to include only those at the time of the poll } pStatistics->cResponded = m_arraypaVotes.GetSize(); pStatistics->cPending = pStatistics->cSent - pStatistics->cResponded; }
// Core routine to add a new event to the vault and send it to the contact(s). // Optionally this method may also send an 'Updater' event void CVaultEvents::EventAddAndDispatchToContacts(PA_CHILD IEvent * paEvent, PA_CHILD CEventUpdaterSent * paEventUpdater) { Assert(paEvent != NULL); Assert(paEvent->m_tsOther == d_ts_zNA); Assert(paEvent->m_pVaultParent_NZ == NULL); Assert(paEvent->Event_FIsEventTypeSent()); //MessageLog_AppendTextFormatSev(eSeverityWarningToErrorLog, "EventAddAndDispatchToContacts() - tsEventID $t\n", paEvent->m_tsEventID); if (paEventUpdater != NULL) { // Always include the Updater before the updated event paEventUpdater->m_pVaultParent_NZ = this; m_arraypaEvents.Add(PA_CHILD paEventUpdater); } paEvent->m_pVaultParent_NZ = this; m_arraypaEvents.Add(PA_CHILD paEvent); SetModified(); // Make sure the events are saved to disk if (paEvent->EGetEventClass() & eEventClass_kfNeverSerializeToXCP) return; // The event is never serialized to XOSP, therefore there is nothing else to do CBinXcpStanza binXcpStanza; // All events are sent as XMPP 'messages' so they may be cached TGroup * pGroup = (TGroup *)m_pParent; TContact * pContact = (TContact *)m_pParent; if (pContact->EGetRuntimeClass() == RTI(TContact)) { // Send the message to a contact MessageLog_AppendTextFormatCo(d_coGrayDark, "\t Sending message to $S\n\t\t m_tsEventIdLastSentCached $t, m_tsOtherLastSynchronized $t\n", &pContact->m_strJidBare, pContact->m_tsEventIdLastSentCached, pContact->m_tsOtherLastSynchronized); binXcpStanza.BinXmlAppendXcpApiCall_SendEventToContact(pContact, paEvent, paEventUpdater); } else { // Broadcast the message to every [active] group member Assert(pGroup->EGetRuntimeClass() == RTI(TGroup)); TGroupMember ** ppMemberStop; TGroupMember ** ppMember = pGroup->m_arraypaMembers.PrgpGetMembersStop(OUT &ppMemberStop); while (ppMember != ppMemberStop) { TGroupMember * pMember = *ppMember++; Assert(pMember != NULL); Assert(pMember->EGetRuntimeClass() == RTI(TGroupMember)); binXcpStanza.BinXmlAppendXcpApiCall_SendEventToContact(pMember->m_pContact, paEvent, paEventUpdater); } // while } // if...else m_pParent->m_tsEventIdLastSentCached = paEvent->m_tsEventID; } // EventAddAndDispatchToContacts()
void TAccountXmpp::TreeItemAccount_DisplayWithinNavigationTree() { Endorse(g_pTreeItemInbox == NULL); // Display the account at the root of the Navigation Tree TreeItemW_DisplayWithinNavigationTree(g_pTreeItemInbox); TContact ** ppContactStop; TContact ** ppContact = m_arraypaContacts.PrgpGetContactsStop(OUT &ppContactStop); while (ppContact != ppContactStop) { TContact * pContact = *ppContact++; Assert(pContact != NULL); Assert(pContact->EGetRuntimeClass() == RTI(TContact)); Assert(pContact->m_pAccount == this); pContact->TreeItemContact_DisplayWithinNavigationTree(); } // while #ifdef WANT_TREE_NODE_NEW_CONTACT m_pTreeItemContactNew = new TContactNew(this); #endif TGroup ** ppGroupStop; TGroup ** ppGroup = m_arraypaGroups.PrgpGetGroupsStop(OUT &ppGroupStop); while (ppGroup != ppGroupStop) { TGroup * pGroup = *ppGroup++; Assert(pGroup != NULL); Assert(pGroup->EGetRuntimeClass() == RTI(TGroup)); Assert(pGroup->m_pAccount == this); if (pGroup->TreeItemGroup_FCanDisplayWithinNavigationTree()) pGroup->TreeItemGroup_DisplayWithinNavigationTree(); } TreeItemW_ExpandAccordingToSavedState(); TreeItemAccount_UpdateIcon(); #if FIX_THIS // Display the alias as well m_paAlias->TreeItem_DisplayWithinNavigationTree(m_pProfileParent, m_strJID, eMenuIconXmpp); #endif } // TreeItemAccount_DisplayWithinNavigationTree()