summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/src/avatars.cpp14
-rw-r--r--protocols/Discord/src/connection.cpp26
-rw-r--r--protocols/Discord/src/dispatch.cpp50
-rw-r--r--protocols/Discord/src/gateway.cpp6
-rw-r--r--protocols/Discord/src/groupchat.cpp30
-rw-r--r--protocols/Discord/src/guilds.cpp4
-rw-r--r--protocols/Discord/src/http.cpp6
-rw-r--r--protocols/Discord/src/main.cpp2
-rw-r--r--protocols/Discord/src/menus.cpp8
-rw-r--r--protocols/Discord/src/options.cpp2
-rw-r--r--protocols/Discord/src/proto.cpp52
-rw-r--r--protocols/Discord/src/proto.h2
-rw-r--r--protocols/Discord/src/server.cpp24
-rw-r--r--protocols/Discord/src/utils.cpp18
14 files changed, 134 insertions, 110 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;
}
diff --git a/protocols/Discord/src/connection.cpp b/protocols/Discord/src/connection.cpp
index ec7c12dca3..ddb1a77e04 100644
--- a/protocols/Discord/src/connection.cpp
+++ b/protocols/Discord/src/connection.cpp
@@ -40,8 +40,8 @@ void CDiscordProto::ExecuteRequest(AsyncHttpRequest *pReq)
debugLogA("Executing request #%d:\n%s", pReq->m_iReqNum, pReq->szUrl);
NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(m_hNetlibUser, pReq);
- if (reply != NULL) {
- if (pReq->m_pCallback != NULL)
+ if (reply != nullptr) {
+ if (pReq->m_pCallback != nullptr)
(this->*(pReq->m_pCallback))(reply, pReq);
m_hAPIConnection = reply->nlc;
@@ -54,7 +54,7 @@ void CDiscordProto::ExecuteRequest(AsyncHttpRequest *pReq)
if (pReq->m_bMainSite) {
if (IsStatusConnecting(m_iStatus))
ConnectionFailed(LOGINERR_NONETWORK);
- m_hAPIConnection = NULL;
+ m_hAPIConnection = nullptr;
}
}
delete pReq;
@@ -69,7 +69,7 @@ void CDiscordProto::OnLoggedIn()
if (m_szGateway.IsEmpty())
Push(new AsyncHttpRequest(this, REQUEST_GET, "/gateway", &CDiscordProto::OnReceiveGateway));
else
- ForkThread(&CDiscordProto::GatewayThread, NULL);
+ ForkThread(&CDiscordProto::GatewayThread, nullptr);
}
void CDiscordProto::OnLoggedOut()
@@ -81,7 +81,7 @@ void CDiscordProto::OnLoggedOut()
KillTimer(g_hwndHeartbeat, (UINT_PTR)this);
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE);
+ ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
SetAllContactStatuses(ID_STATUS_OFFLINE);
@@ -110,29 +110,29 @@ void CDiscordProto::ConnectionFailed(int iReason)
debugLogA("CDiscordProto::ConnectionFailed -> reason %d", iReason);
delSetting("AccessToken");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, iReason);
+ ProtoBroadcastAck(0, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, iReason);
ShutdownSession();
}
void CDiscordProto::ServerThread(void*)
{
m_szAccessToken = getStringA("AccessToken");
- m_hAPIConnection = NULL;
+ m_hAPIConnection = nullptr;
m_bTerminated = false;
debugLogA("CDiscordProto::WorkerThread: %s", "entering");
- if (m_szAccessToken != NULL)
+ if (m_szAccessToken != nullptr)
// try to receive a response from server
- RetrieveUserInfo(NULL);
+ RetrieveUserInfo(0);
else {
- if (mir_wstrlen(m_wszEmail) == NULL) {
+ if (mir_wstrlen(m_wszEmail) == 0) {
ConnectionFailed(LOGINERR_BADUSERID);
return;
}
ptrW wszPassword(getWStringA(DB_KEY_PASSWORD));
- if (wszPassword == NULL) {
+ if (wszPassword == nullptr) {
ConnectionFailed(LOGINERR_WRONGPASSWORD);
return;
}
@@ -168,10 +168,10 @@ void CDiscordProto::ServerThread(void*)
}
}
- m_hWorkerThread = NULL;
+ m_hWorkerThread = nullptr;
if (m_hAPIConnection) {
Netlib_CloseHandle(m_hAPIConnection);
- m_hAPIConnection = NULL;
+ m_hAPIConnection = nullptr;
}
debugLogA("CDiscordProto::WorkerThread: %s", "leaving");
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 6a8992322b..69e3879c45 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -66,9 +66,9 @@ static int __cdecl pSearchFunc(const void *p1, const void *p2)
GatewayHandlerFunc CDiscordProto::GetHandler(const wchar_t *pwszCommand)
{
- CDiscordCommand tmp = { pwszCommand, NULL };
+ CDiscordCommand tmp = { pwszCommand, nullptr };
CDiscordCommand *p = (CDiscordCommand*)bsearch(&tmp, handlers, _countof(handlers), sizeof(handlers[0]), pSearchFunc);
- return (p != NULL) ? p->pFunc : NULL;
+ return (p != nullptr) ? p->pFunc : nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -102,23 +102,37 @@ void CDiscordProto::OnCommandChannelCreated(const JSONNode &pRoot)
void CDiscordProto::OnCommandChannelDeleted(const JSONNode &pRoot)
{
CDiscordUser *pUser = FindUserByChannel(::getId(pRoot["id"]));
- if (pUser != NULL) {
+ if (pUser == nullptr)
+ return;
+
+ SnowFlake guildId = ::getId(pRoot["guild_id"]);
+ if (guildId == 0) {
pUser->channelId = 0;
pUser->lastMsg = CDiscordMessage();
delSetting(pUser->hContact, DB_KEY_CHANNELID);
}
+ else {
+ CDiscordGuild *pGuild = FindGuild(guildId);
+ if (pGuild != nullptr)
+ Chat_Terminate(m_szModuleName, pUser->wszUsername, true);
+ }
}
void CDiscordProto::OnCommandChannelUpdated(const JSONNode &pRoot)
{
CDiscordUser *pUser = FindUserByChannel(::getId(pRoot["id"]));
- if (pUser == NULL)
+ if (pUser == nullptr)
return;
pUser->lastMsg = CDiscordMessage(::getId(pRoot["last_message_id"]));
- CMStringW wszTopic = pRoot["topic"].as_mstring();
- if (!wszTopic.IsEmpty()) {
+ SnowFlake guildId = ::getId(pRoot["guild_id"]);
+ if (guildId != 0) {
+ CDiscordGuild *pGuild = FindGuild(guildId);
+ if (pGuild == nullptr)
+ return;
+
+ CMStringW wszTopic = pRoot["topic"].as_mstring();
Chat_SetStatusbarText(m_szModuleName, pUser->wszUsername, wszTopic);
GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
@@ -143,7 +157,7 @@ void CDiscordProto::OnCommandFriendRemoved(const JSONNode &pRoot)
{
SnowFlake id = ::getId(pRoot["id"]);
CDiscordUser *pUser = FindUser(id);
- if (pUser != NULL) {
+ if (pUser != nullptr) {
if (pUser->hContact) {
if (pUser->bIsPrivate)
db_delete_contact(pUser->hContact);
@@ -271,7 +285,7 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot)
CMStringW wszUserId = pRoot["user"]["id"].as_mstring();
CDiscordGuildMember *gm = pGuild->FindUser(_wtoi64(wszUserId));
- if (gm == NULL)
+ if (gm == nullptr)
return;
gm->wszNick = pRoot["nick"].as_mstring();
@@ -355,7 +369,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot)
SnowFlake nonce = ::getId(pRoot["nonce"]);
SnowFlake *p = arOwnMessages.find(&nonce);
- if (p != NULL) { // own message? skip it
+ if (p != nullptr) { // own message? skip it
debugLogA("skipping own message with nonce=%lld, id=%lld", nonce, msg.id);
return;
}
@@ -363,7 +377,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot)
// try to find a sender by his channel
SnowFlake channelId = ::getId(pRoot["channel_id"]);
CDiscordUser *pUser = FindUserByChannel(channelId);
- if (pUser == NULL) {
+ if (pUser == nullptr) {
debugLogA("skipping message with unknown channel id=%lld", channelId);
return;
}
@@ -395,7 +409,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot)
debugLogA("store a message into the group channel id %lld", channelId);
SESSION_INFO *si = pci->SM_FindSession(pUser->wszUsername, m_szModuleName);
- if (si == NULL) {
+ if (si == nullptr) {
debugLogA("nessage to unknown channal %lld ignored", channelId);
return;
}
@@ -425,7 +439,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot)
void CDiscordProto::OnCommandMessageAck(const JSONNode &pRoot)
{
CDiscordUser *pUser = FindUserByChannel(pRoot["channel_id"]);
- if (pUser != NULL)
+ if (pUser != nullptr)
pUser->lastMsg = CDiscordMessage(::getId(pRoot["message_id"]));
}
@@ -435,7 +449,7 @@ void CDiscordProto::OnCommandMessageAck(const JSONNode &pRoot)
void CDiscordProto::OnCommandPresence(const JSONNode &pRoot)
{
CDiscordUser *pUser = FindUser(::getId(pRoot["user"]["id"]));
- if (pUser == NULL)
+ if (pUser == nullptr)
return;
int iStatus = StrToStatus(pRoot["status"].as_mstring());
@@ -495,12 +509,12 @@ void CDiscordProto::OnCommandReady(const JSONNode &pRoot)
for (auto it = channels.begin(); it != channels.end(); ++it) {
const JSONNode &p = *it;
- CDiscordUser *pUser = NULL;
+ CDiscordUser *pUser = nullptr;
const JSONNode &recipients = p["recipients"];
for (auto it2 = recipients.begin(); it2 != recipients.end(); ++it2)
pUser = PrepareUser(*it2);
- if (pUser == NULL)
+ if (pUser == nullptr)
continue;
CMStringW wszChannelId = p["id"].as_mstring();
@@ -534,7 +548,7 @@ void CDiscordProto::OnCommandTyping(const JSONNode &pRoot)
debugLogA("user typing notification: userid=%lld, channelid=%lld", userId, channelId);
CDiscordUser *pUser = FindUser(userId);
- if (pUser == NULL) {
+ if (pUser == nullptr) {
debugLogA("user with id=%lld is not found", userId);
return;
}
@@ -558,7 +572,7 @@ void CDiscordProto::OnCommandUserUpdate(const JSONNode &pRoot)
MCONTACT hContact;
if (id != m_ownId) {
CDiscordUser *pUser = FindUser(id);
- if (pUser == NULL)
+ if (pUser == nullptr)
return;
hContact = pUser->hContact;
@@ -574,6 +588,6 @@ void CDiscordProto::OnCommandUserSettingsUpdate(const JSONNode &pRoot)
int iStatus = StrToStatus(pRoot["status"].as_mstring());
if (iStatus != 0) {
int iOldStatus = m_iStatus; m_iStatus = iStatus;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
+ ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
}
}
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp
index 6eca5b1fe9..51a4b7344f 100644
--- a/protocols/Discord/src/gateway.cpp
+++ b/protocols/Discord/src/gateway.cpp
@@ -72,7 +72,7 @@ struct WSHeader
void CDiscordProto::GatewaySend(const JSONNode &pRoot, int opCode)
{
- if (m_hGatewayConnection == NULL)
+ if (m_hGatewayConnection == nullptr)
return;
json_string szText = pRoot.write();
@@ -153,7 +153,7 @@ void CDiscordProto::GatewayThreadWorker()
else conn.wPort = 443;
m_hGatewayConnection = Netlib_OpenConnection(m_hGatewayNetlibUser, &conn);
- if (m_hGatewayConnection == NULL) {
+ if (m_hGatewayConnection == nullptr) {
debugLogA("Gateway connection failed to connect to %s:%d, exiting", m_szGateway.c_str(), conn.wPort);
return;
}
@@ -292,7 +292,7 @@ void CDiscordProto::GatewayThreadWorker()
}
Netlib_CloseHandle(m_hGatewayConnection);
- m_hGatewayConnection = NULL;
+ m_hGatewayConnection = nullptr;
}
//////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp
index ac9cf235d5..f6f1a43e35 100644
--- a/protocols/Discord/src/groupchat.cpp
+++ b/protocols/Discord/src/groupchat.cpp
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
enum {
IDM_CANCEL,
- IDM_CHANGENICK, IDM_CHANGETOPIC, IDM_INVITE
+ IDM_CHANGENICK, IDM_CHANGETOPIC, IDM_INVITE, IDM_DESTROY
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -38,22 +38,25 @@ void CDiscordProto::BuildStatusList(const CDiscordGuild *pGuild, const CMStringW
static gc_item sttLogListItems[] =
{
{ LPGENW("Change &nickname"), IDM_CHANGENICK, MENU_ITEM },
- { LPGENW("Change &topic"), IDM_CHANGETOPIC, MENU_ITEM },
- { L"", 100, MENU_SEPARATOR, FALSE },
+ { LPGENW("Channel control"), FALSE, MENU_NEWPOPUP },
+ { LPGENW("Change &topic"), IDM_CHANGETOPIC, MENU_POPUPITEM },
+ { nullptr, 0, MENU_POPUPSEPARATOR },
+ { LPGENW("Destroy channel"), IDM_DESTROY, MENU_POPUPITEM },
+ { nullptr, 100, MENU_SEPARATOR, FALSE },
{ LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM },
};
int CDiscordProto::GroupchatMenuHook(WPARAM, LPARAM lParam)
{
GCMENUITEMS* gcmi = (GCMENUITEMS*)lParam;
- if (gcmi == NULL)
+ if (gcmi == nullptr)
return 0;
if (mir_strcmpi(gcmi->pszModule, m_szModuleName))
return 0;
CDiscordUser *pChat = FindUserByChannel(_wtoi64(gcmi->pszID));
- if (pChat == NULL)
+ if (pChat == nullptr)
return 0;
if (gcmi->Type == MENU_ON_LOG) {
@@ -72,7 +75,7 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch)
MCONTACT hContact;
CDiscordUser *pUser = FindUser(userId);
- if (pUser == NULL) {
+ if (pUser == nullptr) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.id.w = (wchar_t*)gch->ptszUID;
psr.nick.w = (wchar_t*)gch->ptszNick;
@@ -93,12 +96,19 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch)
void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch)
{
CDiscordUser *pUser = FindUserByChannel(_wtoi64(gch->pDest->ptszID));
- if (pUser == NULL)
+ if (pUser == nullptr)
return;
ENTER_STRING es = { sizeof(es) };
switch (gch->dwData) {
+ case IDM_DESTROY:
+ if (IDYES == MessageBox(nullptr, TranslateT("Do you really want to destroy this channel? This action is non-revertable."), m_tszUserName, MB_YESNO | MB_ICONQUESTION)) {
+ CMStringA szUrl(FORMAT, "/channels/%S", pUser->wszUsername);
+ Push(new AsyncHttpRequest(this, REQUEST_DELETE, szUrl, nullptr));
+ }
+ break;
+
case IDM_CHANGETOPIC:
es.caption = TranslateT("Enter new topic:");
es.type = ESF_RICHEDIT;
@@ -107,7 +117,7 @@ void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch)
if (EnterString(&es)) {
JSONNode root; root << WCHAR_PARAM("topic", es.ptszResult);
CMStringA szUrl(FORMAT, "/channels/%S", pUser->wszUsername);
- Push(new AsyncHttpRequest(this, REQUEST_PATCH, szUrl, NULL, &root));
+ Push(new AsyncHttpRequest(this, REQUEST_PATCH, szUrl, nullptr, &root));
mir_free(es.ptszResult);
}
break;
@@ -121,7 +131,7 @@ void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch)
if (EnterString(&es)) {
JSONNode root; root << WCHAR_PARAM("nick", es.ptszResult);
CMStringA szUrl(FORMAT, "/guilds/%lld/members/@me/nick", pUser->guildId);
- Push(new AsyncHttpRequest(this, REQUEST_PATCH, szUrl, NULL, &root));
+ Push(new AsyncHttpRequest(this, REQUEST_PATCH, szUrl, nullptr, &root));
mir_free(es.ptszResult);
}
break;
@@ -131,7 +141,7 @@ void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch)
int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*)lParam;
- if (gch == NULL)
+ if (gch == nullptr)
return 0;
if (mir_strcmpi(gch->pDest->pszModule, m_szModuleName))
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index f14caadf06..4b89937cd6 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -96,7 +96,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
{
// filter our all channels but the text ones
if (pch["type"].as_int() != 0)
- return NULL;
+ return nullptr;
CMStringW wszChannelName = pGuild->wszName + L"#" + pch["name"].as_mstring();
CMStringW wszChannelId = pch["id"].as_mstring();
@@ -120,7 +120,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
}
CDiscordUser *pUser = FindUserByChannel(channelId);
- if (pUser == NULL) {
+ if (pUser == nullptr) {
// missing channel - create it
pUser = new CDiscordUser(channelId);
pUser->bIsPrivate = false;
diff --git a/protocols/Discord/src/http.cpp b/protocols/Discord/src/http.cpp
index fafbfcc354..2b0168aad1 100644
--- a/protocols/Discord/src/http.cpp
+++ b/protocols/Discord/src/http.cpp
@@ -53,13 +53,13 @@ AsyncHttpRequest::AsyncHttpRequest(CDiscordProto *ppro, int iRequestType, LPCSTR
}
flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_SSL;
- if (ppro->m_szAccessToken != NULL) {
+ if (ppro->m_szAccessToken != nullptr) {
AddHeader("Authorization", ppro->m_szAccessToken);
flags |= NLHRF_DUMPASTEXT;
}
else flags |= NLHRF_NODUMPSEND;
- if (pRoot != NULL) {
+ if (pRoot != nullptr) {
ptrW text(json_write(pRoot));
pData = mir_utf8encodeW(text);
dataLength = (int)mir_strlen(pData);
@@ -68,7 +68,7 @@ AsyncHttpRequest::AsyncHttpRequest(CDiscordProto *ppro, int iRequestType, LPCSTR
requestType = iRequestType;
m_pCallback = pFunc;
- pUserInfo = NULL;
+ pUserInfo = nullptr;
m_iErrorCode = 0;
m_iReqNum = ::InterlockedIncrement(&g_reqNum);
}
diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp
index 76d50752bc..79677242c7 100644
--- a/protocols/Discord/src/main.cpp
+++ b/protocols/Discord/src/main.cpp
@@ -77,7 +77,7 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
pci = Chat_GetInterface();
- g_hwndHeartbeat = CreateWindowEx(0, L"STATIC", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+ g_hwndHeartbeat = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
Icon_Register(g_hInstance, "Discord", g_iconList, _countof(g_iconList));
diff --git a/protocols/Discord/src/menus.cpp b/protocols/Discord/src/menus.cpp
index 9dbc5dcea7..33d061a7df 100644
--- a/protocols/Discord/src/menus.cpp
+++ b/protocols/Discord/src/menus.cpp
@@ -24,7 +24,7 @@ INT_PTR CDiscordProto::OnMenuCreateChannel(WPARAM hContact, LPARAM)
JSONNode roles(JSON_ARRAY); roles.set_name("permission_overwrites");
JSONNode root; root << INT_PARAM("type", 0) << WCHAR_PARAM("name", es.ptszResult) << roles;
CMStringA szUrl(FORMAT, "/guilds/%lld/channels", getId(hContact, DB_KEY_CHANNELID));
- Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, NULL, &root));
+ Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, nullptr, &root));
mir_free(es.ptszResult);
}
return 0;
@@ -37,7 +37,7 @@ INT_PTR CDiscordProto::OnMenuJoinGuild(WPARAM, LPARAM)
ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "guild_name", TranslateT("Enter invitation code you received"), 0, 5 };
if (EnterString(&es)) {
CMStringA szUrl(FORMAT, "/invite/%S", es.ptszResult);
- Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, nullptr));
mir_free(es.ptszResult);
}
return 0;
@@ -47,9 +47,9 @@ INT_PTR CDiscordProto::OnMenuJoinGuild(WPARAM, LPARAM)
INT_PTR CDiscordProto::OnMenuLeaveGuild(WPARAM hContact, LPARAM)
{
- if (IDYES == MessageBox(NULL, TranslateT("Do you really want to leave the guild?"), m_tszUserName, MB_ICONQUESTION | MB_YESNOCANCEL)) {
+ if (IDYES == MessageBox(nullptr, TranslateT("Do you really want to leave the guild?"), m_tszUserName, MB_ICONQUESTION | MB_YESNOCANCEL)) {
CMStringA szUrl(FORMAT, "/users/@me/guilds/%lld", getId(hContact, DB_KEY_CHANNELID));
- Push(new AsyncHttpRequest(this, REQUEST_DELETE, szUrl, NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_DELETE, szUrl, nullptr));
}
return 0;
}
diff --git a/protocols/Discord/src/options.cpp b/protocols/Discord/src/options.cpp
index c52424ce6f..81fa9c506a 100644
--- a/protocols/Discord/src/options.cpp
+++ b/protocols/Discord/src/options.cpp
@@ -46,7 +46,7 @@ public:
virtual void OnApply() override
{
if (mir_wstrcmp(m_proto->m_wszDefaultGroup, m_wszOldGroup))
- Clist_GroupCreate(NULL, m_proto->m_wszDefaultGroup);
+ Clist_GroupCreate(0, m_proto->m_wszDefaultGroup);
ptrW buf(m_edPassword.GetText());
m_proto->setWString(DB_KEY_PASSWORD, buf);
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 34d3ae8840..484657d7a5 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -40,7 +40,7 @@ static int compareGuilds(const CDiscordGuild *p1, const CDiscordGuild *p2)
CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) :
PROTO<CDiscordProto>(proto_name, username),
m_arHttpQueue(10, compareRequests),
- m_evRequestsQueue(CreateEvent(NULL, FALSE, FALSE, NULL)),
+ m_evRequestsQueue(CreateEvent(nullptr, FALSE, FALSE, nullptr)),
m_wszDefaultGroup(this, DB_KEY_GROUP, DB_KEYVAL_GROUP),
m_wszEmail(this, DB_KEY_EMAIL, L""),
arGuilds(1, compareGuilds),
@@ -65,7 +65,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) :
db_set_resident(m_szModuleName, "XStatusMsg");
// Clist
- Clist_GroupCreate(NULL, m_wszDefaultGroup);
+ Clist_GroupCreate(0, m_wszDefaultGroup);
// Fill users list
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -100,7 +100,7 @@ CDiscordProto::~CDiscordProto()
{
debugLogA("CDiscordProto::~CDiscordProto");
Netlib_CloseHandle(m_hNetlibUser);
- m_hNetlibUser = NULL;
+ m_hNetlibUser = nullptr;
m_arHttpQueue.destroy();
::CloseHandle(m_evRequestsQueue);
@@ -152,10 +152,10 @@ int CDiscordProto::SetStatus(int iNewStatus)
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
}
// not logged in? come on
- else if (m_hWorkerThread == NULL && !IsStatusConnecting(m_iStatus)) {
+ else if (m_hWorkerThread == nullptr && !IsStatusConnecting(m_iStatus)) {
m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
- m_hWorkerThread = ForkThreadEx(&CDiscordProto::ServerThread, NULL, NULL);
+ m_hWorkerThread = ForkThreadEx(&CDiscordProto::ServerThread, nullptr, nullptr);
}
else if (m_bOnline) {
debugLogA("setting server online status to %d", iNewStatus);
@@ -187,7 +187,7 @@ HWND CDiscordProto::CreateExtendedSearchUI(HWND hwndParent)
if (hwndParent)
return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_EXTSEARCH), hwndParent, AdvancedSearchDlgProc, 0);
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -203,25 +203,25 @@ void CDiscordProto::SearchThread(void *param)
psr.firstName.w = L"";
psr.lastName.w = L"";
psr.id.w = L"";
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)param, (LPARAM)&psr);
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)param, (LPARAM)&psr);
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)param, 0);
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)param, 0);
mir_free(param);
}
HWND CDiscordProto::SearchAdvanced(HWND hwndDlg)
{
if (!m_bOnline || !IsWindow(hwndDlg))
- return NULL;
+ return nullptr;
wchar_t wszNick[200];
GetDlgItemTextW(hwndDlg, IDC_NICK, wszNick, _countof(wszNick));
if (wszNick[0] == 0) // empty string? reject
- return NULL;
+ return nullptr;
wchar_t *p = wcschr(wszNick, '#');
- if (p == NULL) // wrong user id
- return NULL;
+ if (p == nullptr) // wrong user id
+ return nullptr;
p = mir_wstrdup(wszNick);
ForkThread(&CDiscordProto::SearchThread, p);
@@ -231,7 +231,7 @@ HWND CDiscordProto::SearchAdvanced(HWND hwndDlg)
HANDLE CDiscordProto::SearchBasic(const wchar_t *wszId)
{
if (!m_bOnline)
- return NULL;
+ return nullptr;
CMStringA szUrl = "/users/";
szUrl.AppendFormat(ptrA(mir_utf8encodeW(wszId)));
@@ -248,7 +248,7 @@ int CDiscordProto::AuthRequest(MCONTACT hContact, const wchar_t*)
{
ptrW wszUsername(getWStringA(hContact, DB_KEY_NICK));
int iDiscriminator(getDword(hContact, DB_KEY_DISCR, -1));
- if (wszUsername == NULL || iDiscriminator == -1)
+ if (wszUsername == nullptr || iDiscriminator == -1)
return 1; // error
JSONNode root; root << WCHAR_PARAM("username", wszUsername) << INT_PARAM("discriminator", iDiscriminator);
@@ -267,14 +267,14 @@ int CDiscordProto::Authorize(MEVENT hDbEvent)
{
DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return 1;
- if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL) return 1;
+ if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == nullptr) return 1;
if (db_event_get(hDbEvent, &dbei)) return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
MCONTACT hContact = DbGetAuthEventContact(&dbei);
CMStringA szUrl(FORMAT, "/users/@me/relationships/%lld", getId(hContact, DB_KEY_ID));
- Push(new AsyncHttpRequest(this, REQUEST_PUT, szUrl, NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_PUT, szUrl, nullptr));
return 0;
}
@@ -282,7 +282,7 @@ int CDiscordProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
DBEVENTINFO dbei = {};
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return 1;
- if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL) return 1;
+ if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == nullptr) return 1;
if (db_event_get(hDbEvent, &dbei)) return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
@@ -300,7 +300,7 @@ MCONTACT CDiscordProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
return 0;
wchar_t *p = wcschr(psr->nick.w, '#');
- if (p == NULL)
+ if (p == nullptr)
return 0;
MCONTACT hContact = db_add_contact();
@@ -357,11 +357,11 @@ int CDiscordProto::SendMsg(MCONTACT hContact, int /*flags*/, const char *pszSrc)
}
ptrW wszText(mir_utf8decodeW(pszSrc));
- if (wszText == NULL)
+ if (wszText == nullptr)
return 0;
CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID));
- if (pUser == NULL || pUser->id == 0)
+ if (pUser == nullptr || pUser->id == 0)
return 0;
// no channel - we need to create one
@@ -397,7 +397,7 @@ int CDiscordProto::UserIsTyping(MCONTACT hContact, int type)
{
if (type == PROTOTYPE_SELFTYPING_ON) {
CMStringA szUrl(FORMAT, "/channels/%lld/typing", getId(hContact, DB_KEY_CHANNELID));
- Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, nullptr));
}
return 0;
}
@@ -408,7 +408,7 @@ void CDiscordProto::MarkReadTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
{
CDiscordProto *ppro = (CDiscordProto*)(id - 1);
- JSONNode root; root.push_back(JSONNode("token", NULL));
+ JSONNode root; root.push_back(JSONNode("token", nullptr));
mir_cslock lck(ppro->csMarkReadQueue);
while (ppro->arMarkReadQueue.getCount()) {
@@ -435,7 +435,7 @@ int CDiscordProto::OnDbEventRead(WPARAM, LPARAM hDbEvent)
SetTimer(g_hwndHeartbeat, UINT_PTR(this) + 1, 200, &CDiscordProto::MarkReadTimerProc);
CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID));
- if (pUser != NULL) {
+ if (pUser != nullptr) {
mir_cslock lck(csMarkReadQueue);
if (arMarkReadQueue.indexOf(pUser) == -1)
arMarkReadQueue.insert(pUser);
@@ -449,11 +449,11 @@ int CDiscordProto::OnDbEventRead(WPARAM, LPARAM hDbEvent)
int CDiscordProto::OnDeleteContact(MCONTACT hContact)
{
CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID));
- if (pUser == NULL || !m_bOnline)
+ if (pUser == nullptr || !m_bOnline)
return 0;
if (pUser->channelId)
- Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/channels/%lld", pUser->channelId), NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/channels/%lld", pUser->channelId), nullptr));
if (pUser->id)
RemoveFriend(pUser->id);
@@ -480,7 +480,7 @@ void CDiscordProto::SendFileThread(void *param)
SendFileThreadParam *p = (SendFileThreadParam*)param;
FILE *in = _wfopen(p->wszFileName, L"rb");
- if (in == NULL) {
+ if (in == nullptr) {
debugLogA("cannot open file %S for reading", p->wszFileName.c_str());
LBL_Error:
ProtoBroadcastAck(p->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, param);
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 376f536419..67b0b52442 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -8,7 +8,7 @@ typedef void (CDiscordProto::*GatewayHandlerFunc)(const JSONNode&);
struct AsyncHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject
{
AsyncHttpRequest();
- AsyncHttpRequest(CDiscordProto*, int iRequestType, LPCSTR szUrl, HttpCallback pFunc, JSONNode *pNode = NULL);
+ AsyncHttpRequest(CDiscordProto*, int iRequestType, LPCSTR szUrl, HttpCallback pFunc, JSONNode *pNode = nullptr);
~AsyncHttpRequest();
void AddHeader(LPCSTR, LPCSTR);
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 169827044c..b19def5787 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void CDiscordProto::RemoveFriend(SnowFlake id)
{
- Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/users/@me/relationships/%lld", id), NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/users/@me/relationships/%lld", id), nullptr));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -31,7 +31,7 @@ void CDiscordProto::RemoveFriend(SnowFlake id)
void CDiscordProto::RetrieveHistory(MCONTACT hContact, CDiscordHistoryOp iOp, SnowFlake msgid, int iLimit)
{
CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID));
- if (pUser == NULL)
+ if (pUser == nullptr)
return;
CMStringA szUrl(FORMAT, "/channels/%lld/messages", pUser->channelId);
@@ -66,7 +66,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
SESSION_INFO *si = nullptr;
if (!pUser->bIsPrivate) {
si = pci->SM_FindSession(pUser->wszUsername, m_szModuleName);
- if (si == NULL) {
+ if (si == nullptr) {
debugLogA("nessage to unknown channal %lld ignored", pUser->channelId);
return;
}
@@ -161,14 +161,14 @@ void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques
{
MCONTACT hContact = (MCONTACT)pReq->pUserInfo;
if (pReply->resultCode != 200) {
- if (hContact == NULL)
+ if (hContact == 0)
ConnectionFailed(LOGINERR_WRONGPASSWORD);
return;
}
JSONNode root = JSONNode::parse(pReply->pData);
if (!root) {
- if (hContact == NULL)
+ if (hContact == 0)
ConnectionFailed(LOGINERR_NOSERVER);
return;
}
@@ -181,7 +181,7 @@ void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques
setWString(hContact, DB_KEY_NICK, root["username"].as_mstring());
setWString(hContact, DB_KEY_EMAIL, root["email"].as_mstring());
- if (hContact == NULL) {
+ if (hContact == 0) {
m_ownId = id;
OnLoggedIn();
}
@@ -210,7 +210,7 @@ void CDiscordProto::OnReceiveGateway(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
}
m_szGateway = root["url"].as_mstring();
- ForkThread(&CDiscordProto::GatewayThread, NULL);
+ ForkThread(&CDiscordProto::GatewayThread, nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -221,7 +221,7 @@ void CDiscordProto::SetServerStatus(int iStatus)
return;
if (iStatus == ID_STATUS_OFFLINE)
- Push(new AsyncHttpRequest(this, REQUEST_POST, "/auth/logout", NULL));
+ Push(new AsyncHttpRequest(this, REQUEST_POST, "/auth/logout", nullptr));
else {
const char *pszStatus;
switch (iStatus) {
@@ -236,11 +236,11 @@ void CDiscordProto::SetServerStatus(int iStatus)
pszStatus = "online"; break;
}
JSONNode root; root << CHAR_PARAM("status", pszStatus);
- Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me/settings", NULL, &root));
+ Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me/settings", nullptr, &root));
}
int iOldStatus = m_iStatus; m_iStatus = iStatus;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
+ ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
}
void CDiscordProto::OnReceiveAuth(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
@@ -299,7 +299,7 @@ void CDiscordProto::OnReceiveMessageAck(NETLIBHTTPREQUEST *pReply, AsyncHttpRequ
JSONNode props; props.set_name("properties");
JSONNode reply; reply << props;
reply << CHAR_PARAM("event", "ack_messages") << WCHAR_PARAM("token", root["token"].as_mstring());
- Push(new AsyncHttpRequest(this, REQUEST_POST, "/track", NULL, &reply));
+ Push(new AsyncHttpRequest(this, REQUEST_POST, "/track", nullptr, &reply));
}
}
@@ -326,5 +326,5 @@ LBL_Error:
m_szAccessToken = szToken.Detach();
setString("AccessToken", m_szAccessToken);
- RetrieveUserInfo(NULL);
+ RetrieveUserInfo(0);
}
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 6078e45d0f..6fc1e8b23a 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -112,7 +112,7 @@ SnowFlake CDiscordProto::getId(const char *szSetting)
{
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if (db_get(NULL, m_szModuleName, szSetting, &dbv))
+ if (db_get(0, m_szModuleName, szSetting, &dbv))
return 0;
SnowFlake result = (dbv.cpbVal == sizeof(SnowFlake)) ? *(SnowFlake*)dbv.pbVal : 0;
@@ -134,7 +134,7 @@ SnowFlake CDiscordProto::getId(MCONTACT hContact, const char *szSetting)
void CDiscordProto::setId(const char *szSetting, SnowFlake iValue)
{
- db_set_blob(NULL, m_szModuleName, szSetting, &iValue, sizeof(iValue));
+ db_set_blob(0, m_szModuleName, szSetting, &iValue, sizeof(iValue));
}
void CDiscordProto::setId(MCONTACT hContact, const char *szSetting, SnowFlake iValue)
@@ -159,7 +159,7 @@ CDiscordUser* CDiscordProto::FindUser(const wchar_t *pwszUsername, int iDiscrimi
return &p;
}
- return NULL;
+ return nullptr;
}
CDiscordUser* CDiscordProto::FindUserByChannel(SnowFlake channelId)
@@ -170,7 +170,7 @@ CDiscordUser* CDiscordProto::FindUserByChannel(SnowFlake channelId)
return &p;
}
- return NULL;
+ return nullptr;
}
CDiscordUser* CDiscordProto::PrepareUser(const JSONNode &user)
@@ -183,12 +183,12 @@ CDiscordUser* CDiscordProto::PrepareUser(const JSONNode &user)
CMStringW username = user["username"].as_mstring();
CDiscordUser *pUser = FindUser(id);
- if (pUser == NULL) {
+ if (pUser == nullptr) {
MCONTACT tmp = INVALID_CONTACT_ID;
// no user found by userid, try to find him via username+discriminator
pUser = FindUser(username, iDiscriminator);
- if (pUser != NULL) {
+ if (pUser != nullptr) {
// if found, remove the object from list to resort it (its userid==0)
if (pUser->hContact != 0)
tmp = pUser->hContact;
@@ -282,10 +282,10 @@ void CDiscordProto::ProcessType(CDiscordUser *pUser, const JSONNode &pRoot)
setByte(pUser->hContact, DB_KEY_REQAUTH, 1);
CMStringA szId(FORMAT, "%lld", pUser->id);
- DB_AUTH_BLOB blob(pUser->hContact, T2Utf(pUser->wszUsername), NULL, NULL, szId, NULL);
+ DB_AUTH_BLOB blob(pUser->hContact, T2Utf(pUser->wszUsername), nullptr, nullptr, szId, nullptr);
PROTORECVEVENT pre = { 0 };
- pre.timestamp = (DWORD)time(NULL);
+ pre.timestamp = (DWORD)time(nullptr);
pre.lParam = blob.size();
pre.szMessage = blob;
ProtoChainRecv(pUser->hContact, PSR_AUTH, 0, (LPARAM)&pre);
@@ -317,7 +317,7 @@ void CDiscordProto::ParseSpecialChars(SESSION_INFO *si, CMStringW &str)
CDiscordUser *pUser = FindUserByChannel(_wtoi64(wszWord.c_str() + 1));
if (pUser != nullptr) {
ptrW wszNick(getWStringA(pUser->hContact, "Nick"));
- if (wszNick != NULL)
+ if (wszNick != nullptr)
str.Replace(L"<" + wszWord + L">", wszNick);
}
}