summaryrefslogtreecommitdiff
path: root/discord/discord.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-05-09 01:20:48 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-05-09 01:20:48 -0400
commit925405826a23527a17b6a5ce1917dcd5507c0b38 (patch)
tree273e28b6ab6e63c509c7184e033c327041c5ba6d /discord/discord.cpp
parent469053a14468f08dc694a1ef8d98f0265a72dd07 (diff)
downloadabaddon-portaudio-925405826a23527a17b6a5ce1917dcd5507c0b38.tar.gz
abaddon-portaudio-925405826a23527a17b6a5ce1917dcd5507c0b38.zip
handle RELATIONSHIP_ADD
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r--discord/discord.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp
index 1045176..e4592ca 100644
--- a/discord/discord.cpp
+++ b/discord/discord.cpp
@@ -1038,6 +1038,9 @@ void DiscordClient::HandleGatewayMessage(std::string str) {
case GatewayEvent::RELATIONSHIP_REMOVE: {
HandleGatewayRelationshipRemove(m);
} break;
+ case GatewayEvent::RELATIONSHIP_ADD: {
+ HandleGatewayRelationshipAdd(m);
+ } break;
}
} break;
default:
@@ -1485,6 +1488,13 @@ void DiscordClient::HandleGatewayRelationshipRemove(const GatewayMessage &msg) {
m_signal_relationship_remove.emit(data.ID, data.Type);
}
+void DiscordClient::HandleGatewayRelationshipAdd(const GatewayMessage &msg) {
+ RelationshipAddData data = msg.Data;
+ m_store.SetUser(data.ID, data.User);
+ m_user_relationships[data.ID] = data.Type;
+ m_signal_relationship_add.emit(std::move(data));
+}
+
void DiscordClient::HandleGatewayReadySupplemental(const GatewayMessage &msg) {
ReadySupplementalData data = msg.Data;
for (const auto &p : data.MergedPresences.Friends) {
@@ -1821,6 +1831,7 @@ void DiscordClient::LoadEventMap() {
m_event_map["GUILD_JOIN_REQUEST_UPDATE"] = GatewayEvent::GUILD_JOIN_REQUEST_UPDATE;
m_event_map["GUILD_JOIN_REQUEST_DELETE"] = GatewayEvent::GUILD_JOIN_REQUEST_DELETE;
m_event_map["RELATIONSHIP_REMOVE"] = GatewayEvent::RELATIONSHIP_REMOVE;
+ m_event_map["RELATIONSHIP_ADD"] = GatewayEvent::RELATIONSHIP_ADD;
}
DiscordClient::type_signal_gateway_ready DiscordClient::signal_gateway_ready() {
@@ -1947,6 +1958,10 @@ DiscordClient::type_signal_relationship_remove DiscordClient::signal_relationshi
return m_signal_relationship_remove;
}
+DiscordClient::type_signal_relationship_add DiscordClient::signal_relationship_add() {
+ return m_signal_relationship_add;
+}
+
DiscordClient::type_signal_message_sent DiscordClient::signal_message_sent() {
return m_signal_message_sent;
}