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 id::user &);
|
2020-04-30 10:03:14 +02:00
|
|
|
bool exists(const user &);
|
2020-05-02 21:27:49 +02:00
|
|
|
bool active(const user &);
|
2020-04-30 10:03:14 +02:00
|
|
|
bool is_oper(const user &);
|
2019-07-11 21:57:11 +02:00
|
|
|
|
2021-01-25 07:01:36 +01:00
|
|
|
id::room::buf viewing(const user &, size_t i = 0);
|
|
|
|
|
2019-07-11 21:57:11 +02:00
|
|
|
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-09-25 20:01:05 +02:00
|
|
|
struct registar;
|
2020-03-18 05:57:44 +01:00
|
|
|
struct pushrules;
|
2020-03-21 19:14:21 +01:00
|
|
|
struct pushers;
|
2020-03-22 03:15:59 +01:00
|
|
|
struct notifications;
|
2020-04-02 02:14:51 +02:00
|
|
|
struct tokens;
|
2020-04-02 03:30:02 +02:00
|
|
|
struct devices;
|
2021-01-25 07:40:11 +01:00
|
|
|
struct reading;
|
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 &)>;
|
|
|
|
|
|
|
|
id user_id;
|
|
|
|
|
|
|
|
operator const id &() const;
|
|
|
|
|
|
|
|
id::room room_id(const mutable_buffer &) const;
|
|
|
|
id::room::buf room_id() const;
|
|
|
|
|
2019-09-28 10:19:25 +02:00
|
|
|
bool is_password(const string_view &password) const;
|
2019-03-14 21:02:27 +01:00
|
|
|
event::id::buf password(const string_view &password);
|
|
|
|
|
|
|
|
event::id::buf deactivate();
|
|
|
|
event::id::buf activate();
|
|
|
|
|
2023-02-15 03:25:53 +01:00
|
|
|
event::id::buf deoper();
|
|
|
|
event::id::buf oper();
|
|
|
|
|
2019-03-14 21:02:27 +01:00
|
|
|
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"
|
2019-09-25 20:01:05 +02:00
|
|
|
#include "register.h"
|
2020-03-18 05:57:44 +01:00
|
|
|
#include "pushrules.h"
|
2020-03-21 19:14:21 +01:00
|
|
|
#include "pushers.h"
|
2020-03-22 03:15:59 +01:00
|
|
|
#include "notifications.h"
|
2020-04-02 02:14:51 +02:00
|
|
|
#include "tokens.h"
|
2020-04-02 03:30:02 +02:00
|
|
|
#include "devices.h"
|
2021-01-25 07:40:11 +01:00
|
|
|
#include "reading.h"
|