From 500efd6f234f5cb0d84d2396bd0eab6f70a35e10 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 Mar 2013 18:47:40 +0000 Subject: finaly ieview should work with noavatar in formats png and jpg git-svn-id: http://svn.miranda-ng.org/main/trunk@4168 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/IEView/src/TemplateHTMLBuilder.cpp | 34 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'plugins/IEView/src') diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index f7ffa2f1bd..522a104221 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -201,13 +201,18 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr szNameOut = mir_strdup(" "); szNameIn = mir_strdup(" "); } - sprintf(tempStr, "%snoavatar.png", tempBase); - szNoAvatar = mir_utf8encode(tempStr); - if (access(szNoAvatar, 0) == -1) - { + mir_snprintf(tempStr, SIZEOF(tempStr), "%snoavatar.png", tempBase); + TCHAR szNoAvatarPath[MAX_PATH]; + mir_sntprintf(szNoAvatarPath, SIZEOF(szNoAvatarPath), _T("%s"), _A2T(protoSettings->getSRMMTemplateFilename())); + TCHAR *szNoAvatarPathTmp = _tcsrchr(szNoAvatarPath, '\\'); + if (szNoAvatarPathTmp != NULL) + *szNoAvatarPathTmp = 0; + _tcscat(szNoAvatarPath, _T("\\noavatar.png")); + if (_taccess(szNoAvatarPath, 0) == -1) sprintf(tempStr, "%snoavatar.jpg", tempBase); - szNoAvatar = mir_utf8encode(tempStr); - } + else + sprintf(tempStr, "%snoavatar.png", tempBase); + szNoAvatar = mir_utf8encode(tempStr); szAvatarIn = getAvatar(event->hContact, szRealProto); if (szAvatarIn == NULL) { szAvatarIn = mir_strdup(szNoAvatar); @@ -377,14 +382,17 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, szNameOut = mir_strdup(" "); szNameIn = mir_strdup(" "); } - sprintf(tempStr, "%snoavatar.png", tempBase); - szNoAvatar = mir_utf8encode(tempStr); - if (access(szNoAvatar, 0) == -1) - { + TCHAR szNoAvatarPath[MAX_PATH]; + mir_sntprintf(szNoAvatarPath, SIZEOF(szNoAvatarPath), _T("%s"), _A2T(protoSettings->getSRMMTemplateFilename())); + TCHAR *szNoAvatarPathTmp = _tcsrchr(szNoAvatarPath, '\\'); + if (szNoAvatarPathTmp != NULL) + *szNoAvatarPathTmp = 0; + _tcscat(szNoAvatarPath, _T("\\noavatar.png")); + if (_taccess(szNoAvatarPath, 0) == -1) sprintf(tempStr, "%snoavatar.jpg", tempBase); - szNoAvatar = mir_utf8encode(tempStr); - } - + else + sprintf(tempStr, "%snoavatar.png", tempBase); + szNoAvatar = mir_utf8encode(tempStr); if(event->hContact != NULL) { szAvatarIn = getAvatar(event->hContact, szRealProto); } -- cgit v1.2.3