2018-10-23 22:26:57 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 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_USERS_H
|
|
|
|
|
|
|
|
namespace ircd::m::users
|
|
|
|
{
|
2019-08-13 12:00:08 +02:00
|
|
|
struct opts extern const opts_default;
|
2019-08-12 05:55:58 +02:00
|
|
|
|
|
|
|
// Iterate the users
|
|
|
|
bool for_each(const opts &, const user::closure_bool &);
|
2018-10-23 22:26:57 +02:00
|
|
|
bool for_each(const user::closure_bool &);
|
2019-08-12 05:55:58 +02:00
|
|
|
|
2019-08-13 12:00:08 +02:00
|
|
|
size_t count(const opts & = opts_default);
|
|
|
|
bool exists(const opts & = opts_default);
|
2018-10-23 22:26:57 +02:00
|
|
|
}
|
2019-08-12 05:55:58 +02:00
|
|
|
|
|
|
|
/// Shape the query by matching users based on the options filled in.
|
|
|
|
struct ircd::m::users::opts
|
|
|
|
{
|
|
|
|
/// Fill this in to match the localpart of an mxid. If this is empty then
|
|
|
|
/// all localparts can be matched.
|
|
|
|
string_view localpart;
|
|
|
|
|
|
|
|
/// The results match if their localpart startswith the specified localpart.
|
|
|
|
bool localpart_prefix {false};
|
|
|
|
|
|
|
|
/// Fill this in to match the hostpart of an mxid, i.e the origin. If this
|
|
|
|
/// is empty then all servers can be matched.
|
|
|
|
string_view hostpart;
|
|
|
|
|
|
|
|
/// The results match if their hostpart startswith the specified hostpart
|
|
|
|
bool hostpart_prefix {false};
|
|
|
|
|
|
|
|
/// Construction from a single string; decomposes into the options
|
|
|
|
/// based on ad hoc rules, see definition or use default ctor.
|
|
|
|
opts(const string_view &query);
|
|
|
|
opts() = default;
|
|
|
|
};
|