From 135798c8ab1a4a7da67384ac20083c437d78f65e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 1 Apr 2020 12:09:13 -0700 Subject: [PATCH] ircd::m::device: Reduce/reuse codepath to set property to value. --- matrix/device.cc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/matrix/device.cc b/matrix/device.cc index f8aa48f66..163d9fc92 100644 --- a/matrix/device.cc +++ b/matrix/device.cc @@ -50,28 +50,18 @@ bool ircd::m::device::set(const m::user &user, const device &device) { - const user::room user_room{user}; const string_view &device_id { json::at<"device_id"_>(device) }; - json::for_each(device, [&user, &user_room, &device_id] + json::for_each(device, [&user, &device_id] (const auto &prop, auto &&val) { if(!json::defined(json::value(val))) return; - char buf[m::event::TYPE_MAX_SIZE]; - const string_view type{fmt::sprintf - { - buf, "ircd.device.%s", prop - }}; - - m::send(user_room, user, type, device_id, json::members - { - { "", val } - }); + set(user, device_id, prop, val); }); return true;