diff options
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 4c129de23b..48141312f5 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -227,7 +227,7 @@ INT_PTR CDiscordProto::GetCaps(int type, MCONTACT) return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE;
case PFLAGNUM_4:
return PF4_FORCEAUTH | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_SUPPORTIDLE | PF4_AVATARS |
- PF4_IMSENDOFFLINE | PF4_SERVERMSGID | PF4_OFFLINEFILES | PF4_GROUPCHATFILES;
+ PF4_IMSENDOFFLINE | PF4_SERVERMSGID | PF4_OFFLINEFILES | PF4_GROUPCHATFILES | PF4_REPLY;
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)TranslateT("User ID");
}
@@ -484,7 +484,7 @@ void CDiscordProto::OnSendMsg(MHttpResponse *pReply, AsyncHttpRequest *pReq) }
}
-int CDiscordProto::SendMsg(MCONTACT hContact, MEVENT, const char *pszSrc)
+int CDiscordProto::SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszSrc)
{
if (!m_bOnline)
return -1;
@@ -516,6 +516,18 @@ int CDiscordProto::SendMsg(MCONTACT hContact, MEVENT, const char *pszSrc) SnowFlake nonce; Utils_GetRandom(&nonce, sizeof(nonce)); nonce = abs(nonce);
JSONNode body; body << WCHAR_PARAM("content", wszText) << SINT64_PARAM("nonce", nonce);
+ if (hReplyEvent) {
+ SnowFlake iReplyId = 0;
+ DB::EventInfo dbei(hReplyEvent, false);
+ if (dbei && dbei.szId) {
+ iReplyId = _atoi64(dbei.szId);
+
+ JSONNode reply; reply.set_name("message_reference");
+ reply << INT64_PARAM("channel_id", pUser->channelId) << INT64_PARAM("message_id", iReplyId);
+ body << reply;
+ }
+ }
+
CMStringA szUrl(FORMAT, "/channels/%lld/messages", pUser->channelId);
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, szUrl, &CDiscordProto::OnSendMsg, &body);
pReq->hContact = hContact;
|