mirror of
https://github.com/matrix-construct/construct
synced 2024-11-12 13:01:07 +01:00
modules/client/devices: Use the id::device; use the user::room.
This commit is contained in:
parent
f7db9bd92f
commit
c6855c58c3
1 changed files with 9 additions and 39 deletions
|
@ -66,27 +66,17 @@ resource::response
|
||||||
get__devices(client &client,
|
get__devices(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
const m::user user
|
const m::user::room user_room
|
||||||
{
|
{
|
||||||
request.user_id
|
request.user_id
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::room::id::buf user_room_id
|
|
||||||
{
|
|
||||||
user.room_id()
|
|
||||||
};
|
|
||||||
|
|
||||||
const m::room user_room
|
|
||||||
{
|
|
||||||
user_room_id
|
|
||||||
};
|
|
||||||
|
|
||||||
if(request.parv.size() < 1)
|
if(request.parv.size() < 1)
|
||||||
return get__devices_all(client, request, user_room);
|
return get__devices_all(client, request, user_room);
|
||||||
|
|
||||||
const string_view &device_id
|
m::id::device::buf device_id
|
||||||
{
|
{
|
||||||
request.parv[1]
|
url::decode(request.parv[1], device_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
user_room.get("ircd.device", device_id, [&]
|
user_room.get("ircd.device", device_id, [&]
|
||||||
|
@ -120,24 +110,14 @@ put__devices(client &client,
|
||||||
"device_id required"
|
"device_id required"
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::user user
|
const m::user::room user_room
|
||||||
{
|
{
|
||||||
request.user_id
|
request.user_id
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::room::id::buf user_room_id
|
m::id::device::buf device_id
|
||||||
{
|
{
|
||||||
user.room_id()
|
url::decode(request.parv[1], device_id)
|
||||||
};
|
|
||||||
|
|
||||||
const m::room user_room
|
|
||||||
{
|
|
||||||
user_room_id
|
|
||||||
};
|
|
||||||
|
|
||||||
const string_view &device_id
|
|
||||||
{
|
|
||||||
request.parv[1]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
user_room.get("ircd.device", device_id, [&]
|
user_room.get("ircd.device", device_id, [&]
|
||||||
|
@ -179,24 +159,14 @@ delete__devices(client &client,
|
||||||
"device_id required"
|
"device_id required"
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::user user
|
const m::user::room user_room
|
||||||
{
|
{
|
||||||
request.user_id
|
request.user_id
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::room::id::buf user_room_id
|
m::id::device::buf device_id
|
||||||
{
|
{
|
||||||
user.room_id()
|
url::decode(request.parv[1], device_id)
|
||||||
};
|
|
||||||
|
|
||||||
const m::room user_room
|
|
||||||
{
|
|
||||||
user_room_id
|
|
||||||
};
|
|
||||||
|
|
||||||
const string_view &device_id
|
|
||||||
{
|
|
||||||
request.parv[1]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!user_room.has("ircd.device", device_id))
|
if(!user_room.has("ircd.device", device_id))
|
||||||
|
|
Loading…
Reference in a new issue