0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-03 09:18:19 +02:00

ircd:Ⓜ️ Push user creation out to module.

This commit is contained in:
Jason Volk 2018-03-11 11:16:39 -07:00
parent f11be8a0d8
commit f0b5656fda
4 changed files with 55 additions and 18 deletions

View file

@ -744,27 +744,14 @@ ircd::m::user
ircd::m::create(const id::user &user_id,
const json::members &contents)
{
const m::user user
using prototype = user (const id::user &, const json::members &);
static import<prototype> function
{
user_id
"client_user", "user_create"
};
const m::room::id::buf user_room_id
{
user.room_id()
};
//TODO: ABA
//TODO: TXN
m::room user_room
{
create(user_room_id, m::me.user_id, "user")
};
//TODO: ABA
//TODO: TXN
send(user.users, m::me.user_id, "ircd.user", user.user_id, contents);
return user;
return function(user_id, contents);
}
bool

View file

@ -171,6 +171,7 @@ client_client_user_la_SOURCES = \
client/user/filter.cc \
client/user/account_data.cc \
client/user/rooms.cc \
client/user/create.cc \
client/user/user.cc \
###

View file

@ -0,0 +1,40 @@
// 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.
#include "user.h"
using namespace ircd;
extern "C" m::user
user_create(const m::user::id &user_id,
const json::members &contents)
{
const m::user user
{
user_id
};
const m::room::id::buf user_room_id
{
user.room_id()
};
//TODO: ABA
//TODO: TXN
m::room user_room
{
m::create(user_room_id, m::me.user_id, "user")
};
//TODO: ABA
//TODO: TXN
send(user.users, m::me.user_id, "ircd.user", user.user_id, contents);
return user;
}

View file

@ -54,3 +54,12 @@ ircd::resource::response
put__rooms(ircd::client &client,
const ircd::resource::request &request,
const ircd::m::user::id &user_id);
///////////////////////////////////////////////////////////////////////////////
//
// create.cc
//
extern "C" ircd::m::user
user_create(const ircd::m::user::id &,
const ircd::json::members &);