summaryrefslogtreecommitdiff
path: root/protocols/Discord/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-25 21:02:11 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-25 21:02:11 +0300
commit45bf5f51cc788cb8f19e1b8fcd5b8818dc7a2e00 (patch)
tree40a087f36b75b4c1fb7218bd06052df2968bf2d2 /protocols/Discord/src
parent8ba9e423e683d570702476dd93571cea26a27c1a (diff)
GCEVENT::GCEF_UTF8 - flag for direct communication with utf8-encoded chat events (UTF16LE by default)
Diffstat (limited to 'protocols/Discord/src')
-rw-r--r--protocols/Discord/src/dispatch.cpp28
-rw-r--r--protocols/Discord/src/guilds.cpp5
-rw-r--r--protocols/Discord/src/server.cpp7
3 files changed, 23 insertions, 17 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 57b78c4df9..13441bcf08 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -143,8 +143,9 @@ void CDiscordProto::OnCommandChannelUpdated(const JSONNode &pRoot)
CMStringW wszTopic = pRoot["topic"].as_mstring();
Chat_SetStatusbarText(m_szModuleName, pUser->wszUsername, wszTopic);
- GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
- gce.ptszText = wszTopic;
+ GCEVENT gce = { m_szModuleName, 0, GC_EVENT_TOPIC };
+ gce.pszID.w = pUser->wszUsername;
+ gce.pszText.w = wszTopic;
gce.time = time(0);
Chat_Event(&gce);
}
@@ -226,9 +227,10 @@ void CDiscordProto::OnCommandGuildMemberRemoved(const JSONNode &pRoot)
if (pUser->pGuild != pGuild)
continue;
- GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_PART };
+ GCEVENT gce = { m_szModuleName, 0, GC_EVENT_PART };
+ gce.pszUID.w = pUser->wszUsername;
gce.time = time(0);
- gce.ptszUID = wszUserId;
+ gce.pszUID.w = wszUserId;
Chat_Event(&gce);
}
}
@@ -260,11 +262,12 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot)
wszOldNick = ui->pszNick;
}
- GCEVENT gce = { m_szModuleName, it->wszUsername, GC_EVENT_NICK };
+ GCEVENT gce = { m_szModuleName, 0, GC_EVENT_NICK };
+ gce.pszID.w = it->wszUsername;
gce.time = time(0);
- gce.ptszUID = wszUserId;
- gce.ptszNick = wszOldNick;
- gce.ptszText = gm->wszNick;
+ gce.pszUID.w = wszUserId;
+ gce.pszNick.w = wszOldNick;
+ gce.pszText.w = gm->wszNick;
Chat_Event(&gce);
}
}
@@ -417,15 +420,16 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew)
ParseSpecialChars(si, wszText);
- GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE };
+ GCEVENT gce = { m_szModuleName, 0, GC_EVENT_MESSAGE };
+ gce.pszID.w = pUser->wszUsername;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = wszUserId;
- gce.ptszText = wszText;
+ gce.pszUID.w = wszUserId;
+ gce.pszText.w = wszText;
gce.time = (DWORD)StringToDate(pRoot["timestamp"].as_mstring());
gce.bIsMe = bOurMessage;
Chat_Event(&gce);
- debugLogW(L"New channel %s message from %s: %s", si->ptszID, gce.ptszUID, gce.ptszText);
+ debugLogW(L"New channel %s message from %s: %s", si->ptszID, gce.pszUID.w, gce.pszText.w);
}
}
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 76fafb1918..5cda9d41e8 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -112,9 +112,10 @@ void CDiscordProto::CreateChat(CDiscordGuild *pGuild, CDiscordUser *pUser)
if (!pUser->wszTopic.IsEmpty()) {
Chat_SetStatusbarText(m_szModuleName, pUser->wszUsername, pUser->wszTopic);
- GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
+ GCEVENT gce = { m_szModuleName, 0, GC_EVENT_TOPIC };
+ gce.pszID.w = pUser->wszUsername;
gce.time = time(0);
- gce.ptszText = pUser->wszTopic;
+ gce.pszText.w = pUser->wszTopic;
Chat_Event(&gce);
}
}
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index f1d1db3a5e..661e313290 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -117,10 +117,11 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
else {
ParseSpecialChars(si, wszText);
- GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE };
+ GCEVENT gce = { m_szModuleName, 0, GC_EVENT_MESSAGE };
+ gce.pszID.w = pUser->wszUsername;
gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszUID = wszUserId;
- gce.ptszText = wszText;
+ gce.pszUID.w = wszUserId;
+ gce.pszText.w = wszText;
gce.time = dwTimeStamp;
gce.bIsMe = authorid == m_ownId;
Chat_Event(&gce);