diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-17 14:37:50 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-17 14:37:50 +0300 |
commit | 4c60037f6852f7771ed86e0b285a872e4bbadb87 (patch) | |
tree | a6977ea0a68db5612f3ac8664efd9d66a483e52c /protocols/Steam | |
parent | 893fe6d2f16f5e70087aa9d5949aff5aaff556d2 (diff) |
PROTO_INTERFACE::GetAvatarPath - new helper for calculating avatars' root for an account
Diffstat (limited to 'protocols/Steam')
-rw-r--r-- | protocols/Steam/src/steam_avatars.cpp | 12 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 9a72b6fec0..cee909ed30 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -2,17 +2,13 @@ wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
- wchar_t path[MAX_PATH];
- mir_snwprintf(path, L"%s\\%S", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
- CreateDirectoryTreeW(path);
-
ptrA steamId(getStringA(hContact, "SteamID"));
- if (steamId != NULL)
- mir_snwprintf(path, MAX_PATH, L"%s\\%S.jpg", path, steamId.get());
- else
+ if (steamId == NULL)
return nullptr;
- return mir_wstrdup(path);
+ CMStringW wszPath(GetAvatarPath());
+ wszPath.AppendFormat(L"\\%S.jpg", steamId.get());
+ return wszPath.Detach();
}
bool CSteamProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai)
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index f185171edd..8a2959f84a 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -49,6 +49,8 @@ CSteamProto::CSteamProto(const char *protoName, const wchar_t *userName) : SetAllContactStatuses(ID_STATUS_OFFLINE);
// avatar API
+ CreateDirectoryTreeW(GetAvatarPath());
+
CreateProtoService(PS_GETAVATARINFO, &CSteamProto::GetAvatarInfo);
CreateProtoService(PS_GETAVATARCAPS, &CSteamProto::GetAvatarCaps);
CreateProtoService(PS_GETMYAVATAR, &CSteamProto::GetMyAvatar);
|