0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-04 06:38:58 +02:00

ircd:Ⓜ️ Modularize the user::activate/user::deactivate definitions.

This commit is contained in:
Jason Volk 2018-03-05 03:42:41 -08:00
parent b3816f3bfa
commit f8dc84d46e
4 changed files with 33 additions and 14 deletions

View file

@ -36,11 +36,11 @@ struct ircd::m::user
id::room room_id(const mutable_buffer &) const; id::room room_id(const mutable_buffer &) const;
id::room::buf room_id() const; id::room::buf room_id() const;
bool is_active() const;
bool is_password(const string_view &password) const noexcept; bool is_password(const string_view &password) const noexcept;
void password(const string_view &password); void password(const string_view &password);
void deactivate(const json::members &contents = {});
bool is_active() const;
event::id::buf deactivate(const json::members &contents = {});
event::id::buf activate(const json::members &contents = {}); event::id::buf activate(const json::members &contents = {});
user(const id &user_id) user(const id &user_id)

View file

@ -338,18 +338,35 @@ ircd::m::presence::valid_state(const string_view &state)
return function(state); return function(state);
} }
///////////////////////////////////////////////////////////////////////////////
//
// m/user.h
//
ircd::m::event::id::buf ircd::m::event::id::buf
ircd::m::user::presence(const string_view &presence, ircd::m::user::activate(const json::members &contents)
const string_view &status_msg)
{ {
using prototype = event::id::buf (const id &, const string_view &, const string_view &); using prototype = event::id::buf (const m::user &, const json::members &);
static import<prototype> function static import<prototype> function
{ {
"client_presence", "set__user_presence_status" "client_register", "register__user"
}; };
return function(user_id, presence, status_msg); return function(*this, contents);
}
ircd::m::event::id::buf
ircd::m::user::deactivate(const json::members &contents)
{
using prototype = event::id::buf (const m::user &, const json::members &);
static import<prototype> function
{
"client_account", "deactivate__user"
};
return function(*this, contents);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View file

@ -60,12 +60,6 @@ ircd::m::my(const user &user)
return my(user.user_id); return my(user.user_id);
} }
void
ircd::m::user::deactivate(const json::members &contents)
{
//TODO: XXX
}
void void
ircd::m::user::password(const string_view &password) ircd::m::user::password(const string_view &password)
try try

View file

@ -59,3 +59,11 @@ post_deactivate
post_deactivate.REQUIRES_AUTH post_deactivate.REQUIRES_AUTH
} }
}; };
extern "C" m::event::id::buf
deactivate__user(const m::user &user,
const json::members &)
{
//TODO: XXX
return {};
}