diff options
-rw-r--r-- | protocols/Discord/src/guilds.cpp | 4 | ||||
-rw-r--r-- | protocols/Discord/src/proto.cpp | 1 | ||||
-rw-r--r-- | protocols/Discord/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Discord/src/voice.cpp | 9 |
4 files changed, 16 insertions, 0 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index 24f7dccf56..322a4ae9ed 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -177,6 +177,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS SnowFlake channelId = _wtoi64(wszChannelId);
CMStringW wszName = pch["name"].as_mstring();
CDiscordUser *pUser;
+ bool bIsVoice = false;
// filter our all channels but the text ones
switch (pch["type"].as_int()) {
@@ -201,6 +202,8 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS return pUser;
case 2: // voice channel
+ bIsVoice = true;
+ __fallthrough;
case 0: // text channel
// check permissions to enter the channel
@@ -227,6 +230,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS pUser->wszChannelName = pGuild->m_wszName + L"#" + wszName;
pUser->wszTopic = pch["topic"].as_mstring();
pUser->pGuild = pGuild;
+ pUser->bIsVoice = bIsVoice;
pUser->lastMsgId = ::getId(pch["last_message_id"]);
pUser->parentId = ::getId(pch["parent_id"]);
return pUser;
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 22f6f35e05..5929b5ce19 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -66,6 +66,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : CreateProtoService(PS_VOICE_CALL, &CDiscordProto::VoiceCallCreate);
CreateProtoService(PS_VOICE_DROPCALL, &CDiscordProto::VoiceCallCancel);
CreateProtoService(PS_VOICE_ANSWERCALL, &CDiscordProto::VoiceCallAnswer);
+ CreateProtoService(PS_VOICE_CALL_CONTACT_VALID, &CDiscordProto::VoiceCanCall);
CreateProtoService(PS_MENU_REQAUTH, &CDiscordProto::RequestFriendship);
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 31fda24fd3..844e6c8ef0 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -136,6 +136,7 @@ struct CDiscordUser : public MZeroedObject SnowFlake parentId;
bool bIsPrivate;
bool bIsGroup;
+ bool bIsVoice;
bool bSynced;
struct CDiscordGuild *pGuild;
@@ -416,6 +417,7 @@ class CDiscordProto : public PROTO<CDiscordProto> void InitVoip(bool bEnable);
INT_PTR __cdecl VoiceCaps(WPARAM, LPARAM);
+ INT_PTR __cdecl VoiceCanCall(WPARAM, LPARAM);
INT_PTR __cdecl VoiceCallCreate(WPARAM, LPARAM);
INT_PTR __cdecl VoiceCallAnswer(WPARAM, LPARAM);
INT_PTR __cdecl VoiceCallCancel(WPARAM, LPARAM);
diff --git a/protocols/Discord/src/voice.cpp b/protocols/Discord/src/voice.cpp index ee6369777b..51899c57e3 100644 --- a/protocols/Discord/src/voice.cpp +++ b/protocols/Discord/src/voice.cpp @@ -93,6 +93,15 @@ INT_PTR CDiscordProto::VoiceCaps(WPARAM, LPARAM) return VOICE_CAPS_VOICE | VOICE_CAPS_CALL_CONTACT;
}
+INT_PTR CDiscordProto::VoiceCanCall(WPARAM hContact, LPARAM)
+{
+ if (auto *pUser = FindUser(getId(hContact, DB_KEY_ID)))
+ if (pUser->bIsPrivate || pUser->bIsVoice)
+ return TRUE;
+
+ return FALSE;
+}
+
INT_PTR CDiscordProto::VoiceCallCreate(WPARAM, LPARAM)
{
return 0;
|