diff options
author | George Hazan <george.hazan@gmail.com> | 2024-02-28 12:55:16 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-02-28 12:55:16 +0300 |
commit | fd9794e8d383f54ad624cd907e7d8a902e510951 (patch) | |
tree | a3759bc3dc69ce9969f66080aa73571dbd2a9c18 /plugins/AVS/src | |
parent | 54a1360c3485733d554e56d312221f3ad1423226 (diff) |
AVS: rudimentary support for ANSI avatar path removed
Diffstat (limited to 'plugins/AVS/src')
-rw-r--r-- | plugins/AVS/src/image_utils.cpp | 12 | ||||
-rw-r--r-- | plugins/AVS/src/image_utils.h | 2 | ||||
-rw-r--r-- | plugins/AVS/src/services.cpp | 16 | ||||
-rw-r--r-- | plugins/AVS/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/AVS/src/utils.cpp | 4 |
5 files changed, 12 insertions, 26 deletions
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 3408e5296a..26d8b85d13 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -540,15 +540,3 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) free(p);
return TRUE;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Other utils
-
-int SaveAvatar(const char *protocol, const wchar_t *tszFileName)
-{
- INT_PTR result = CallProtoService(protocol, PS_SETMYAVATAR, 0, (LPARAM)tszFileName);
- if (result == CALLSERVICE_NOTFOUND)
- result = CallProtoService(protocol, PS_SETMYAVATAR, 0, _T2A(tszFileName));
-
- return result;
-}
diff --git a/plugins/AVS/src/image_utils.h b/plugins/AVS/src/image_utils.h index 5070ce8854..b81b400dd0 100644 --- a/plugins/AVS/src/image_utils.h +++ b/plugins/AVS/src/image_utils.h @@ -10,6 +10,4 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap); HBITMAP MakeGrayscale(HBITMAP hBitmap);
uint32_t GetImgHash(HBITMAP hBitmap);
-int SaveAvatar(const char* protocol, const wchar_t* tszFileName);
-
#endif // __IMAGE_UTILS_H__
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 0816bc7742..11636abe8d 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -196,7 +196,7 @@ static int InternalRemoveMyAvatar(char *protocol) int ret = 0;
if (protocol != nullptr) {
if (ProtoServiceExists(protocol, PS_SETMYAVATAR))
- ret = SaveAvatar(protocol, nullptr);
+ ret = CallProtoService(protocol, PS_SETMYAVATAR);
else
ret = -3;
@@ -219,7 +219,7 @@ static int InternalRemoveMyAvatar(char *protocol) continue;
// Found a protocol
- int retTmp = SaveAvatar(it->szModuleName, nullptr);
+ int retTmp = CallProtoService(it->szModuleName, PS_SETMYAVATAR);
if (retTmp != 0)
ret = retTmp;
}
@@ -354,7 +354,7 @@ void SaveImage(SaveProtocolData &d, char *protocol, int format) else d.saved = TRUE;
}
-static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilename, int originalFormat, BOOL square, BOOL grow)
+static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, const wchar_t *originalFilename, int originalFormat, BOOL square, BOOL grow)
{
if (!ProtoServiceExists(protocol, PS_SETMYAVATAR))
return -1;
@@ -365,14 +365,14 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen if (!Proto_IsAvatarFormatSupported(protocol, PA_FORMAT_SWF))
return -1;
- return SaveAvatar(protocol, originalFilename);
+ return CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)originalFilename);
}
if (originalFormat == PA_FORMAT_XML) {
if (!Proto_IsAvatarFormatSupported(protocol, PA_FORMAT_XML))
return -1;
- return SaveAvatar(protocol, originalFilename);
+ return CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)originalFilename);
}
// Get protocol info
@@ -408,7 +408,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen DeleteFile(d.temp_file);
// Use original image
- return SaveAvatar(protocol, originalFilename);
+ return CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)originalFilename);
}
// Create a temporary file (if was not created already)
@@ -455,8 +455,8 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, wchar_t *originalFilen if (d.saved) {
// Call proto service
- ret = SaveAvatar(protocol, d.image_file_name);
- DeleteFile(d.image_file_name);
+ ret = CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)d.image_file_name);
+ DeleteFileW(d.image_file_name);
}
else ret = -1;
diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index 71d9b439f4..c0370b4d97 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -142,8 +142,8 @@ extern HANDLE hGlobalAvatarFolder; extern HANDLE hLoaderEvent, hLoaderThread, hShutdownEvent;
extern HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged;
-int GetFileHash(wchar_t* filename);
-uint32_t GetFileSize(wchar_t *szFilename);
+int GetFileHash(const wchar_t* filename);
+uint32_t GetFileSize(const wchar_t *szFilename);
void MakePathRelative(MCONTACT hContact);
void MakePathRelative(MCONTACT hContact, wchar_t *dest);
void MyPathToAbsolute(const wchar_t *ptszPath, wchar_t *ptszDest);
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index e0f41f075a..9daf048db9 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -230,7 +230,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz #define TOPBIT (1 << (WIDTH - 1)) /* MSB */
#define WIDTH 32
-int GetFileHash(wchar_t *filename)
+int GetFileHash(const wchar_t *filename)
{
HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
@@ -458,7 +458,7 @@ void SetIgnoreNotify(char *protocol, BOOL ignore) ///////////////////////////////////////////////////////////////////////////////////////////////////////
-uint32_t GetFileSize(wchar_t *szFilename)
+uint32_t GetFileSize(const wchar_t *szFilename)
{
struct _stat info;
return (_wstat(szFilename, &info) == -1) ? 0 : info.st_size;
|