0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd:Ⓜ️ Cleanup cruft from m::room; comments; minor.

This commit is contained in:
Jason Volk 2018-02-13 14:23:56 -08:00
parent ad56d381a5
commit 6f0ca19df6
2 changed files with 13 additions and 17 deletions

View file

@ -21,7 +21,10 @@ namespace ircd::m
struct room;
// Util
bool my(const room &);
// [GET] Util
bool exists(const id::room &);
// [GET] Current Event suite (non-locking) (one)
@ -65,11 +68,11 @@ namespace ircd::m
/// This object allows the programmer to represent the room either at its
/// present state, or if an event_id is given, at the point of that event.
///
/// Many convenience functions are provided outside of this class to
/// accomplish general tasks using rooms in one statement. Additionally,
/// several sub-classes provide functionality even more specific than this
/// interface too. If a subclass is provided, for example: `struct members`,
/// such an interface may employ optimized tactics for its specific task.
/// Many convenience functions are provided outside of this class.
/// Additionally, several sub-classes provide functionality even more specific
/// than this interface too. If a subclass is provided, for example:
/// `struct members`, such an interface may employ optimized tactics for its
/// specific task.
///
struct ircd::m::room
{

View file

@ -100,13 +100,6 @@ ircd::m::membership(const room &room,
{ content, { "membership", membership }},
};
/*
if(this->membership(user_id, membership))
throw m::ALREADY_MEMBER
{
"Member '%s' is already '%s'.", string_view{user_id}, membership
};
*/
return commit(room, event, content);
}
@ -331,12 +324,12 @@ ircd::m::room::membership(const m::id::user &user_id,
const
{
bool ret{false};
static const string_view type{"m.room.member"};
state{*this}.get(std::nothrow, type, user_id, [&membership, &ret]
const state state{*this};
state.get(std::nothrow, "m.room.member"_sv, user_id, [&membership, &ret]
(const m::event &event)
{
assert(json::get<"type"_>(event) == "m.room.member");
ret = at<"membership"_>(event) == membership;
ret = unquote(at<"membership"_>(event)) == membership;
});
return ret;
@ -616,7 +609,7 @@ const
for_each(event::id::closure{[&event, &closure]
(const event::id &event_id)
{
if(seek(event, unquote(event_id), std::nothrow))
if(seek(event, event_id, std::nothrow))
closure(event);
}});
}
@ -641,7 +634,7 @@ const
for_each(type, event::id::closure{[&event, &closure]
(const event::id &event_id)
{
if(seek(event, unquote(event_id), std::nothrow))
if(seek(event, event_id, std::nothrow))
closure(event);
}});
}