From 662ec9c84c8bc8247aee6ac2ed5dfec840d708f1 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 12 Jan 2022 18:01:36 +0100 Subject: [PATCH] Env gives nothing here, params is needed --- src/mam/mod_mam_muc_rdbms_arch.erl | 10 +++++----- src/mam/mod_mam_rdbms_arch.erl | 10 +++++----- src/mongoose_hooks.erl | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mam/mod_mam_muc_rdbms_arch.erl b/src/mam/mod_mam_muc_rdbms_arch.erl index bd0f1986cd..02c8ea5dfa 100644 --- a/src/mam/mod_mam_muc_rdbms_arch.erl +++ b/src/mam/mod_mam_muc_rdbms_arch.erl @@ -254,12 +254,12 @@ retract_message(HostType, #{local_jid := ArcJID} = Params) -> -spec retract_message(mongooseim:host_type(), mod_mam:archive_message_params(), env_vars()) -> ok. retract_message(HostType, #{archive_id := ArcID, sender_id := SenderID, - packet := Packet}, Env) -> + packet := Packet} = Params, Env) -> case get_retract_id(Packet, Env) of none -> ok; RetractionId -> Info = get_retraction_info(HostType, ArcID, SenderID, RetractionId, Env), - make_tombstone(HostType, ArcID, RetractionId, Info, Env) + make_tombstone(HostType, ArcID, RetractionId, Info, Params, Env) end. get_retraction_info(HostType, ArcID, SenderID, RetractionId, Env) -> @@ -267,14 +267,14 @@ get_retraction_info(HostType, ArcID, SenderID, RetractionId, Env) -> execute_select_messages_to_retract(HostType, ArcID, SenderID, RetractionId), mam_decoder:decode_retraction_info(Env, Rows, RetractionId). -make_tombstone(_HostType, ArcID, RetractionId, skip, _Env) -> +make_tombstone(_HostType, ArcID, RetractionId, skip, _Params, _Env) -> ?LOG_INFO(#{what => make_tombstone_failed, text => <<"Message to retract was not found">>, user_id => ArcID, retraction_context => RetractionId}); make_tombstone(HostType, ArcID, _RetractionId, - RetractionInfo = #{message_id := MessID}, + RetractionInfo = #{message_id := MessID}, Params, #{archive_jid := ArcJID} = Env) -> - RetractionInfo1 = mongoose_hooks:mam_muc_retraction(HostType, RetractionInfo, Env), + RetractionInfo1 = mongoose_hooks:mam_muc_retraction(HostType, RetractionInfo, Params), Tombstone = mod_mam_utils:tombstone(RetractionInfo1, ArcJID), TombstoneData = mam_encoder:encode_packet(Tombstone, Env), execute_make_tombstone(HostType, TombstoneData, ArcID, MessID). diff --git a/src/mam/mod_mam_rdbms_arch.erl b/src/mam/mod_mam_rdbms_arch.erl index 197f949440..76258e0481 100644 --- a/src/mam/mod_mam_rdbms_arch.erl +++ b/src/mam/mod_mam_rdbms_arch.erl @@ -280,12 +280,12 @@ retract_message(HostType, #{local_jid := ArcJID} = Params) -> -spec retract_message(host_type(), mod_mam:archive_message_params(), env_vars()) -> ok. retract_message(HostType, #{archive_id := ArcID, remote_jid := RemJID, - direction := Dir, packet := Packet}, Env) -> + direction := Dir, packet := Packet} = Params, Env) -> case get_retract_id(Packet, Env) of none -> ok; RetractionId -> Info = get_retraction_info(HostType, ArcID, RemJID, RetractionId, Dir, Env), - make_tombstone(HostType, ArcID, RetractionId, Info, Env) + make_tombstone(HostType, ArcID, RetractionId, Info, Params, Env) end. get_retraction_info(HostType, ArcID, RemJID, RetractionId, Dir, Env) -> @@ -298,14 +298,14 @@ get_retraction_info(HostType, ArcID, RemJID, RetractionId, Dir, Env) -> HostType, ArcID, ExtBareRemJID, RetractionId, ExtDir), mam_decoder:decode_retraction_info(Env, Rows, RetractionId). -make_tombstone(_HostType, ArcID, RetractionId, skip, _Env) -> +make_tombstone(_HostType, ArcID, RetractionId, skip, _Params, _Env) -> ?LOG_INFO(#{what => make_tombstone_failed, text => <<"Message to retract was not found">>, user_id => ArcID, retraction_context => RetractionId}); make_tombstone(HostType, ArcID, _RetractionId, - RetractionInfo = #{message_id := MessID}, + RetractionInfo = #{message_id := MessID}, Params, #{archive_jid := ArcJID} = Env) -> - RetractionInfo1 = mongoose_hooks:mam_retraction(HostType, RetractionInfo, Env), + RetractionInfo1 = mongoose_hooks:mam_retraction(HostType, RetractionInfo, Params), Tombstone = mod_mam_utils:tombstone(RetractionInfo1, ArcJID), TombstoneData = mam_encoder:encode_packet(Tombstone, Env), execute_make_tombstone(HostType, TombstoneData, ArcID, MessID). diff --git a/src/mongoose_hooks.erl b/src/mongoose_hooks.erl index 4086b867e7..8a04467100 100644 --- a/src/mongoose_hooks.erl +++ b/src/mongoose_hooks.erl @@ -1049,7 +1049,7 @@ mam_archive_sync(HostType) -> %% @doc Notifies of a message retraction -spec mam_retraction(mongooseim:host_type(), mod_mam_utils:retraction_info(), - mod_mam_rdbms_arch:env_vars()) -> + mod_mam:archive_message_params()) -> mod_mam_utils:retraction_info(). mam_retraction(HostType, RetractionInfo, Env) -> run_fold(mam_retraction, HostType, RetractionInfo, Env). @@ -1176,8 +1176,8 @@ mam_muc_archive_sync(HostType) -> %% @doc Notifies of a muc message retraction -spec mam_muc_retraction(mongooseim:host_type(), - mod_mam_utils:retraction_info(), - mod_mam_rdbms_arch:env_vars()) -> + mod_mam_utils:retraction_info(), + mod_mam:archive_message_params()) -> mod_mam_utils:retraction_info(). mam_muc_retraction(HostType, RetractionInfo, Env) -> run_fold(mam_muc_retraction, HostType, RetractionInfo, Env).