mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +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,
|
||||
queryid = QID,
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els = [#message{
|
||||
from = MyNickJID,
|
||||
@ -2411,7 +2411,7 @@ carbons_slave(Config) ->
|
||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||
sub_els =
|
||||
[#carbons_sent{
|
||||
forwarded = #forwarded{
|
||||
forwarded = #forwarded_decoded{
|
||||
sub_els =
|
||||
[#message{from = Peer,
|
||||
to = MyBareJID,
|
||||
@ -2420,7 +2420,7 @@ carbons_slave(Config) ->
|
||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||
sub_els =
|
||||
[#carbons_sent{
|
||||
forwarded = #forwarded{
|
||||
forwarded = #forwarded_decoded{
|
||||
sub_els =
|
||||
[#message{from = Peer,
|
||||
to = Peer,
|
||||
@ -2429,7 +2429,7 @@ carbons_slave(Config) ->
|
||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||
sub_els =
|
||||
[#carbons_received{
|
||||
forwarded = #forwarded{
|
||||
forwarded = #forwarded_decoded{
|
||||
sub_els =
|
||||
[#message{from = Peer,
|
||||
to = MyBareJID,
|
||||
@ -2438,7 +2438,7 @@ carbons_slave(Config) ->
|
||||
#message{from = MyBareJID, to = MyJID, type = chat,
|
||||
sub_els =
|
||||
[#carbons_received{
|
||||
forwarded = #forwarded{
|
||||
forwarded = #forwarded_decoded{
|
||||
sub_els =
|
||||
[#message{from = Peer,
|
||||
to = Peer,
|
||||
@ -2560,7 +2560,7 @@ mam_query_all(Config, NS) ->
|
||||
[#mam_result{
|
||||
queryid = QID,
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els =
|
||||
[#message{
|
||||
@ -2599,7 +2599,7 @@ mam_query_with(Config, JID, NS) ->
|
||||
sub_els =
|
||||
[#mam_result{
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els =
|
||||
[#message{
|
||||
@ -2640,7 +2640,7 @@ mam_query_rsm(Config, NS) ->
|
||||
[#mam_result{
|
||||
xmlns = NS,
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els =
|
||||
[#message{
|
||||
@ -2677,7 +2677,7 @@ mam_query_rsm(Config, NS) ->
|
||||
[#mam_result{
|
||||
xmlns = NS,
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els =
|
||||
[#message{
|
||||
@ -2717,7 +2717,7 @@ mam_query_rsm(Config, NS) ->
|
||||
[#mam_result{
|
||||
xmlns = NS,
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els =
|
||||
[#message{
|
||||
@ -2773,7 +2773,7 @@ mam_query_rsm(Config, NS) ->
|
||||
[#mam_result{
|
||||
xmlns = NS,
|
||||
sub_els =
|
||||
[#forwarded{
|
||||
[#forwarded_decoded{
|
||||
delay = #delay{},
|
||||
sub_els =
|
||||
[#message{
|
||||
|
@ -481,9 +481,22 @@ format_element(El) ->
|
||||
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
|
||||
|
@ -5,6 +5,9 @@
|
||||
-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>>).
|
||||
|
Loading…
Reference in New Issue
Block a user