diff options
Diffstat (limited to 'protocols/Discord/src/proto.h')
-rw-r--r-- | protocols/Discord/src/proto.h | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 844e6c8ef0..117e7a90ba 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -1,8 +1,5 @@ #pragma once
-#define EVENT_INCOMING_CALL 10001
-#define EVENT_CALL_FINISHED 10002
-
enum Permission : uint64_t
{
CREATE_INVITE = (1ll << 0), // Allows creation of instant invites
@@ -148,6 +145,35 @@ struct CDiscordUser : public MZeroedObject /////////////////////////////////////////////////////////////////////////////////////////
+struct CDiscordVoiceState : public MZeroedObject
+{
+ explicit CDiscordVoiceState(const JSONNode &node);
+
+ SnowFlake m_userId, m_channelId;
+ CMStringA m_sessionId;
+
+ union {
+ int m_flags;
+ struct {
+ bool m_bDeaf : 1; // deafened by the server
+ bool m_bMute : 1; // muted by the server
+ bool m_bSelfMute : 1; // locally muted
+ bool m_bSelfDeaf : 1; // locally deafened
+ bool m_nSelfVideo : 1; // camera enabled
+ bool m_bSuppress : 1; // user can't speak
+ };
+ };
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CDiscordVoiceCall : public MZeroedObject
+{
+ SnowFlake channelId, guildId;
+ CMStringA szSessionId, szToken, szEndpoint;
+ time_t startTime;
+};
+
struct CDiscordGuildMember : public MZeroedObject
{
CDiscordGuildMember(SnowFlake id) :
@@ -191,6 +217,8 @@ struct CDiscordGuild : public MZeroedObject LIST<CDiscordUser> arChannels;
OBJLIST<CDiscordGuildMember> arChatUsers;
OBJLIST<CDiscordRole> arRoles; // guild roles
+ OBJLIST<CDiscordVoiceState> arVoiceStates;
+ CDiscordVoiceCall *pVoiceCall;
uint64_t CalcPermissionOverride(SnowFlake myUserId, const JSONNode &json);
void ProcessRole(const JSONNode &json);
@@ -199,13 +227,6 @@ struct CDiscordGuild : public MZeroedObject void SaveToFile();
};
-struct CDiscordVoiceCall
-{
- CMStringA szId;
- SnowFlake channelId;
- time_t startTime;
-};
-
/////////////////////////////////////////////////////////////////////////////////////////
#define OPCODE_DISPATCH 0
@@ -315,6 +336,7 @@ class CDiscordProto : public PROTO<CDiscordProto> void GatewaySendIdentify(void);
void GatewaySendResume(void);
bool GatewaySendStatus(int iStatus, const wchar_t *pwszStatusText);
+ bool GatewaySendVoice(JSONNode &node);
GatewayHandlerFunc GetHandler(const wchar_t*);
@@ -343,7 +365,6 @@ class CDiscordProto : public PROTO<CDiscordProto> OBJLIST<CDiscordUser> arUsers;
OBJLIST<COwnMessage> arOwnMessages;
- OBJLIST<CDiscordVoiceCall> arVoiceCalls;
CDiscordUser* FindUser(SnowFlake id);
CDiscordUser* FindUser(const wchar_t *pwszUsername, int iDiscriminator);
@@ -414,7 +435,14 @@ class CDiscordProto : public PROTO<CDiscordProto> //////////////////////////////////////////////////////////////////////////////////////
// voice
+ mir_cs m_csVoice;
+ OBJLIST<CDiscordVoiceCall> arVoiceCalls;
+
void InitVoip(bool bEnable);
+ void TryVoiceStart(CDiscordGuild *pGuild);
+ void VoiceChannelConnect(MCONTACT hContact);
+
+ CDiscordVoiceCall* FindCall(SnowFlake channelId);
INT_PTR __cdecl VoiceCaps(WPARAM, LPARAM);
INT_PTR __cdecl VoiceCanCall(WPARAM, LPARAM);
@@ -423,6 +451,8 @@ class CDiscordProto : public PROTO<CDiscordProto> INT_PTR __cdecl VoiceCallCancel(WPARAM, LPARAM);
int __cdecl OnVoiceState(WPARAM, LPARAM);
+
+ void __cdecl VoiceClientThread(void *);
//////////////////////////////////////////////////////////////////////////////////////
// misc methods
@@ -526,6 +556,8 @@ public: void OnCommandTyping(const JSONNode &json);
void OnCommandUserUpdate(const JSONNode &json);
void OnCommandUserSettingsUpdate(const JSONNode &json);
+ void OnCommandVoiceServerUpdate(const JSONNode &json);
+ void OnCommandVoiceStateUpdate(const JSONNode &json);
void OnLoggedIn();
void OnLoggedOut();
|