0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-30 02:32:43 +01:00
construct/include/ircd/m/room/messages.h

57 lines
1.3 KiB
C++

// The Construct
//
// Copyright (C) The Construct Developers, Authors & Contributors
// Copyright (C) 2016-2022 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_ROOM_MESSAGES_H
namespace ircd::m
{
/// Returns `true` if `msg` reassigned with content from fetched `buf`.
bool replace(room::message &msg, event::fetch &buf, const event::idx &);
}
/// Rendering
///
struct ircd::m::room::messages
{
using closure = util::function_bool
<
const message &, const uint64_t &, const event::idx &
>;
static const event::fetch::opts fopts;
room::type events;
bool redacted {false};
public:
bool for_each(const closure &) const;
messages(const m::room &,
const decltype(room::type::range) & = { -1UL, -1L },
const bool redacted = false);
};
inline
ircd::m::room::messages::messages(const m::room &room,
const decltype(room::type::range) &range,
const bool redacted)
:events
{
room.room_id,
"m.room.message",
range,
false,
}
,redacted
{
redacted
}
{}