Exemplo n.º 1
0
TContact *
TAccountXmpp::TreeItemAccount_PContactAllocateNewToNavigationTree_NZ(PSZUC pszContactJID, PSZUC pszContactNameDisplay)
	{
	Assert(pszContactJID != NULL);
	Endorse(pszContactNameDisplay == NULL);	// Automatically generate a display name
	Assert(Contact_PFindByJID(pszContactJID, eFindContact_zDefault) == NULL && "The JID is already present!");
	Assert(!m_strJID.FCompareStringsJIDs(pszContactJID) && "The contact JID is the same as the JID of the XMPP account!");
	Assert(m_paTreeItemW_YZ != NULL && "No Tree Item to attach to");	// This line of code has to be revised
	TContact * pContact = new TContact(this);
	pContact->m_strRessource = pContact->m_strJidBare.AppendTextUntilCharacterPszr(pszContactJID, '/');
	pContact->m_strNameDisplayTyped = pszContactNameDisplay;
	pContact->TreeItemContact_GenerateDisplayNameFromJid();
	m_arraypaContacts.Add(PA_CHILD pContact);
	#ifdef WANT_TREE_NODE_NEW_CONTACT
	pContact->TreeItemW_DisplayWithinNavigationTreeBefore(m_pTreeItemContactNew);
	#else
	pContact->TreeItemW_DisplayWithinNavigationTree(this);
	#endif
	pContact->TreeItemContact_UpdateIcon();
	pContact->TreeItemW_EnsureVisible();	// Make sure the new contact is visible in the Navigation Tree
	pContact->m_tsCreated = Timestamp_GetCurrentDateTime();
	if (m_paSocket != NULL)
		Contact_RosterSubscribe(pContact);
	Configuration_Save();		// Save the configuration after adding a new contact (just in case the application crashes)
	TWallet::S_ContactAdded(pContact);	// Notify the wallet(s) there is a new contact
	return pContact;
	}
Exemplo n.º 2
0
void
TAccountXmpp::TreeItemAccount_UpdateIconOfAllContacts()
	{
	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_UpdateIcon();
		}
	}