From 976d66eafcc8f1005b74e30ef43b13eedcb473ab Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Dec 2012 14:40:55 +0000 Subject: we don't remove jabber avatars when it's not needed git-svn-id: http://svn.miranda-ng.org/main/trunk@2722 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_iqid.cpp | 10 +++---- protocols/JabberG/src/jabber_list.cpp | 26 ++++++++++--------- protocols/JabberG/src/jabber_userinfo.cpp | 43 +++++++++++++++---------------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 9e61999c4c..664167b73f 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -708,16 +708,12 @@ LBL_Ret: } if (item != NULL) { hasPhoto = TRUE; - if (item->photoFileName) + if (item->photoFileName && _tcscmp(item->photoFileName, szAvatarFileName)) DeleteFile(item->photoFileName); replaceStrT(item->photoFileName, szAvatarFileName); Log("Contact's picture saved to " TCHAR_STR_PARAM, szAvatarFileName); - - if (JGetWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) { - char szHashValue[ MAX_PATH ]; - if (JGetStaticString("AvatarHash", hContact, szHashValue, sizeof(szHashValue))) - OnIqResultGotAvatar(hContact, o, xmlGetText(m)); - } } + OnIqResultGotAvatar(hContact, o, xmlGetText(m)); + } db_free(&dbv); } } diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index 29cc4ce200..28608e5121 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -49,27 +49,29 @@ static void JabberListFreeItemInternal(JABBER_LIST_ITEM *item) if (item == NULL) return; - if (item->jid) mir_free(item->jid); - if (item->nick) mir_free(item->nick); - JABBER_RESOURCE_STATUS* r = item->resource; for (int i=0; i < item->resourceCount; i++, r++) JabberListFreeResourceInternal(r); - if (item->resource) mir_free(item->resource); JabberListFreeResourceInternal(&item->itemResource); - if (item->group) mir_free(item->group); if (item->photoFileName) { - DeleteFile(item->photoFileName); + if (item->list == LIST_VCARD_TEMP) + DeleteFile(item->photoFileName); mir_free(item->photoFileName); } - if (item->messageEventIdStr) mir_free(item->messageEventIdStr); - if (item->name) mir_free(item->name); - if (item->type) mir_free(item->type); - if (item->service) mir_free(item->service); - if (item->password) mir_free(item->password); - if (item->list==LIST_ROSTER && item->ft) delete item->ft; + + mir_free(item->jid); + mir_free(item->nick); + mir_free(item->resource); + mir_free(item->group); + mir_free(item->messageEventIdStr); + mir_free(item->name); + mir_free(item->type); + mir_free(item->service); + mir_free(item->password); + if (item->list == LIST_ROSTER && item->ft) + delete item->ft; mir_free(item); } diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 681dfbbd3a..0cad014101 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -845,31 +845,30 @@ int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if ( !CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName)) return 0; - OPTIONSDIALOGPAGE odp = {0}; - odp.cbSize = sizeof(odp); - odp.hInstance = hInst; - odp.dwInitParam = (LPARAM)this; - HANDLE hContact = (HANDLE)lParam; - if (hContact) { - char *szProto = GetContactProto(hContact); - if (szProto != NULL && !strcmp(szProto, m_szModuleName)) { - odp.pfnDlgProc = JabberUserInfoDlgProc; - odp.position = -2000000000; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_JABBER); - odp.pszTitle = LPGEN("Account"); - UserInfo_AddPage(wParam, &odp); - - odp.pfnDlgProc = JabberUserPhotoDlgProc; - odp.position = 2000000000; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PHOTO); - odp.pszTitle = LPGEN("Photo"); - UserInfo_AddPage(wParam, &odp); - } - } - else { + if (hContact == NULL) { // Show our vcard OnUserInfoInit_VCard(wParam, lParam); + return 0; + } + + char *szProto = GetContactProto(hContact); + if (szProto != NULL && !strcmp(szProto, m_szModuleName)) { + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.hInstance = hInst; + odp.dwInitParam = (LPARAM)this; + + odp.pfnDlgProc = JabberUserInfoDlgProc; + odp.position = -2000000000; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_JABBER); + odp.pszTitle = LPGEN("Account"); + UserInfo_AddPage(wParam, &odp); + + odp.pfnDlgProc = JabberUserPhotoDlgProc; + odp.position = 2000000000; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PHOTO); + odp.pszTitle = LPGEN("Photo"); + UserInfo_AddPage(wParam, &odp); } return 0; -- cgit v1.2.3