0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 06:28:55 +02:00

modules: Add join rules hook stub; remove remaining tmp_effects from vm.

This commit is contained in:
Jason Volk 2018-05-12 20:22:22 -07:00
parent 385e08cd62
commit e2e8172bfd
3 changed files with 53 additions and 21 deletions

View file

@ -83,6 +83,7 @@ m_receipt_la_SOURCES = m_receipt.cc
m_presence_la_SOURCES = m_presence.cc
m_room_create_la_SOURCES = m_room_create.cc
m_room_member_la_SOURCES = m_room_member.cc
m_room_join_rules_la_SOURCES = m_room_join_rules.cc
m_module_LTLIBRARIES = \
m_noop.la \
@ -91,6 +92,7 @@ m_module_LTLIBRARIES = \
m_presence.la \
m_room_create.la \
m_room_member.la \
m_room_join_rules.la \
###
###############################################################################

View file

@ -0,0 +1,51 @@
// 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.
using namespace ircd;
mapi::header
IRCD_MODULE
{
"Matrix m.room.join_rules"
};
static void
_changed_rules(const m::event &event)
{
const m::user::id &sender
{
at<"sender"_>(event)
};
if(!my(sender))
return;
const m::room::id::buf public_room
{
"public", my_host()
};
const m::room::id &room_id
{
at<"room_id"_>(event)
};
send(public_room, sender, "ircd.room", room_id, json::strung{event});
}
const m::hook
_changed_rules_hookfn
{
_changed_rules,
{
{ "_site", "vm.notify" },
{ "type", "m.room.join_rules" },
}
};

View file

@ -15,7 +15,6 @@ namespace ircd::m::vm
extern hook::site eval_hook;
extern hook::site notify_hook;
static void _tmp_effects(const m::event &event); //TODO: X
static void write(eval &);
static fault _eval_edu(eval &, const event &);
static fault _eval_pdu(eval &, const event &);
@ -451,9 +450,6 @@ try
if(opts.notify)
vm::accept(accepted);
if(opts.effects)
_tmp_effects(event);
if(opts.debuglog_accept)
log.debug("%s", pretty_oneline(event));
@ -733,20 +729,3 @@ ircd::m::vm::retired_sequence(event::id::buf &event_id)
event_id = it->second;
return ret;
}
//TODO: X
void
ircd::m::vm::_tmp_effects(const m::event &event)
{
const auto &type{at<"type"_>(event)};
//TODO: X
if(type == "m.room.join_rules")
{
const m::room::id room_id{at<"room_id"_>(event)};
const m::user::id sender{at<"sender"_>(event)};
if(my_host(sender.host()))
send(room::id{"!public:zemos.net"}, sender, "ircd.room", room_id, {});
}
}