From 9fe5f383dc2383bf06873beb6e7938d50d34a49f Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 15 Feb 2018 17:01:05 +0100 Subject: [PATCH] Fix code to support sending iq and presence, not only message --- mod_rest/src/mod_rest.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod_rest/src/mod_rest.erl b/mod_rest/src/mod_rest.erl index 42a35f1..1cfab16 100644 --- a/mod_rest/src/mod_rest.erl +++ b/mod_rest/src/mod_rest.erl @@ -120,7 +120,7 @@ get_option_access(Host) -> %% This function crashes if the stanza does not satisfy configured restrictions check_stanza(Pkt, Host) -> - To = Pkt#message.to, + To = xmpp:get_to(Pkt), check_member_option(Host, jlib:jid_to_string(To), allowed_destinations), %%+++ {xmlel, StanzaType, _Attrs, _Kids} = Stanza, %%+++ check_member_option(Host, StanzaType, allowed_stanza_types), @@ -145,7 +145,7 @@ ip_matches(ClientIp, AllowedValues) -> AllowedValues). post_request(Pkt) -> - mod_mam:user_send_packet({Pkt, #{jid => Pkt#message.from}}), + mod_mam:user_send_packet({Pkt, #{jid => xmpp:get_from(Pkt)}}), case ejabberd_router:route(Pkt) of ok -> {200, [], <<"Ok">>}; _ -> {500, [], <<"Error">>}