1
0
forked from blue/squawk
squawk/shared/enums.h
2024-12-14 01:53:04 +02:00

180 lines
4.8 KiB
C++

/*
* Squawk messenger.
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <deque>
#include <QString>
#include <QObject>
namespace Shared {
Q_NAMESPACE
enum class ConnectionState {
disconnected,
scheduled,
connecting,
connected,
error
};
Q_ENUM_NS(ConnectionState)
static const std::deque<QString> connectionStateThemeIcons = {"state-offline", "state-sync", "state-sync", "state-ok", "state-error"};
static const ConnectionState ConnectionStateHighest = ConnectionState::error;
static const ConnectionState ConnectionStateLowest = ConnectionState::disconnected;
enum class Availability {
online,
away,
extendedAway,
busy,
chatty,
invisible,
offline
};
Q_ENUM_NS(Availability)
static const Availability AvailabilityHighest = Availability::offline;
static const Availability AvailabilityLowest = Availability::online;
static const std::deque<QString> availabilityThemeIcons = {
"user-online",
"user-away",
"user-away-extended",
"user-busy",
"chatty",
"user-invisible",
"user-offline"
};
enum class SubscriptionState {
none,
from,
to,
both,
unknown
};
Q_ENUM_NS(SubscriptionState)
static const SubscriptionState SubscriptionStateHighest = SubscriptionState::unknown;
static const SubscriptionState SubscriptionStateLowest = SubscriptionState::none;
static const std::deque<QString> subscriptionStateThemeIcons = {"edit-none", "arrow-down-double", "arrow-up-double", "dialog-ok", "question"};
enum class Affiliation {
unspecified,
outcast,
nobody,
member,
admin,
owner
};
Q_ENUM_NS(Affiliation)
static const Affiliation AffiliationHighest = Affiliation::owner;
static const Affiliation AffiliationLowest = Affiliation::unspecified;
enum class Role {
unspecified,
nobody,
visitor,
participant,
moderator
};
Q_ENUM_NS(Role)
static const Role RoleHighest = Role::moderator;
static const Role RoleLowest = Role::unspecified;
enum class Avatar {
empty,
autocreated,
valid
};
Q_ENUM_NS(Avatar)
static const Avatar AvatarHighest = Avatar::valid;
static const Avatar AvatarLowest = Avatar::empty;
static const std::deque<QString> messageStateThemeIcons = {"state-offline", "state-sync", "state-ok", "state-error"};
enum class AccountPassword {
plain,
jammed,
alwaysAsk,
kwallet
};
Q_ENUM_NS(AccountPassword)
static const AccountPassword AccountPasswordHighest = AccountPassword::kwallet;
static const AccountPassword AccountPasswordLowest = AccountPassword::plain;
enum class EntryType {
none,
ownAccount,
contact,
conference,
presence,
participant
};
Q_ENUM_NS(EntryType)
static const EntryType EntryTypeHighest = EntryType::participant;
static const EntryType EntryTypeLowest = EntryType::none;
enum class Support {
unknown,
supported,
unsupported
};
Q_ENUM_NS(Support)
enum class Possible {
unknown,
discovering,
present,
abscent
};
Q_ENUM_NS(Possible)
enum class TrustLevel {
/// The key's trust is not decided.
undecided,
/// The key is automatically distrusted (e.g., by the security policy TOAKAFA).
/// \see SecurityPolicy
automaticallyDistrusted,
/// The key is manually distrusted (e.g., by clicking a button or \xep{0450, Automatic Trust
/// Management (ATM)}).
manuallyDistrusted,
/// The key is automatically trusted (e.g., by the client for all keys of a bare JID until one
/// of it is authenticated).
automaticallyTrusted,
/// The key is manually trusted (e.g., by clicking a button).
manuallyTrusted,
/// The key is authenticated (e.g., by QR code scanning or \xep{0450, Automatic Trust
/// Management (ATM)}).
authenticated
};
Q_ENUM_NS(TrustLevel)
static const TrustLevel TrustLevelHighest = TrustLevel::undecided;
static const TrustLevel TrustLevelLowest = TrustLevel::authenticated;
enum class EncryptionProtocol {
none,
omemo,
omemo1,
omemo2
};
Q_ENUM_NS(EncryptionProtocol)
static const EncryptionProtocol EncryptionProtocolHighest = EncryptionProtocol::none;
static const EncryptionProtocol EncryptionProtocolLowest = EncryptionProtocol::omemo2;
}