0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-30 17:34:04 +01:00

ircd:Ⓜ️ Move event/append header.

This commit is contained in:
Jason Volk 2019-07-16 12:39:16 -07:00
parent ad7c6980ac
commit ef1f6f2642
4 changed files with 26 additions and 3 deletions

View file

@ -1,7 +1,7 @@
// Matrix Construct // Matrix Construct
// //
// Copyright (C) Matrix Construct Developers, Authors & Contributors // Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net> // Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
@ -9,7 +9,7 @@
// full license for this software is available in the LICENSE file. // full license for this software is available in the LICENSE file.
#pragma once #pragma once
#define HAVE_IRCD_M_EVENT_APPEND #define HAVE_IRCD_M_APPEND
namespace ircd::m namespace ircd::m
{ {

View file

@ -156,7 +156,6 @@ struct ircd::m::event
#include "cached.h" #include "cached.h"
#include "prefetch.h" #include "prefetch.h"
#include "conforms.h" #include "conforms.h"
#include "append.h"
#include "pretty.h" #include "pretty.h"
inline ircd::m::event::operator inline ircd::m::event::operator

View file

@ -79,6 +79,7 @@ namespace ircd::m
#include "sync.h" #include "sync.h"
#include "fetch.h" #include "fetch.h"
#include "breadcrumb_rooms.h" #include "breadcrumb_rooms.h"
#include "append.h"
struct ircd::m::init struct ircd::m::init
{ {

View file

@ -415,6 +415,29 @@ ircd::m::append(json::stack::object &object,
}; };
#endif #endif
if(opts.user_id && !visible(event, *opts.user_id))
{
log::debug
{
log, "Not sending event '%s' because not visible by '%s'",
string_view{event.event_id},
string_view{*opts.user_id}
};
return;
}
if(!json::get<"state_key"_>(event) && has_event_idx && m::redacted(*opts.event_idx))
{
log::debug
{
log, "Not sending event '%s' because redacted.",
string_view{event.event_id},
};
return;
}
if(!json::get<"state_key"_>(event) && has_user) if(!json::get<"state_key"_>(event) && has_user)
{ {
const m::user::ignores ignores{*opts.user_id}; const m::user::ignores ignores{*opts.user_id};