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:
parent
b3816f3bfa
commit
f8dc84d46e
4 changed files with 33 additions and 14 deletions
|
@ -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)
|
||||||
|
|
27
ircd/m/m.cc
27
ircd/m/m.cc
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 {};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue