aboutsummaryrefslogtreecommitdiff
path: root/test/ejabberd_SUITE.erl
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2016-05-17 22:12:04 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2016-05-17 22:12:04 +0200
commit8f72c27b88cd83e50879caf80d8d2546fd19ef2d (patch)
tree554589302b467b08821b7b464a6fe855054c0fac /test/ejabberd_SUITE.erl
parentmod_client_state: Queue chat state notifications (diff)
mod_client_state: Add "queue_pep" option
If the new "queue_pep" option is enabled and the client is inactive, PEP notifications are throttled in a similar way to presence stanzas and chat states. Only the most recent notification of a given node and payload type will be queued from a given contact.
Diffstat (limited to 'test/ejabberd_SUITE.erl')
-rw-r--r--test/ejabberd_SUITE.erl51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl
index f3f7ebde3..800d5ebf3 100644
--- a/test/ejabberd_SUITE.erl
+++ b/test/ejabberd_SUITE.erl
@@ -2255,12 +2255,41 @@ client_state_master(Config) ->
ChatState = #message{to = Peer, thread = <<"1">>,
sub_els = [#chatstate{type = active}]},
Message = ChatState#message{body = [#text{data = <<"body">>}]},
+ PepPayload = xmpp_codec:encode(#presence{}),
+ PepOne = #message{
+ to = Peer,
+ sub_els =
+ [#pubsub_event{
+ items =
+ [#pubsub_event_items{
+ node = <<"foo-1">>,
+ items =
+ [#pubsub_event_item{
+ id = <<"pep-1">>,
+ xml_els = [PepPayload]}]}]}]},
+ PepTwo = #message{
+ to = Peer,
+ sub_els =
+ [#pubsub_event{
+ items =
+ [#pubsub_event_items{
+ node = <<"foo-2">>,
+ items =
+ [#pubsub_event_item{
+ id = <<"pep-2">>,
+ xml_els = [PepPayload]}]}]}]},
%% Wait for the slave to become inactive.
wait_for_slave(Config),
%% Should be queued (but see below):
send(Config, Presence),
%% Should replace the previous presence in the queue:
send(Config, Presence#presence{type = unavailable}),
+ %% The following two PEP stanzas should be queued (but see below):
+ send(Config, PepOne),
+ send(Config, PepTwo),
+ %% The following two PEP stanzas should replace the previous two:
+ send(Config, PepOne),
+ send(Config, PepTwo),
%% Should be queued (but see below):
send(Config, ChatState),
%% Should replace the previous chat state in the queue:
@@ -2279,6 +2308,28 @@ client_state_slave(Config) ->
wait_for_master(Config),
?recv1(#presence{from = Peer, type = unavailable,
sub_els = [#delay{}]}),
+ #message{
+ from = Peer,
+ sub_els =
+ [#pubsub_event{
+ items =
+ [#pubsub_event_items{
+ node = <<"foo-1">>,
+ items =
+ [#pubsub_event_item{
+ id = <<"pep-1">>}]}]},
+ #delay{}]} = recv(),
+ #message{
+ from = Peer,
+ sub_els =
+ [#pubsub_event{
+ items =
+ [#pubsub_event_items{
+ node = <<"foo-2">>,
+ items =
+ [#pubsub_event_item{
+ id = <<"pep-2">>}]}]},
+ #delay{}]} = recv(),
?recv1(#message{from = Peer, thread = <<"1">>,
sub_els = [#chatstate{type = composing},
#delay{}]}),