ITreeItem::~ITreeItem() { NoticeListAuxiliary_DeleteAllNoticesRelatedToTreeItem(IN this); NoticeListRoaming_TreeItemDeleting(IN this); // Assert(m_paTreeItemW_YZ == NULL); // Use TreeItemW_RemoveFromNavigationTree() instead. delete m_paTreeItemW_YZ; // This will remove the widget from the Navigation Tree. Of course, this is not the most elegant mechanism, but it is the safest to avoid bugs }
// Display the stanza message to the GUI void TContact::ChatLogContact_DisplayStanzaToUI(const CXmlNode * pXmlNodeMessageStanza) { Assert(pXmlNodeMessageStanza != NULL); Assert(m_pAccount != NULL); Endorse(m_paTreeItemW_YZ == NULL); m_tsmLastStanzaReceived = g_tsmMinutesSinceApplicationStarted; #if 0 if (m_uFlagsContact & (FC_kfContactNeedsInvitation | FC_kfCommentContainsInvitation | FC_kfContactUnsolicited)) { // If we receive a stanza from a contact, it means there is no need to to send an invitation because the stanza response is the proof the contact was established if (m_uFlagsContact & FC_kfContactNeedsInvitation) { m_uFlagsContact &= ~FC_kfContactNeedsInvitation; NoticeListAuxiliary_DeleteAllNoticesRelatedToTreeItem(this); } if (m_uFlagsContact & (FC_kfCommentContainsInvitation | FC_kfContactUnsolicited)) { // Compare if the message is the handshake of the invitation PSZUC pszMessageBody = pXmlNodeMessageStanza->PszuFindElementValue_NZ(c_sza_body); // The body may contain the invitation message if (m_uFlagsContact & FC_kfCommentContainsInvitation) { if (m_strComment.FCompareStringsExactCase(pszMessageBody)) { m_strComment.Empty(); // Remove the invitation m_uFlagsContact &= ~FC_kfCommentContainsInvitation; TreeItemContact_UpdateIcon(); return; // Don't display the message because it is the invitation encoded in Base64 } } if (m_uFlagsContact & FC_kfContactUnsolicited) { // We have an 'unsolicited' contact, however this may be to an incomplete handshake /* TContact * pContactInvitation = m_pAccount->PFindContactByComment(pszMessageBody); if (pContactInvitation != NULL && pContactInvitation != this) { m_uFlagsContact &= ~(FC_kfContactUnsolicited | FC_kfCommentContainsInvitation); BOOL fSelectContact = (NavigationTree_PGetSelectedTreeItem() == pContactInvitation); m_pAccount->Contact_DeleteSafely(PA_DELETING pContactInvitation); TreeItemContact_UpdateIcon(); if (fSelectContact) TreeItem_SelectWithinNavigationTree(); return; } */ } // if } } // if #endif PSZUC pszuMessageBody = ChatLog_PwGetLayout_NZ()->ChatLog_DisplayStanzaToUser(pXmlNodeMessageStanza); TreeItemChatLog_IconUpdateOnNewMessageArrivedFromContact(pszuMessageBody, this); } // ChatLogContact_DisplayStanzaToUI()
void TContact::XmppPresenceUpdateIcon(const CXmlNode * pXmlNodeStanzaPresence) { if (FCompareStrings(pXmlNodeStanzaPresence->PszFindAttributeValueType_NZ(), "unavailable")) { TreeItemContact_UpdateIconOffline(); return; } UINT uFlagsPresence = FC_kePresenceChat; // If there is no presence value, assume online PSZUC pszPresence = pXmlNodeStanzaPresence->PszuFindElementValue_ZZ("show"); if (pszPresence != NULL && !FCompareStrings(pszPresence, "chat")) { if (FCompareStrings(pszPresence, "away")) uFlagsPresence = FC_kePresenceAway; else if (FCompareStrings(pszPresence, "xa")) uFlagsPresence = FC_kePresenceAwayExtended; else if (FCompareStrings(pszPresence, "dnd")) uFlagsPresence = FC_kePresenceBusy; // Do Not Disturb else MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Unrecognized presence value '$s'\n", pszPresence); } XmppRosterSubscribed(); if (m_uFlagsContact & FC_kfContactNeedsInvitation) { MessageLog_AppendTextFormatSev(eSeverityComment, "XmppPresenceUpdateIcon($S) - Invitation no longer needed because of presence $s\n", &m_strJidBare, pszPresence); ChatLogContact_RemoveInvitationMessage(); Assert((m_uFlagsContact & FC_kfContactNeedsInvitation) == 0); NoticeListAuxiliary_DeleteAllNoticesRelatedToTreeItem(this); } //m_uFlagsContact = (m_uFlagsContact & ~(FC_kmPresenceMask | FC_kfNoCambrianProtocol)) | uFlagsPresence; m_uFlagsContact = (m_uFlagsContact & ~(FC_kmPresenceMaskOnlineXosp)) | uFlagsPresence; // Check if the contact uses Cambrian const CXmlNode * pXmlNodeXCP = pXmlNodeStanzaPresence->PFindElement(c_sza_xcp); if (pXmlNodeXCP != NULL) { // The contact is supporting XOSP m_uFlagsContact = (m_uFlagsContact & ~FC_kfNativeXmppOnly) | FC_kfPresenceXosp; // Remember the XOSP is present, and remove the XMPP only flag if (m_uFlagsContact & FC_kfXospSynchronizeWhenPresenceOnline) { MessageLog_AppendTextFormatSev(eSeverityComment, "XmppPresenceUpdateIcon($S) - FC_kfXospSynchronizeWhenPresenceOnline\n", &m_strJidBare); XcpApi_Invoke_Synchronize(); } if (m_uFlagsContact & FC_kfContactRecommendationsNeverReceived) XcpApi_Invoke_RecommendationsGet(); //m_listaTasksSendReceive.SentTasksToContact(this); // Send any pending task } TreeItemContact_UpdateIcon(); } // XmppPresenceUpdateIcon()