diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-01 22:15:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-01 22:15:26 +0000 |
commit | 612fc2f36903f0168f88622f61e1a0de4dae5b92 (patch) | |
tree | 7ba72966a7ed48a480b01e4b964d85fecdcbb725 /protocols | |
parent | acd4daf132c8ff3b05df7615e95f60be2fb82ddb (diff) |
- atavism named MS_UTILS_LOADBITMAP removed;
- bmpfilter.cpp also removed;
- Bitmap_Load() function added instead;
- various bitmap related crap fixed;
git-svn-id: http://svn.miranda-ng.org/main/trunk@13966 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/IcqOscarJ/src/icqosc_svcs.cpp | 63 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_userinfo.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_vcard.cpp | 10 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_picture.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/avatars.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 2 |
6 files changed, 39 insertions, 42 deletions
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index b7d887bad7..6d4b130956 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -482,59 +482,58 @@ INT_PTR CIcqProto::SendYouWereAdded(WPARAM, LPARAM lParam) INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
- TCHAR* tszFile = (TCHAR*)lParam;
- int iRet = -1;
-
- if (!m_bAvatarsEnabled || !m_bSsiEnabled) return -2;
+ if (!m_bAvatarsEnabled || !m_bSsiEnabled)
+ return -2;
+ TCHAR *tszFile = (TCHAR*)lParam;
if (tszFile) { // set file for avatar
int dwPaFormat = ::ProtoGetAvatarFileFormat(tszFile);
if (dwPaFormat != PA_FORMAT_XML) {
// if it should be image, check if it is valid
- HBITMAP avt = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (WPARAM)tszFile);
- if (!avt) return iRet;
+ HBITMAP avt = Bitmap_Load(tszFile);
+ if (!avt)
+ return -1;
+
DeleteObject(avt);
}
TCHAR tszMyFile[MAX_PATH + 1];
GetFullAvatarFileName(0, NULL, dwPaFormat, tszMyFile, MAX_PATH);
+
// if not in our storage, copy
if (mir_tstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE)) {
debugLogA("Failed to copy our avatar to local storage.");
- return iRet;
+ return -1;
}
BYTE *hash = calcMD5HashOfFile(tszMyFile);
- if (hash) {
- BYTE ihash[0x14];
- // upload hash to server
- ihash[0] = 0; //unknown
- ihash[1] = dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC; //hash type
- ihash[2] = 1; //hash status
- ihash[3] = 0x10; //hash len
- memcpy((ihash + 4), hash, 0x10);
- updateServAvatarHash(ihash, 0x14);
-
- if (setSettingBlob(NULL, "AvatarHash", ihash, 0x14))
- debugLogA("Failed to save avatar hash.");
-
- TCHAR tmp[MAX_PATH];
- PathToRelativeT(tszMyFile, tmp);
- setTString(NULL, "AvatarFile", tmp);
-
- iRet = 0;
-
- SAFE_FREE((void**)&hash);
- }
+ if (hash == NULL)
+ return -1;
+
+ BYTE ihash[0x14];
+ // upload hash to server
+ ihash[0] = 0; //unknown
+ ihash[1] = dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC; //hash type
+ ihash[2] = 1; //hash status
+ ihash[3] = 0x10; //hash len
+ memcpy((ihash + 4), hash, 0x10);
+ updateServAvatarHash(ihash, 0x14);
+
+ if (setSettingBlob(NULL, "AvatarHash", ihash, 0x14))
+ debugLogA("Failed to save avatar hash.");
+
+ TCHAR tmp[MAX_PATH];
+ PathToRelativeT(tszMyFile, tmp);
+ setTString(NULL, "AvatarFile", tmp);
+ SAFE_FREE((void**)&hash);
}
- else { // delete user avatar
+ else {
+ // delete user avatar
delSetting("AvatarFile");
setSettingBlob(NULL, "AvatarHash", hashEmptyAvatar, 9);
updateServAvatarHash(hashEmptyAvatar, 9); // set blank avatar
- iRet = 0;
}
-
- return iRet;
+ return 0;
}
INT_PTR CIcqProto::SetNickName(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 3b5af188c2..d3958b3436 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -651,7 +651,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP if (item != NULL) { if (item->photoFileName) { photoInfo->ppro->debugLog(_T("Showing picture from %s"), item->photoFileName); - photoInfo->hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)item->photoFileName); + photoInfo->hBitmap = Bitmap_Load(item->photoFileName); FIP->FI_Premultiply(photoInfo->hBitmap); ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_SHOW); } diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 8350193384..c4860f67ad 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -295,7 +295,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
dat->ppro->debugLog(_T("Temp file = %s"), szTempFileName);
if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) {
- if ((dat->hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)szTempFileName)) != NULL) {
+ if ((dat->hBitmap = Bitmap_Load(szTempFileName)) != NULL) {
FIP->FI_Premultiply(dat->hBitmap);
mir_tstrcpy(dat->ppro->m_szPhotoFileName, szTempFileName);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
@@ -334,7 +334,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_LOAD:
TCHAR szFilter[512], szFileName[MAX_PATH];
- BmpFilterGetStrings(szFilter, SIZEOF(szFilter));
+ Bitmap_GetFilter(szFilter, SIZEOF(szFilter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -356,11 +356,11 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
+
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
dat->ppro->debugLog(_T("Temp file = %s"), szTempFileName);
if (CopyFile(szFileName, szTempFileName, FALSE) == TRUE) {
- char* pszTemp = mir_t2a(szTempFileName);
- if ((hNewBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)pszTemp)) != NULL) {
+ if ((hNewBitmap = Bitmap_Load(szTempFileName)) != NULL) {
if (dat->hBitmap) {
DeleteObject(dat->hBitmap);
DeleteFile(dat->ppro->m_szPhotoFileName);
@@ -376,8 +376,6 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
else DeleteFile(szTempFileName);
-
- mir_free(pszTemp);
}
else DeleteFile(szTempFileName);
}
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index adfd6ea1ca..ea3fb7e2bb 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -260,7 +260,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) { char *jid = dbv.pszVal;
TCHAR tszFilter[512], tszFileName[MAX_PATH];
- BmpFilterGetStrings(tszFilter, SIZEOF(tszFilter));
+ Bitmap_GetFilter(tszFilter, SIZEOF(tszFilter));
tszFileName[0] = '\0';
OPENFILENAME ofn = {0};
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 35feb6d1ad..22266ae931 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -90,7 +90,7 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const return errno;
ResizeBitmap resize = { 0 };
- if ((resize.hBmp = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)ptszFileName)) == NULL)
+ if ((resize.hBmp = Bitmap_Load(ptszFileName)) == NULL)
return 2;
resize.size = sizeof(resize);
resize.fit = RESIZEBITMAP_KEEP_PROPORTIONS;
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 1910128775..9a80485c3f 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -166,7 +166,7 @@ void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo) void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo)
{
TCHAR tszFileName[MAX_PATH], filter[256];
- BmpFilterGetStrings(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, SIZEOF(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
|