Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/uowuo/abaddon
Browse files Browse the repository at this point in the history
  • Loading branch information
ouwou committed Jun 3, 2024
2 parents 5b9d10a + f8e7ea3 commit 0186507
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ For example, memory_db would be set by adding `memory_db = true` under the line
| Setting | Type | Default | Description |
|---------------|---------|---------|-------------------------|
| `hideconsole` | boolean | true | Hide console on startup |
| `hideconsole` | boolean | false | Hide console on startup |
### Environment variables
Expand Down
60 changes: 30 additions & 30 deletions src/discord/user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,69 +220,69 @@ void UserData::update_from_json(const nlohmann::json &j) {
}

const char *UserData::GetFlagName(uint64_t flag) {
switch (flag) {
case DiscordEmployee:
switch (static_cast<UserData::EFlags>(flag)) {
case UserData::EFlags::DiscordEmployee:
return "discordstaff";
case PartneredServerOwner:
case UserData::EFlags::PartneredServerOwner:
return "partneredowner";
case HypeSquadEvents:
case UserData::EFlags::HypeSquadEvents:
return "hypesquadevents";
case BugHunterLevel1:
case UserData::EFlags::BugHunterLevel1:
return "discordbughunter";
case HouseBravery:
case UserData::EFlags::HouseBravery:
return "hypesquadbravery";
case HouseBrilliance:
case UserData::EFlags::HouseBrilliance:
return "hypesquadbrilliance";
case HouseBalance:
case UserData::EFlags::HouseBalance:
return "hypesquadbalance";
case EarlySupporter:
case UserData::EFlags::EarlySupporter:
return "earlysupporter";
case TeamUser:
case UserData::EFlags::TeamUser:
return "teamuser";
case System:
case UserData::EFlags::System:
return "system";
case BugHunterLevel2:
case UserData::EFlags::BugHunterLevel2:
return "discordbughunter2";
case VerifiedBot:
case UserData::EFlags::VerifiedBot:
return "verifiedbot";
case EarlyVerifiedBotDeveloper:
case UserData::EFlags::EarlyVerifiedBotDeveloper:
return "earlyverifiedbotdeveloper";
case CertifiedModerator:
case UserData::EFlags::CertifiedModerator:
return "certifiedmoderator";
default:
return "unknown";
}
}

const char *UserData::GetFlagReadableName(uint64_t flag) {
switch (flag) {
case DiscordEmployee:
switch (static_cast<UserData::EFlags>(flag)) {
case UserData::EFlags::DiscordEmployee:
return "Discord Staff";
case PartneredServerOwner:
case UserData::EFlags::PartneredServerOwner:
return "Partnered Server Owner";
case HypeSquadEvents:
case UserData::EFlags::HypeSquadEvents:
return "HypeSquad Events";
case BugHunterLevel1:
case UserData::EFlags::BugHunterLevel1:
return "Discord Bug Hunter";
case HouseBravery:
case UserData::EFlags::HouseBravery:
return "HypeSquad Bravery";
case HouseBrilliance:
case UserData::EFlags::HouseBrilliance:
return "HypeSquad Brilliance";
case HouseBalance:
case UserData::EFlags::HouseBalance:
return "HypeSquad Balance";
case EarlySupporter:
case UserData::EFlags::EarlySupporter:
return "Early Supporter";
case TeamUser:
case UserData::EFlags::TeamUser:
return "Team User"; // ???
case System:
case UserData::EFlags::System:
return "System";
case BugHunterLevel2:
case UserData::EFlags::BugHunterLevel2:
return "Discord Bug Hunter Level 2";
case VerifiedBot:
case UserData::EFlags::VerifiedBot:
return "Verified Bot";
case EarlyVerifiedBotDeveloper:
case UserData::EFlags::EarlyVerifiedBotDeveloper:
return "Early Verified Bot Developer";
case CertifiedModerator:
case UserData::EFlags::CertifiedModerator:
return "Discord Certified Moderator";
default:
return "";
Expand Down
3 changes: 1 addition & 2 deletions src/discord/user.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ enum class EPremiumType {
};

struct UserData {
// todo: enum class? (for consistencys sake)
enum {
enum class EFlags : uint64_t {
DiscordEmployee = 1 << 0,
PartneredServerOwner = 1 << 1,
HypeSquadEvents = 1 << 2,
Expand Down
5 changes: 3 additions & 2 deletions src/windows/profilewindow.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "profilewindow.hpp"

#include "abaddon.hpp"
#include "discord/user.hpp"
#include "util.hpp"

ProfileWindow::ProfileWindow(Snowflake user_id)
Expand Down Expand Up @@ -116,13 +117,13 @@ void ProfileWindow::OnFetchProfile(const UserProfileData &data) {

if (!data.User.PublicFlags.has_value()) return;
const auto x = *data.User.PublicFlags;
for (uint64_t i = 1; i <= UserData::MaxFlag; i <<= 1) {
for (uint64_t i = 1; i <= static_cast<uint64_t>(UserData::EFlags::MaxFlag); i <<= 1) {
if (!(x & i)) continue;
const std::string name = UserData::GetFlagName(i);
if (name == "unknown") continue;
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
try {
if (name == "verifiedbot")
if (i == static_cast<uint64_t>(UserData::EFlags::VerifiedBot))
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/checkmark.png"), 24, 24);
else
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/" + name + ".png"), 24, 24);
Expand Down

0 comments on commit 0186507

Please sign in to comment.