mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix tests that use #forwarded
This commit is contained in:
parent
41794c57d6
commit
e75dd17e2c
@ -2083,7 +2083,7 @@ retrieve_messages_from_room_via_mam(Config, Range) ->
|
|||||||
xmlns = ?NS_MAM_1,
|
xmlns = ?NS_MAM_1,
|
||||||
queryid = QID,
|
queryid = QID,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els = [#message{
|
sub_els = [#message{
|
||||||
from = MyNickJID,
|
from = MyNickJID,
|
||||||
@ -2411,7 +2411,7 @@ carbons_slave(Config) ->
|
|||||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#carbons_sent{
|
[#carbons_sent{
|
||||||
forwarded = #forwarded{
|
forwarded = #forwarded_decoded{
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{from = Peer,
|
[#message{from = Peer,
|
||||||
to = MyBareJID,
|
to = MyBareJID,
|
||||||
@ -2420,7 +2420,7 @@ carbons_slave(Config) ->
|
|||||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#carbons_sent{
|
[#carbons_sent{
|
||||||
forwarded = #forwarded{
|
forwarded = #forwarded_decoded{
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{from = Peer,
|
[#message{from = Peer,
|
||||||
to = Peer,
|
to = Peer,
|
||||||
@ -2429,7 +2429,7 @@ carbons_slave(Config) ->
|
|||||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#carbons_received{
|
[#carbons_received{
|
||||||
forwarded = #forwarded{
|
forwarded = #forwarded_decoded{
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{from = Peer,
|
[#message{from = Peer,
|
||||||
to = MyBareJID,
|
to = MyBareJID,
|
||||||
@ -2438,7 +2438,7 @@ carbons_slave(Config) ->
|
|||||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#carbons_received{
|
[#carbons_received{
|
||||||
forwarded = #forwarded{
|
forwarded = #forwarded_decoded{
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{from = Peer,
|
[#message{from = Peer,
|
||||||
to = Peer,
|
to = Peer,
|
||||||
@ -2560,7 +2560,7 @@ mam_query_all(Config, NS) ->
|
|||||||
[#mam_result{
|
[#mam_result{
|
||||||
queryid = QID,
|
queryid = QID,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{
|
[#message{
|
||||||
@ -2599,7 +2599,7 @@ mam_query_with(Config, JID, NS) ->
|
|||||||
sub_els =
|
sub_els =
|
||||||
[#mam_result{
|
[#mam_result{
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{
|
[#message{
|
||||||
@ -2640,7 +2640,7 @@ mam_query_rsm(Config, NS) ->
|
|||||||
[#mam_result{
|
[#mam_result{
|
||||||
xmlns = NS,
|
xmlns = NS,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{
|
[#message{
|
||||||
@ -2677,7 +2677,7 @@ mam_query_rsm(Config, NS) ->
|
|||||||
[#mam_result{
|
[#mam_result{
|
||||||
xmlns = NS,
|
xmlns = NS,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{
|
[#message{
|
||||||
@ -2717,7 +2717,7 @@ mam_query_rsm(Config, NS) ->
|
|||||||
[#mam_result{
|
[#mam_result{
|
||||||
xmlns = NS,
|
xmlns = NS,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{
|
[#message{
|
||||||
@ -2773,7 +2773,7 @@ mam_query_rsm(Config, NS) ->
|
|||||||
[#mam_result{
|
[#mam_result{
|
||||||
xmlns = NS,
|
xmlns = NS,
|
||||||
sub_els =
|
sub_els =
|
||||||
[#forwarded{
|
[#forwarded_decoded{
|
||||||
delay = #delay{},
|
delay = #delay{},
|
||||||
sub_els =
|
sub_els =
|
||||||
[#message{
|
[#message{
|
||||||
|
@ -481,9 +481,22 @@ format_element(El) ->
|
|||||||
false -> io_lib:format(" ~s~n", El)
|
false -> io_lib:format(" ~s~n", El)
|
||||||
end.
|
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) ->
|
decode(El, NS, Opts) ->
|
||||||
try
|
try
|
||||||
Pkt = xmpp:decode(El, NS, Opts),
|
Pkt = substitute_forwarded(xmpp:decode(El, NS, Opts)),
|
||||||
ct:pal("RECV:~n~s~n~s",
|
ct:pal("RECV:~n~s~n~s",
|
||||||
[format_element(El), xmpp:pp(Pkt)]),
|
[format_element(El), xmpp:pp(Pkt)]),
|
||||||
Pkt
|
Pkt
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
-include("mod_proxy65.hrl").
|
-include("mod_proxy65.hrl").
|
||||||
-include("xmpp_codec.hrl").
|
-include("xmpp_codec.hrl").
|
||||||
|
|
||||||
|
-record(forwarded_decoded, {delay :: #delay{},
|
||||||
|
sub_els = [] :: [fxml:xmlel()]}).
|
||||||
|
|
||||||
-define(STREAM_TRAILER, <<"</stream:stream>">>).
|
-define(STREAM_TRAILER, <<"</stream:stream>">>).
|
||||||
|
|
||||||
-define(PUBSUB(Node), <<(?NS_PUBSUB)/binary, "#", Node>>).
|
-define(PUBSUB(Node), <<(?NS_PUBSUB)/binary, "#", Node>>).
|
||||||
|
Loading…
Reference in New Issue
Block a user