xmlns = ?NS_MAM_1,
queryid = QID,
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els = [#message{
from = MyNickJID,
#message{from = MyBareJID, to = MyJID, type = chat,
sub_els =
[#carbons_sent{
- forwarded = #forwarded{
+ forwarded = #forwarded_decoded{
sub_els =
[#message{from = Peer,
to = MyBareJID,
#message{from = MyBareJID, to = MyJID, type = chat,
sub_els =
[#carbons_sent{
- forwarded = #forwarded{
+ forwarded = #forwarded_decoded{
sub_els =
[#message{from = Peer,
to = Peer,
#message{from = MyBareJID, to = MyJID, type = chat,
sub_els =
[#carbons_received{
- forwarded = #forwarded{
+ forwarded = #forwarded_decoded{
sub_els =
[#message{from = Peer,
to = MyBareJID,
#message{from = MyBareJID, to = MyJID, type = chat,
sub_els =
[#carbons_received{
- forwarded = #forwarded{
+ forwarded = #forwarded_decoded{
sub_els =
[#message{from = Peer,
to = Peer,
[#mam_result{
queryid = QID,
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els =
[#message{
sub_els =
[#mam_result{
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els =
[#message{
[#mam_result{
xmlns = NS,
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els =
[#message{
[#mam_result{
xmlns = NS,
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els =
[#message{
[#mam_result{
xmlns = NS,
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els =
[#message{
[#mam_result{
xmlns = NS,
sub_els =
- [#forwarded{
+ [#forwarded_decoded{
delay = #delay{},
sub_els =
[#message{
false -> io_lib:format(" ~s~n", El)
end.
+substitute_forwarded(#mam_result{sub_els = Sub} = El) ->
+ El#mam_result{sub_els = [substitute_forwarded(SEl) || SEl <- Sub]};
+substitute_forwarded(#carbons_sent{forwarded = Sub} = El) ->
+ El#carbons_sent{forwarded = [substitute_forwarded(SEl) || SEl <- Sub]};
+substitute_forwarded(#message{sub_els = Sub} = El) ->
+ El#message{sub_els = [substitute_forwarded(SEl) || SEl <- Sub]};
+substitute_forwarded(#forwarded{delay = Delay, xml_els = Sub}) ->
+ #forwarded_decoded{delay = Delay, sub_els = [xmpp:decode(SEl) || SEl <- Sub]};
+substitute_forwarded(El) ->
+ El.
+
+
+
decode(El, NS, Opts) ->
try
- Pkt = xmpp:decode(El, NS, Opts),
+ Pkt = substitute_forwarded(xmpp:decode(El, NS, Opts)),
ct:pal("RECV:~n~s~n~s",
[format_element(El), xmpp:pp(Pkt)]),
Pkt
-include("mod_proxy65.hrl").
-include("xmpp_codec.hrl").
+-record(forwarded_decoded, {delay :: #delay{},
+ sub_els = [] :: [fxml:xmlel()]}).
+
-define(STREAM_TRAILER, <<"</stream:stream>">>).
-define(PUBSUB(Node), <<(?NS_PUBSUB)/binary, "#", Node>>).