diff --git a/td/telegram/logevent/LogEvent.h b/td/telegram/logevent/LogEvent.h index dadb30cd..4de768b1 100644 --- a/td/telegram/logevent/LogEvent.h +++ b/td/telegram/logevent/LogEvent.h @@ -185,6 +185,7 @@ class StorerImpl : public Storer { private: const T &event_; }; + } // namespace detail template @@ -199,18 +200,6 @@ class LogEventBase : public LogEvent { } }; -template -class LogEventHelper : public ParentT { - public: - typename ParentT::Type get_type() const override { - return ChildT::type; - } - - constexpr int32 magic() const { - return static_cast(get_type()); - } -}; - class LogEventParser : public WithVersion> { public: explicit LogEventParser(Slice data) : WithVersion>(data) { diff --git a/td/telegram/logevent/SecretChatEvent.h b/td/telegram/logevent/SecretChatEvent.h index 901ca64c..bfd94f4f 100644 --- a/td/telegram/logevent/SecretChatEvent.h +++ b/td/telegram/logevent/SecretChatEvent.h @@ -46,6 +46,18 @@ class SecretChatEvent : public LogEventBase { static void downcast_call(Type type, F &&f); }; +template +class SecretChatLogEventBase : public SecretChatEvent { + public: + typename SecretChatEvent::Type get_type() const override { + return ChildT::type; + } + + constexpr int32 magic() const { + return static_cast(get_type()); + } +}; + // Internal structure // inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; @@ -191,7 +203,7 @@ inline StringBuilder &operator<<(StringBuilder &sb, const EncryptedFileLocation // LogEvents // TODO: Qts and SeqNoState could be just Logevents that are updated during regenerate -class InboundSecretMessage : public LogEventHelper { +class InboundSecretMessage : public SecretChatLogEventBase { public: static constexpr Type type = SecretChatEvent::Type::InboundSecretMessage; int32 qts = 0; @@ -289,7 +301,7 @@ class InboundSecretMessage : public LogEventHelper { +class OutboundSecretMessage : public SecretChatLogEventBase { public: static constexpr Type type = SecretChatEvent::Type::OutboundSecretMessage; @@ -390,7 +402,7 @@ class OutboundSecretMessage : public LogEventHelper { +class CloseSecretChat : public SecretChatLogEventBase { public: static constexpr Type type = SecretChatEvent::Type::CloseSecretChat; int32 chat_id = 0; @@ -412,7 +424,7 @@ class CloseSecretChat : public LogEventHelper } }; -class CreateSecretChat : public LogEventHelper { +class CreateSecretChat : public SecretChatLogEventBase { public: static constexpr Type type = SecretChatEvent::Type::CreateSecretChat; int32 random_id = 0;