forked from OpenGamers/abaddon
GetUserStatus returns offline instead of nullopt
This commit is contained in:
@@ -36,13 +36,8 @@ void StatusIndicator::CheckStatus() {
|
|||||||
get_style_context()->remove_class("dnd");
|
get_style_context()->remove_class("dnd");
|
||||||
get_style_context()->remove_class("idle");
|
get_style_context()->remove_class("idle");
|
||||||
get_style_context()->remove_class("offline");
|
get_style_context()->remove_class("offline");
|
||||||
if (status.has_value()) {
|
get_style_context()->add_class(GetPresenceString(status));
|
||||||
get_style_context()->add_class(GetPresenceString(*status));
|
m_status = status;
|
||||||
m_status = *status;
|
|
||||||
} else {
|
|
||||||
m_status = PresenceStatus::Offline;
|
|
||||||
get_style_context()->add_class("offline");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last_status != m_status)
|
if (last_status != m_status)
|
||||||
queue_draw();
|
queue_draw();
|
||||||
|
|||||||
@@ -842,12 +842,12 @@ void DiscordClient::SetUserAgent(std::string agent) {
|
|||||||
m_websocket.SetUserAgent(agent);
|
m_websocket.SetUserAgent(agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<PresenceStatus> DiscordClient::GetUserStatus(Snowflake id) const {
|
PresenceStatus DiscordClient::GetUserStatus(Snowflake id) const {
|
||||||
auto it = m_user_to_status.find(id);
|
auto it = m_user_to_status.find(id);
|
||||||
if (it != m_user_to_status.end())
|
if (it != m_user_to_status.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
return std::nullopt;
|
return PresenceStatus::Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_set<Snowflake> DiscordClient::GetRelationships(RelationshipType type) const {
|
std::unordered_set<Snowflake> DiscordClient::GetRelationships(RelationshipType type) const {
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ public:
|
|||||||
void UpdateToken(std::string token);
|
void UpdateToken(std::string token);
|
||||||
void SetUserAgent(std::string agent);
|
void SetUserAgent(std::string agent);
|
||||||
|
|
||||||
std::optional<PresenceStatus> GetUserStatus(Snowflake id) const;
|
PresenceStatus GetUserStatus(Snowflake id) const;
|
||||||
|
|
||||||
std::unordered_set<Snowflake> GetRelationships(RelationshipType type) const;
|
std::unordered_set<Snowflake> GetRelationships(RelationshipType type) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user