0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️ Add edu tuples; improve txn tuple typing.

This commit is contained in:
Jason Volk 2018-03-04 04:28:36 -08:00
parent c7ae8d3f27
commit e2ddeb4190
7 changed files with 151 additions and 4 deletions

35
include/ircd/m/edu.h Normal file
View file

@ -0,0 +1,35 @@
// 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_EDU_H
namespace ircd::m
{
struct edu;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
struct ircd::m::edu
:json::tuple
<
json::property<name::edu_type, json::string>,
json::property<name::content, json::object>
>
{
struct m_presence;
struct m_typing;
struct m_receipt;
using super_type::tuple;
using super_type::operator=;
};
#pragma GCC diagnostic pop

View file

@ -56,6 +56,10 @@ namespace ircd
#include "v1/v1.h"
#include "vm.h"
#include "keys.h"
#include "edu.h"
#include "presence.h"
#include "typing.h"
#include "receipt.h"
#include "txn.h"
#include "hook.h"

View file

@ -88,4 +88,16 @@ namespace ircd::m::name
constexpr const char *const senders {"senders"};
constexpr const char *const not_senders {"not_senders"};
constexpr const char *const limit {"limit"};
constexpr const char *const edu_type {"edu_type"};
constexpr const char *const user_id {"user_id"};
constexpr const char *const last_active_ago {"last_active_ago"};
constexpr const char *const currently_active {"currently_active"};
constexpr const char *const status_msg {"status_msg"};
constexpr const char *const ts {"ts"};
constexpr const char *const event_ids {"event_ids"};
constexpr const char *const typing {"typing"};
}

33
include/ircd/m/presence.h Normal file
View file

@ -0,0 +1,33 @@
// 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
{
}
#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>,
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

31
include/ircd/m/receipt.h Normal file
View file

@ -0,0 +1,31 @@
// 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_RECEIPT_H
namespace ircd::m
{
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
struct ircd::m::edu::m_receipt
:json::tuple
<
json::property<name::ts, time_t>,
json::property<name::event_ids, json::array>
>
{
using super_type::tuple;
using super_type::operator=;
};
#pragma GCC diagnostic pop

View file

@ -21,11 +21,11 @@ namespace ircd::m
struct ircd::m::txn
:json::tuple
<
json::property<name::edus, string_view>,
json::property<name::origin, string_view>,
json::property<name::edus, json::array>,
json::property<name::origin, json::string>,
json::property<name::origin_server_ts, time_t>,
json::property<name::pdu_failures, string_view>,
json::property<name::pdus, string_view>
json::property<name::pdu_failures, json::array>,
json::property<name::pdus, json::array>
>
{
using super_type::tuple;

32
include/ircd/m/typing.h Normal file
View file

@ -0,0 +1,32 @@
// 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_TYPING_H
namespace ircd::m
{
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
struct ircd::m::edu::m_typing
:json::tuple
<
json::property<name::user_id, json::string>,
json::property<name::room_id, json::string>,
json::property<name::typing, bool>
>
{
using super_type::tuple;
using super_type::operator=;
};
#pragma GCC diagnostic pop