summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/services.cpp
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2012-11-29 00:24:59 +0000
committerSzymon Tokarz <wsx22@o2.pl>2012-11-29 00:24:59 +0000
commitd38f5bfee7197b4094d189d95fe6ee004576dc1d (patch)
tree60d2b2b7e8e8186dc98932529be2e4fa3be2189e /protocols/Gadu-Gadu/src/services.cpp
parent30707c980d1560b358dbf2671a4d2a26a1e8173c (diff)
Gadu-Gadu protocol: account avatar work
- fixes setting custom avatar (when do it first time or change it to another type) - fixed restoring oryginal avatar when setting new has faild (it's complex mechanism and could need some more work, but i'm hope that this and last commits are enough for now) git-svn-id: http://svn.miranda-ng.org/main/trunk@2553 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/services.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index ce576aa214..5caf23f08c 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -290,10 +290,29 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam)
return -1;
}
+
+ TCHAR *szAvType = _tcsrchr(szFilename, '.');
+ int iAvType = -1;
+ szAvType++;
+ if (!_tcsicmp(szAvType, _T("jpg")))
+ iAvType = PA_FORMAT_JPEG;
+ else if (!_tcsicmp(szAvType, _T("gif")))
+ iAvType = PA_FORMAT_GIF;
+ else if (!_tcsicmp(szAvType, _T("png")))
+ iAvType = PA_FORMAT_PNG;
+
+ if ( iAvType == -1) {
+ netlog("setmyavatar(): Failed to set user avatar. File %S has incompatible extansion.", szAvType);
+ return -1;
+ }
+
+ db_set_b(NULL, m_szModuleName, GG_KEY_AVATARTYPEPREV, db_get_b(NULL, m_szModuleName, GG_KEY_AVATARTYPE, -1));
+ db_set_b(NULL, m_szModuleName, GG_KEY_AVATARTYPE, (BYTE)iAvType);
+
TCHAR szMyFilename[MAX_PATH];
getAvatarFilename(NULL, szMyFilename, SIZEOF(szMyFilename));
if ( _tcscmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
- netlog("setmyavatar(): Failed to set user avatar. File %s could not be created/overwritten.", szMyFilename);
+ netlog("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
}