From f8dc84d46ea0aec83c77beebeb723812a945b4fa Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 5 Mar 2018 03:42:41 -0800 Subject: [PATCH] ircd::m: Modularize the user::activate/user::deactivate definitions. --- include/ircd/m/user.h | 6 +++--- ircd/m/m.cc | 27 ++++++++++++++++++++++----- ircd/m/user.cc | 6 ------ modules/client/account/deactivate.cc | 8 ++++++++ 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/include/ircd/m/user.h b/include/ircd/m/user.h index 47eeb53d8..d7f959e38 100644 --- a/include/ircd/m/user.h +++ b/include/ircd/m/user.h @@ -36,11 +36,11 @@ struct ircd::m::user id::room room_id(const mutable_buffer &) const; id::room::buf room_id() const; - bool is_active() const; bool is_password(const string_view &password) const noexcept; - 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 = {}); user(const id &user_id) diff --git a/ircd/m/m.cc b/ircd/m/m.cc index 7b4c58816..0a51abb81 100644 --- a/ircd/m/m.cc +++ b/ircd/m/m.cc @@ -338,18 +338,35 @@ ircd::m::presence::valid_state(const string_view &state) return function(state); } +/////////////////////////////////////////////////////////////////////////////// +// +// m/user.h +// + ircd::m::event::id::buf -ircd::m::user::presence(const string_view &presence, - const string_view &status_msg) +ircd::m::user::activate(const json::members &contents) { - 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 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 function + { + "client_account", "deactivate__user" + }; + + return function(*this, contents); } /////////////////////////////////////////////////////////////////////////////// diff --git a/ircd/m/user.cc b/ircd/m/user.cc index dc78b01ee..73c6b7522 100644 --- a/ircd/m/user.cc +++ b/ircd/m/user.cc @@ -60,12 +60,6 @@ ircd::m::my(const user &user) return my(user.user_id); } -void -ircd::m::user::deactivate(const json::members &contents) -{ - //TODO: XXX -} - void ircd::m::user::password(const string_view &password) try diff --git a/modules/client/account/deactivate.cc b/modules/client/account/deactivate.cc index 80e6ec31f..bc533d755 100644 --- a/modules/client/account/deactivate.cc +++ b/modules/client/account/deactivate.cc @@ -59,3 +59,11 @@ post_deactivate post_deactivate.REQUIRES_AUTH } }; + +extern "C" m::event::id::buf +deactivate__user(const m::user &user, + const json::members &) +{ + //TODO: XXX + return {}; +}