2019-09-27 03:36:03 +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.
|
|
|
|
|
|
|
|
ircd::m::event::id::buf
|
|
|
|
ircd::m::event_id(const event::idx &event_idx)
|
|
|
|
{
|
|
|
|
event::id::buf ret;
|
2022-06-29 20:40:03 +02:00
|
|
|
const auto res
|
|
|
|
{
|
|
|
|
event_id(event_idx, ret)
|
|
|
|
};
|
|
|
|
|
2019-09-27 03:36:03 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ircd::m::event::id::buf
|
2020-04-02 00:42:33 +02:00
|
|
|
ircd::m::event_id(std::nothrow_t,
|
|
|
|
const event::idx &event_idx)
|
2019-09-27 03:36:03 +02:00
|
|
|
{
|
|
|
|
event::id::buf ret;
|
2022-06-29 20:40:03 +02:00
|
|
|
const auto res
|
|
|
|
{
|
|
|
|
event_id(std::nothrow, event_idx, ret)
|
|
|
|
};
|
|
|
|
|
2019-09-27 03:36:03 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ircd::m::event::id
|
|
|
|
ircd::m::event_id(const event::idx &event_idx,
|
|
|
|
event::id::buf &buf)
|
|
|
|
{
|
|
|
|
const event::id ret
|
|
|
|
{
|
2020-04-02 00:42:33 +02:00
|
|
|
event_id(std::nothrow, event_idx, buf)
|
2019-09-27 03:36:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
if(!ret)
|
|
|
|
throw m::NOT_FOUND
|
|
|
|
{
|
2020-04-02 00:42:33 +02:00
|
|
|
"Cannot find event ID from idx[%lu]",
|
|
|
|
event_idx
|
2019-09-27 03:36:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ircd::m::event::id
|
2020-04-02 00:42:33 +02:00
|
|
|
ircd::m::event_id(std::nothrow_t,
|
|
|
|
const event::idx &event_idx,
|
|
|
|
event::id::buf &buf)
|
2019-09-27 03:36:03 +02:00
|
|
|
{
|
2020-04-02 00:42:33 +02:00
|
|
|
event_id(std::nothrow, event_idx, [&buf]
|
2019-09-27 03:36:03 +02:00
|
|
|
(const event::id &eid)
|
|
|
|
{
|
|
|
|
buf = eid;
|
|
|
|
});
|
|
|
|
|
2020-04-02 00:42:33 +02:00
|
|
|
return buf?
|
|
|
|
event::id{buf}:
|
|
|
|
event::id{};
|
2019-09-27 03:36:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2020-04-02 00:42:33 +02:00
|
|
|
ircd::m::event_id(std::nothrow_t,
|
|
|
|
const event::idx &event_idx,
|
2019-09-27 03:36:03 +02:00
|
|
|
const event::id::closure &closure)
|
|
|
|
{
|
|
|
|
return get(std::nothrow, event_idx, "event_id", closure);
|
|
|
|
}
|