2019-03-14 21:02:27 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2019 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.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_M_USER_USER_H
|
|
|
|
|
2019-07-11 21:57:11 +02:00
|
|
|
namespace ircd::m
|
|
|
|
{
|
|
|
|
struct user;
|
|
|
|
|
|
|
|
bool my(const user &);
|
|
|
|
bool exists(const user &);
|
|
|
|
bool exists(const id::user &);
|
|
|
|
|
|
|
|
user create(const id::user &, const json::members &args = {});
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This lightweight object is the strong type for a user.
|
|
|
|
///
|
|
|
|
/// Instances of this object are used as an argument in many places. The
|
|
|
|
/// sub-objects form special interfaces for the core tools and features
|
|
|
|
/// related to users. Not all user-related features are nested here,
|
|
|
|
/// only fundamentals which are generally used further by other features.
|
2019-03-14 21:02:27 +01:00
|
|
|
struct ircd::m::user
|
|
|
|
{
|
|
|
|
struct room;
|
|
|
|
struct rooms;
|
|
|
|
struct mitsein;
|
2019-08-17 11:21:53 +02:00
|
|
|
struct servers;
|
2019-03-14 21:02:27 +01:00
|
|
|
struct events;
|
|
|
|
struct profile;
|
|
|
|
struct account_data;
|
|
|
|
struct room_account_data;
|
|
|
|
struct room_tags;
|
|
|
|
struct filter;
|
2019-03-15 01:07:16 +01:00
|
|
|
struct ignores;
|
2019-06-27 10:18:23 +02:00
|
|
|
struct highlight;
|
2019-09-25 20:01:05 +02:00
|
|
|
struct registar;
|
2019-03-14 21:02:27 +01:00
|
|
|
|
|
|
|
using id = m::id::user;
|
|
|
|
using closure = std::function<void (const user &)>;
|
|
|
|
using closure_bool = std::function<bool (const user &)>;
|
|
|
|
|
|
|
|
static m::room tokens;
|
|
|
|
|
|
|
|
id user_id;
|
|
|
|
|
|
|
|
operator const id &() const;
|
|
|
|
|
|
|
|
static string_view gen_access_token(const mutable_buffer &out);
|
|
|
|
static id::device::buf get_device_from_access_token(const string_view &token);
|
|
|
|
|
|
|
|
id::room room_id(const mutable_buffer &) const;
|
|
|
|
id::room::buf room_id() const;
|
|
|
|
|
|
|
|
bool is_password(const string_view &password) const noexcept;
|
|
|
|
event::id::buf password(const string_view &password);
|
|
|
|
|
|
|
|
bool is_active() const;
|
|
|
|
event::id::buf deactivate();
|
|
|
|
event::id::buf activate();
|
|
|
|
|
|
|
|
user(const id &user_id)
|
|
|
|
:user_id{user_id}
|
|
|
|
{}
|
|
|
|
|
|
|
|
user() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline ircd::m::user::operator
|
|
|
|
const ircd::m::user::id &()
|
|
|
|
const
|
|
|
|
{
|
|
|
|
return user_id;
|
|
|
|
}
|
2019-07-11 21:57:11 +02:00
|
|
|
|
|
|
|
#include "room.h"
|
|
|
|
#include "rooms.h"
|
|
|
|
#include "mitsein.h"
|
2019-08-17 11:21:53 +02:00
|
|
|
#include "servers.h"
|
2019-07-11 21:57:11 +02:00
|
|
|
#include "events.h"
|
|
|
|
#include "profile.h"
|
|
|
|
#include "account_data.h"
|
|
|
|
#include "room_account_data.h"
|
|
|
|
#include "room_tags.h"
|
|
|
|
#include "filter.h"
|
|
|
|
#include "ignores.h"
|
|
|
|
#include "highlight.h"
|
2019-09-25 20:01:05 +02:00
|
|
|
#include "register.h"
|