From 4724110736605c7cf505ac5c07f93792552ca910 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 27 Feb 2019 18:18:17 -0800 Subject: [PATCH] modules/client/sync/rooms/ephemeral: Add m.typing sync handler. --- modules/Makefile.am | 2 + modules/client/sync/rooms/ephemeral/typing.cc | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 modules/client/sync/rooms/ephemeral/typing.cc diff --git a/modules/Makefile.am b/modules/Makefile.am index 8afac8ebd..75ce82598 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -332,9 +332,11 @@ client_module_LTLIBRARIES += \ # client/sync/rooms/ephemeral/ client_client_sync_rooms_ephemeral_receipt_la_SOURCES = client/sync/rooms/ephemeral/receipt.cc +client_client_sync_rooms_ephemeral_typing_la_SOURCES = client/sync/rooms/ephemeral/typing.cc client_module_LTLIBRARIES += \ client/client_sync_rooms_ephemeral_receipt.la \ + client/client_sync_rooms_ephemeral_typing.la \ ### # diff --git a/modules/client/sync/rooms/ephemeral/typing.cc b/modules/client/sync/rooms/ephemeral/typing.cc new file mode 100644 index 000000000..e7cb5aff6 --- /dev/null +++ b/modules/client/sync/rooms/ephemeral/typing.cc @@ -0,0 +1,52 @@ +// Matrix Construct +// +// Copyright (C) Matrix Construct Developers, Authors & Contributors +// Copyright (C) 2016-2019 Jason Volk +// +// 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::mapi::header +IRCD_MODULE +{ + "Client Sync :Room Ephemeral :Typing" +}; + +namespace ircd::m::sync +{ + static bool room_ephemeral_m_typing_polylog(data &); + static bool room_ephemeral_m_typing_linear(data &); + extern item room_ephemeral_m_typing; +} + +decltype(ircd::m::sync::room_ephemeral_m_typing) +ircd::m::sync::room_ephemeral_m_typing +{ + "rooms.ephemeral.m_typing", + room_ephemeral_m_typing_polylog, + room_ephemeral_m_typing_linear +}; + +bool +ircd::m::sync::room_ephemeral_m_typing_linear(data &data) +{ + assert(data.event); + if(json::get<"type"_>(*data.event) != "m.typing") + return false; + + json::stack::object object + { + *data.out + }; + + object.append(*data.event); + return true; +} + +bool +ircd::m::sync::room_ephemeral_m_typing_polylog(data &data) +{ + return false; +}