diff options
author | Szymon Tokarz <wsx22@o2.pl> | 2012-12-31 13:22:28 +0000 |
---|---|---|
committer | Szymon Tokarz <wsx22@o2.pl> | 2012-12-31 13:22:28 +0000 |
commit | fd19769f410fe114451ea1329f676ed28c555b2f (patch) | |
tree | 5b521f080dcb3b7e785c9c14edce80249dfc51d0 /protocols/Gadu-Gadu/src/avatar.cpp | |
parent | 6410348ada83ca5fea19f706506ae4afaf8f4a89 (diff) |
Gadu-Gadu protocol:
- show error popup when file io function returns an error code
hope to explain avatar problems
git-svn-id: http://svn.miranda-ng.org/main/trunk@2895 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/avatar.cpp')
-rw-r--r-- | protocols/Gadu-Gadu/src/avatar.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index a8c2b6efa7..b66c8c9407 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -39,8 +39,17 @@ void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen) tPathLen = (int)_tcslen(pszDest);
}
- if (_taccess(pszDest, 0))
- CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest);
+ if (_taccess(pszDest, 0)) {
+ int ret = CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest);
+ if (ret == 0){
+ netlog("getAvatarFilename(): Created new directory for avatar cache: %S.", pszDest);
+ } else {
+ netlog("getAvatarFilename(): Can not create directory for avatar cache: %S. errno=%d: %s", pszDest, errno, strerror(errno));
+ TCHAR error[512];
+ mir_sntprintf(error, SIZEOF(error), TranslateT("Can not create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pszDest);
+ showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
+ }
+ }
switch (db_get_b(hContact, m_szModuleName, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE)) {
case PA_FORMAT_JPEG: avatartype = _T("jpg"); break;
@@ -264,6 +273,11 @@ void __cdecl GGPROTO::avatarrequestthread(void*) _write(file_fd, resp->pData, resp->dataLength);
_close(file_fd);
result = 1;
+ } else {
+ netlog("avatarrequestthread(): _topen file %S error. errno=%d: %s", pai.filename, errno, strerror(errno));
+ TCHAR error[512];
+ mir_sntprintf(error, SIZEOF(error), TranslateT("Can not create avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai.filename);
+ showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
}
else netlog("avatarrequestthread(): Invalid response code from HTTP request");
@@ -383,7 +397,10 @@ void __cdecl GGPROTO::setavatarthread(void *param) file_fd = _topen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD);
if (file_fd == -1) {
- netlog("setavatarthread(): Failed to open avatar file (%s).", strerror(errno));
+ netlog("setavatarthread(): Failed to open avatar file errno=%d: %s.", errno, strerror(errno));
+ TCHAR error[512];
+ mir_sntprintf(error, SIZEOF(error), TranslateT("Can not open avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFilename);
+ showpopup(m_tszUserName, error, GG_POPUP_ERROR);
mir_free(szFilename);
int prevType = db_get_b(NULL, m_szModuleName, GG_KEY_AVATARTYPEPREV, -1);
if (prevType != -1)
|