2018-11-29 23:54:50 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 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_MEMBERS_H
|
|
|
|
|
|
|
|
/// Interface to the members of a room.
|
|
|
|
///
|
|
|
|
/// This interface focuses specifically on room membership and its routines
|
|
|
|
/// are optimized for this area of room functionality.
|
|
|
|
///
|
|
|
|
struct ircd::m::room::members
|
|
|
|
{
|
2019-07-24 04:31:40 +02:00
|
|
|
using closure_idx = std::function<bool (const id::user &, const event::idx &)>;
|
|
|
|
using closure = std::function<bool (const id::user &)>;
|
|
|
|
|
2018-11-29 23:54:50 +01:00
|
|
|
m::room room;
|
|
|
|
|
2020-06-15 05:03:51 +02:00
|
|
|
bool for_each_join_present(const string_view &host, const closure_idx &) const;
|
2019-09-08 01:26:51 +02:00
|
|
|
|
|
|
|
public:
|
2019-09-11 19:03:10 +02:00
|
|
|
bool for_each(const string_view &membership, const string_view &host, const closure &) const;
|
|
|
|
bool for_each(const string_view &membership, const string_view &host, const closure_idx &) const;
|
2019-07-24 04:31:40 +02:00
|
|
|
bool for_each(const string_view &membership, const closure &) const;
|
|
|
|
bool for_each(const string_view &membership, const closure_idx &) const;
|
|
|
|
bool for_each(const closure &) const;
|
|
|
|
bool for_each(const closure_idx &) const;
|
2018-11-29 23:54:50 +01:00
|
|
|
|
2019-09-11 19:03:10 +02:00
|
|
|
bool empty(const string_view &membership, const string_view &host) const;
|
2019-07-19 22:56:08 +02:00
|
|
|
bool empty(const string_view &membership) const;
|
|
|
|
bool empty() const;
|
|
|
|
|
2019-09-11 19:03:10 +02:00
|
|
|
size_t count(const string_view &membership, const string_view &host) const;
|
2018-11-29 23:54:50 +01:00
|
|
|
size_t count(const string_view &membership) const;
|
|
|
|
size_t count() const;
|
|
|
|
|
|
|
|
members(const m::room &room)
|
|
|
|
:room{room}
|
|
|
|
{}
|
|
|
|
};
|