2021-03-05 00:35:15 +01:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2019-12-27 21:49:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <mtx/events/collections.hpp>
|
|
|
|
|
2021-04-17 19:28:04 +02:00
|
|
|
namespace nheko {
|
|
|
|
struct nonesuch
|
|
|
|
{
|
2021-09-18 00:22:33 +02:00
|
|
|
~nonesuch() = delete;
|
|
|
|
nonesuch(nonesuch const &) = delete;
|
|
|
|
void operator=(nonesuch const &) = delete;
|
2021-04-17 19:28:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace detail {
|
|
|
|
template<class Default, class AlwaysVoid, template<class...> class Op, class... Args>
|
|
|
|
struct detector
|
|
|
|
{
|
2021-09-18 00:22:33 +02:00
|
|
|
using value_t = std::false_type;
|
|
|
|
using type = Default;
|
2021-04-17 19:28:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<class Default, template<class...> class Op, class... Args>
|
|
|
|
struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
|
|
|
|
{
|
2021-09-18 00:22:33 +02:00
|
|
|
using value_t = std::true_type;
|
|
|
|
using type = Op<Args...>;
|
2021-04-17 19:28:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace detail
|
|
|
|
}
|
|
|
|
|
2019-12-27 21:49:55 +01:00
|
|
|
namespace mtx::accessors {
|
2021-12-29 07:02:32 +01:00
|
|
|
const std::string &
|
2019-12-27 21:49:55 +01:00
|
|
|
event_id(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
2021-12-29 07:02:32 +01:00
|
|
|
const std::string &
|
2019-12-27 21:49:55 +01:00
|
|
|
room_id(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
2021-12-29 07:02:32 +01:00
|
|
|
const std::string &
|
2019-12-27 21:49:55 +01:00
|
|
|
sender(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
2021-01-31 22:41:43 +01:00
|
|
|
bool
|
|
|
|
is_state_event(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
2019-12-27 21:49:55 +01:00
|
|
|
QDateTime
|
|
|
|
origin_server_ts(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
std::string
|
|
|
|
filename(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
mtx::events::MessageType
|
|
|
|
msg_type(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
std::string
|
|
|
|
room_name(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
std::string
|
|
|
|
room_topic(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
2020-07-24 19:30:12 +02:00
|
|
|
std::string
|
|
|
|
call_type(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
2019-12-27 21:49:55 +01:00
|
|
|
std::string
|
|
|
|
body(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
std::string
|
|
|
|
formatted_body(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
QString
|
|
|
|
formattedBodyWithFallback(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
std::optional<mtx::crypto::EncryptedFile>
|
|
|
|
file(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
std::string
|
|
|
|
url(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
std::string
|
|
|
|
thumbnail_url(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
std::string
|
2020-03-01 19:55:43 +01:00
|
|
|
blurhash(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
std::string
|
2019-12-27 21:49:55 +01:00
|
|
|
mimetype(const mtx::events::collections::TimelineEvents &event);
|
2021-12-29 07:02:32 +01:00
|
|
|
const mtx::common::Relations &
|
2021-01-26 22:36:35 +01:00
|
|
|
relations(const mtx::events::collections::TimelineEvents &event);
|
2021-01-27 16:14:03 +01:00
|
|
|
void
|
|
|
|
set_relations(mtx::events::collections::TimelineEvents &event, mtx::common::Relations relations);
|
2020-07-20 00:42:48 +02:00
|
|
|
std::string
|
2020-02-16 00:20:41 +01:00
|
|
|
transaction_id(const mtx::events::collections::TimelineEvents &event);
|
2019-12-27 21:49:55 +01:00
|
|
|
|
|
|
|
int64_t
|
|
|
|
filesize(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
media_height(const mtx::events::collections::TimelineEvents &event);
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
media_width(const mtx::events::collections::TimelineEvents &event);
|
2020-05-30 16:37:51 +02:00
|
|
|
|
|
|
|
nlohmann::json
|
|
|
|
serialize_event(const mtx::events::collections::TimelineEvents &event);
|
2019-12-27 21:49:55 +01:00
|
|
|
}
|