Skip to content

Commit d19bc8d

Browse files
committed
webhook settings
get url for request
1 parent ba3115a commit d19bc8d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/mod_message_http_post.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ log_packet_offline({_Action, Msg} = Acc) ->
9595
%% Internal functions.
9696
%% -------------------------------------------------------------------
9797
-spec log_packet(direction(), message()) -> any().
98-
log_packet(Direction, #message{type = Type} = Msg) ->
98+
log_packet(Direction, #message{type = Type, body = Body, id = Id, from = From, to = To} = Msg) ->
9999
case should_log(Msg) of
100100
true ->
101101
{Type1, Direction1} = case is_carbon(Msg) of
@@ -107,7 +107,14 @@ log_packet(Direction, #message{type = Type} = Msg) ->
107107
% Proc = gen_mod:get_module_proc(global, ?MODULE),
108108
% gen_server:cast(Proc, {message, Direction1, From, To, Type1, Msg});
109109
Date = format_date(calendar:local_time()),
110-
?INFO_MSG("log_packet: ~s ~s ~s", [Date, Direction1, Type1]);
110+
if Direction1 == 'outgoing' ->
111+
#jid{lserver = LServer} = From;
112+
true ->
113+
#jid{lserver = LServer} = To
114+
end,
115+
Url = gen_mod:get_module_opt(LServer, ?MODULE, url, fun(S) -> iolist_to_binary(S) end, false),
116+
?INFO_MSG("log_packet: Url ~s Date ~s Direction ~s Type ~s Message ~s ID ~s From ~s To ~s",
117+
[Url, Date, Direction1, Type1, xmpp:get_text(Body), binary_to_list(Id), jid:encode(From), jid:encode(To)]);
111118
false ->
112119
ok
113120
end.

0 commit comments

Comments
 (0)