From 2a5e46b0e219130c2422b0cfe88ff589ff35168a Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 13 Jun 2022 13:25:37 +0200 Subject: [PATCH 1/2] Add trusting mam jid codec --- doc/modules/mod_mam.md | 2 +- src/mam/mam_jid_rfc_trust.erl | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/mam/mam_jid_rfc_trust.erl diff --git a/doc/modules/mod_mam.md b/doc/modules/mod_mam.md index 91d60d03d5..260d422006 100644 --- a/doc/modules/mod_mam.md +++ b/doc/modules/mod_mam.md @@ -354,7 +354,7 @@ This sets the maximum page size of returned results. #### `modules.mod_mam_meta.db_jid_format` -* **Syntax:** string, one of `"mam_jid_rfc"`, `"mam_jid_mini"` or a module implementing `mam_jid` behaviour +* **Syntax:** string, one of `"mam_jid_rfc"`, `"mam_jid_rfc_trust"`, `"mam_jid_mini"` or a module implementing `mam_jid` behaviour * **Default:** `"mam_jid_rfc"` for MUC archive, `"mam_jid_mini"` for PM archive * **Example:** `modules.mod_mam_meta.db_jid_format = "mam_jid_mini"` diff --git a/src/mam/mam_jid_rfc_trust.erl b/src/mam/mam_jid_rfc_trust.erl new file mode 100644 index 0000000000..89489527b2 --- /dev/null +++ b/src/mam/mam_jid_rfc_trust.erl @@ -0,0 +1,11 @@ +%%% @doc Encoding and decoding using encoding described in XMPP RFC specification +-module(mam_jid_rfc_trust). +-behaviour(mam_jid). + +-export([encode/2, decode/2]). + +encode(_UserJID, JID) -> + jid:to_binary(JID). + +decode(_UserJID, BSrcJID) -> + jid:from_binary_noprep(BSrcJID). From 579538f35d9516ff3ac1ecdee7f3605f80395af4 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Mon, 13 Jun 2022 13:25:53 +0200 Subject: [PATCH 2/2] Remove unused headers --- src/mam/mam_encoder.erl | 2 -- src/mam/mod_mam_rdbms_arch.erl | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/mam/mam_encoder.erl b/src/mam/mam_encoder.erl index c7b58b616f..76904a0b0f 100644 --- a/src/mam/mam_encoder.erl +++ b/src/mam/mam_encoder.erl @@ -5,9 +5,7 @@ -export([encode_packet/2]). -export([extend_lookup_params/2]). --include("mongoose.hrl"). -include("jlib.hrl"). --include_lib("exml/include/exml.hrl"). -include("mongoose_mam.hrl"). -type value_type() :: int | maybe_string | direction | bare_jid | jid | jid_resource | xml | search. diff --git a/src/mam/mod_mam_rdbms_arch.erl b/src/mam/mod_mam_rdbms_arch.erl index 59977a5057..310431a748 100644 --- a/src/mam/mod_mam_rdbms_arch.erl +++ b/src/mam/mod_mam_rdbms_arch.erl @@ -40,8 +40,6 @@ -include("mongoose.hrl"). -include("jlib.hrl"). --include_lib("exml/include/exml.hrl"). --include("mongoose_rsm.hrl"). -include("mongoose_mam.hrl"). %% ----------------------------------------------------------------------