2018-03-04 13:28:36 +01: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_PRESENCE_H
|
|
|
|
|
|
|
|
namespace ircd::m
|
|
|
|
{
|
2018-03-04 16:15:50 +01:00
|
|
|
struct presence;
|
2018-03-04 13:28:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
|
|
|
|
struct ircd::m::edu::m_presence
|
|
|
|
:json::tuple
|
|
|
|
<
|
|
|
|
json::property<name::user_id, json::string>,
|
|
|
|
json::property<name::presence, json::string>,
|
2018-03-04 16:15:50 +01:00
|
|
|
json::property<name::status_msg, json::string>,
|
2018-03-04 13:28:36 +01:00
|
|
|
json::property<name::last_active_ago, time_t>,
|
|
|
|
json::property<name::currently_active, bool>
|
|
|
|
>
|
|
|
|
{
|
|
|
|
using super_type::tuple;
|
|
|
|
using super_type::operator=;
|
|
|
|
};
|
|
|
|
#pragma GCC diagnostic pop
|
2018-03-04 16:15:50 +01:00
|
|
|
|
|
|
|
struct ircd::m::presence
|
|
|
|
:edu::m_presence
|
|
|
|
{
|
2018-04-12 01:24:49 +02:00
|
|
|
using closure = std::function<void (const json::object &)>;
|
2018-04-28 00:26:17 +02:00
|
|
|
using event_closure = std::function<void (const m::event &, const json::object &)>;
|
2018-04-12 01:24:49 +02:00
|
|
|
|
2018-03-04 16:15:50 +01:00
|
|
|
static bool valid_state(const string_view &state);
|
2018-04-28 00:26:17 +02:00
|
|
|
static void get(const user &, const event_closure &);
|
2018-04-12 01:24:49 +02:00
|
|
|
static void get(const user &, const closure &);
|
2018-04-28 00:26:17 +02:00
|
|
|
static bool get(std::nothrow_t, const user &, const event_closure &);
|
2018-04-12 01:24:49 +02:00
|
|
|
static bool get(std::nothrow_t, const user &, const closure &);
|
2018-03-04 16:15:50 +01:00
|
|
|
static json::object get(const user &, const mutable_buffer &);
|
|
|
|
static event::id::buf set(const presence &);
|
|
|
|
static event::id::buf set(const user &, const string_view &, const string_view &status = {});
|
|
|
|
|
|
|
|
presence(const user &, const mutable_buffer &);
|
|
|
|
|
|
|
|
using edu::m_presence::m_presence;
|
|
|
|
};
|