2019-07-16 19:38:25 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_M_REDACTED_H
|
|
|
|
|
|
|
|
namespace ircd::m
|
|
|
|
{
|
|
|
|
struct redacted;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ircd::m::redacted
|
2023-02-10 03:07:45 +01:00
|
|
|
:returns<bool>
|
2019-07-16 19:38:25 +02:00
|
|
|
{
|
|
|
|
redacted(const event::idx &);
|
|
|
|
redacted(const event::id &);
|
|
|
|
explicit redacted(const event &);
|
2019-09-18 03:40:11 +02:00
|
|
|
|
|
|
|
static bool prefetch(const event::idx &);
|
2019-07-16 19:38:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline
|
|
|
|
ircd::m::redacted::redacted(const event &event)
|
|
|
|
:redacted
|
|
|
|
{
|
|
|
|
event.event_id
|
|
|
|
}
|
|
|
|
{}
|
|
|
|
|
|
|
|
inline
|
|
|
|
ircd::m::redacted::redacted(const event::id &event_id)
|
|
|
|
:redacted
|
|
|
|
{
|
2020-04-02 01:12:41 +02:00
|
|
|
index(std::nothrow, event_id)
|
2019-07-16 19:38:25 +02:00
|
|
|
}
|
|
|
|
{}
|
2019-09-27 04:28:25 +02:00
|
|
|
|
|
|
|
inline
|
|
|
|
ircd::m::redacted::redacted(const event::idx &event_idx)
|
2023-02-10 03:07:45 +01:00
|
|
|
:returns<bool>
|
2019-09-27 04:28:25 +02:00
|
|
|
{
|
|
|
|
event_idx?
|
|
|
|
event::refs(event_idx).has(dbs::ref::M_ROOM_REDACTION):
|
|
|
|
false
|
|
|
|
}
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool
|
|
|
|
ircd::m::redacted::prefetch(const event::idx &event_idx)
|
|
|
|
{
|
|
|
|
const event::refs refs
|
|
|
|
{
|
|
|
|
event_idx
|
|
|
|
};
|
|
|
|
|
|
|
|
return refs.prefetch(dbs::ref::M_ROOM_REDACTION);
|
|
|
|
}
|