summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/avatars.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-02-22 19:49:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-02-22 19:49:37 +0300
commitc7b17549ed7029682d9012d3d53d3e34523f699f (patch)
tree1e53327716515c39d928927f49532c7a7b3ee2f6 /protocols/Discord/src/avatars.cpp
parent8f0458f54c32f68512573abb775384d4be114a08 (diff)
Discord:
- support for channel creation & destruction on the fly - code cleaning
Diffstat (limited to 'protocols/Discord/src/avatars.cpp')
-rw-r--r--protocols/Discord/src/avatars.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/protocols/Discord/src/avatars.cpp b/protocols/Discord/src/avatars.cpp
index 30ee008dc0..d938b95727 100644
--- a/protocols/Discord/src/avatars.cpp
+++ b/protocols/Discord/src/avatars.cpp
@@ -88,7 +88,7 @@ LBL_Error:
mir_wstrncpy(ai.filename, GetAvatarFilename(ai.hContact), _countof(ai.filename));
FILE *out = _wfopen(ai.filename, L"wb");
- if (out == NULL) {
+ if (out == nullptr) {
debugLogA("cannot open avatar file %S for writing", ai.filename);
goto LBL_Error;
}
@@ -106,7 +106,7 @@ bool CDiscordProto::RetrieveAvatar(MCONTACT hContact)
{
ptrA szAvatarHash(getStringA(hContact, DB_KEY_AVHASH));
SnowFlake id = getId(hContact, DB_KEY_ID);
- if (id == 0 || szAvatarHash == NULL)
+ if (id == 0 || szAvatarHash == nullptr)
return false;
CMStringA szUrl(FORMAT, "https://cdn.discordapp.com/avatars/%lld/%s.jpg", id, szAvatarHash);
@@ -165,10 +165,10 @@ INT_PTR CDiscordProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
INT_PTR CDiscordProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
- CMStringW wszFileName(GetAvatarFilename(NULL));
+ CMStringW wszFileName(GetAvatarFilename(0));
const wchar_t *pwszFilename = (const wchar_t*)lParam;
- if (pwszFilename == NULL) { // remove my avatar file
+ if (pwszFilename == nullptr) { // remove my avatar file
delSetting(DB_KEY_AVHASH);
DeleteFile(wszFileName);
}
@@ -176,13 +176,13 @@ INT_PTR CDiscordProto::SetMyAvatar(WPARAM, LPARAM lParam)
CMStringA szPayload("data:");
const wchar_t *wszMimeType = ProtoGetAvatarMimeType(ProtoGetAvatarFileFormat(pwszFilename));
- if (wszMimeType == NULL) {
+ if (wszMimeType == nullptr) {
debugLogA("invalid file format for avatar %S", pwszFilename);
return 1;
}
szPayload.AppendFormat("%S;base64,", wszMimeType);
FILE *in = _wfopen(pwszFilename, L"rb");
- if (in == NULL) {
+ if (in == nullptr) {
debugLogA("cannot open avatar file %S for reading", pwszFilename);
return 2;
}
@@ -194,7 +194,7 @@ INT_PTR CDiscordProto::SetMyAvatar(WPARAM, LPARAM lParam)
szPayload.Append(ptrA(mir_base64_encode((BYTE*)szFileContents.get(), iFileLength)));
JSONNode root; root << CHAR_PARAM("avatar", szPayload);
- Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me", NULL, &root));
+ Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me", nullptr, &root));
return 0;
}