prosody2ejabberd: Fix offline message record type

mod_offline now expects a #message{} rather than an #xmlel{} record.
This commit is contained in:
Holger Weiss 2017-03-21 18:35:07 +01:00
parent a1068df602
commit e469b6ffb4
1 changed files with 15 additions and 10 deletions

View File

@ -341,19 +341,24 @@ el_to_offline_msg(LUser, LServer, #xmlel{attrs = Attrs} = El) ->
({<<"stamp_legacy">>, _}) -> false; ({<<"stamp_legacy">>, _}) -> false;
(_) -> true (_) -> true
end, Attrs), end, Attrs),
Packet = El#xmlel{attrs = Attrs1}, El1 = El#xmlel{attrs = Attrs1},
From = jid:decode(fxml:get_attr_s(<<"from">>, Attrs)), case xmpp:decode(El1, ?NS_CLIENT, [ignore_els]) of
To = jid:decode(fxml:get_attr_s(<<"to">>, Attrs)), #message{from = #jid{} = From, to = #jid{} = To} = Packet ->
[#offline_msg{ [#offline_msg{
us = {LUser, LServer}, us = {LUser, LServer},
timestamp = TS, timestamp = TS,
expire = never, expire = never,
from = From, from = From,
to = To, to = To,
packet = Packet}] packet = Packet}];
_ ->
[]
end
catch _:{bad_timestamp, _} -> catch _:{bad_timestamp, _} ->
[]; [];
_:{bad_jid, _} -> _:{bad_jid, _} ->
[];
_:{xmpp_codec, _} ->
[] []
end. end.