From 7518561eddbe1349e145654e906321ce9808832b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 15 Aug 2022 18:39:49 +0300 Subject: minor addition to the previous commit --- protocols/JabberG/src/jabber_chat.cpp | 4 ++++ protocols/JabberG/src/jabber_proto.h | 2 +- protocols/JabberG/src/jabber_vcard.cpp | 10 ++++------ 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 34f062c80f..bd74e32719 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1203,6 +1203,10 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK *g TiXmlElement *v = iq << XCHILDNS("vCard", JABBER_FEAT_VCARD_TEMP); ppro->AppendPhotoToVcard(v, true, wszAvaPath.GetBuffer(), gch->si->hContact); ppro->m_ThreadInfo->send(iq); + + wchar_t szAvatarName[MAX_PATH]; + ppro->GetAvatarFileName(gch->si->hContact, szAvatarName, _countof(szAvatarName)); + CallService(MS_AV_SETAVATARW, gch->si->hContact, (LPARAM)szAvatarName); } break; diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index ba0fc9cce5..2e5272c4e8 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -889,7 +889,7 @@ struct CJabberProto : public PROTO, public IJabberInterface int SendGetVcard(MCONTACT hContact); void AppendVcardFromDB(TiXmlElement *n, char* tag, char* key); - void AppendPhotoToVcard(TiXmlElement *n, bool bPhotoChanged, wchar_t *szPhotoFileName, MCONTACT hContact = 0); + void AppendPhotoToVcard(TiXmlElement *n, bool bPhotoChanged, const wchar_t *szPhotoFileName, MCONTACT hContact = 0); void SetServerVcard(bool bPhotoChanged, wchar_t* szPhotoFileName); void SaveVcardToDB(HWND hwndPage, int iPage); diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 5465e05c26..97de0efe7a 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -980,14 +980,12 @@ void CJabberProto::SetServerVcard(bool bPhotoChanged, wchar_t *szPhotoFileName) m_ThreadInfo->send(iq); } -void CJabberProto::AppendPhotoToVcard(TiXmlElement *v, bool bPhotoChanged, wchar_t *szPhotoFileName, MCONTACT hContact) +void CJabberProto::AppendPhotoToVcard(TiXmlElement *v, bool bPhotoChanged, const wchar_t *szPhotoFileName, MCONTACT hContact) { - wchar_t szAvatarName[MAX_PATH], *szFileName; + wchar_t szAvatarName[MAX_PATH]; GetAvatarFileName(hContact, szAvatarName, _countof(szAvatarName)); - if (bPhotoChanged) - szFileName = szPhotoFileName; - else - szFileName = szAvatarName; + + const wchar_t *szFileName = (bPhotoChanged) ? szPhotoFileName : szAvatarName; // Set photo element, also update the global jabberVcardPhotoFileName to reflect the update debugLogW(L"Before update, file name = %s", szFileName); -- cgit v1.2.3