0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd:Ⓜ️:rooms: Simplify interface.

This commit is contained in:
Jason Volk 2019-06-17 16:57:00 -07:00
parent 160927e119
commit f24c7c2e82
2 changed files with 0 additions and 40 deletions

View file

@ -38,13 +38,6 @@ namespace ircd::m::rooms
/// the only options patterns.
struct ircd::m::rooms::each_opts
{
/// If set: select rooms for this user.
m::user user;
/// If user is set, and this is set: select the membership that user
/// has in the room.
string_view membership;
/// If set, seek to this room_id or lower-bound to the closest room_id.
string_view key;
@ -58,13 +51,8 @@ struct ircd::m::rooms::each_opts
/// for-each protocol: return true to continue, false to break.
room::id::closure_bool closure;
/// Alternative closure when selecting a user.
user::rooms::closure_bool user_closure;
each_opts(room::id::closure_bool);
each_opts(const string_view &key, room::id::closure_bool);
each_opts(const m::user &user, user::rooms::closure_bool);
each_opts(const m::user &user, const string_view &membership, user::rooms::closure_bool);
each_opts() = default;
};
@ -80,22 +68,6 @@ ircd::m::rooms::each_opts::each_opts(const string_view &key,
,closure{std::move(closure)}
{}
inline
ircd::m::rooms::each_opts::each_opts(const m::user &user,
user::rooms::closure_bool user_closure)
:user{user}
,user_closure{std::move(user_closure)}
{}
inline
ircd::m::rooms::each_opts::each_opts(const m::user &user,
const string_view &membership,
user::rooms::closure_bool user_closure)
:user{user}
,membership{membership}
,user_closure{std::move(user_closure)}
{}
template<class... args>
bool
ircd::m::rooms::for_each(args&&... a)

View file

@ -60,18 +60,6 @@ bool
IRCD_MODULE_EXPORT
ircd::m::rooms::for_each(const each_opts &opts)
{
if(opts.user.user_id)
{
const m::user::rooms rooms{opts.user};
return rooms.for_each(opts.membership, m::user::rooms::closure_bool{[&opts]
(const m::room &room, const string_view &membership)
{
return opts.user_closure?
opts.user_closure(room, membership):
opts.closure(room.room_id);
}});
}
if(opts.public_rooms)
return _for_each_public(opts.key, opts.closure);