0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-27 01:02:46 +01:00
construct/include/ircd/m/user/highlight.h

43 lines
1.4 KiB
C++

// 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_HIGHLIGHT_H
/// Interface to user highlighting and counting.
struct ircd::m::user::highlight
{
static conf::item<bool> enable_count;
static conf::item<bool> match_mxid_full;
static conf::item<bool> match_mxid_local_cs;
static conf::item<bool> match_mxid_local_ci;
static conf::item<bool> match_at_room;
static bool imatch(const string_view &text, const string_view &arg);
static bool match(const string_view &text, const string_view &arg);
m::user user;
public:
bool match(const string_view &text) const;
bool has(const event &) const;
bool has(const event::idx &) const;
bool for_each(const m::room &, const event::idx_range &, const event::closure_idx_bool &) const;
size_t count_between(const m::room &, const event::idx_range &) const;
size_t count_to(const m::room &, const event::idx &) const;
size_t count(const m::room &) const;
size_t count() const;
highlight(const m::user &user)
noexcept
:user{user}
{}
};