@@ -292,6 +292,8 @@ mam_cases() ->
292
292
range_archive_request_not_empty ,
293
293
limit_archive_request ,
294
294
querying_for_all_messages_with_jid ,
295
+ querying_for_all_messages_with_jid_after ,
296
+ querying_with_invalid_mam_id_in_after ,
295
297
unicode_messages_can_be_extracted
296
298
].
297
299
@@ -1522,6 +1524,55 @@ muc_server_returns_item_not_found_for_ids_filter_with_nonexistent_id(Config) ->
1522
1524
end ,
1523
1525
escalus :story (Config , [{alice , 1 }], F ).
1524
1526
1527
+ % % Based on https://github.com/esl/MongooseIM/issues/4222
1528
+ querying_for_all_messages_with_jid_after (Config ) ->
1529
+ P = ? config (props , Config ),
1530
+ F = fun (Alice , Bob , Kate ) ->
1531
+ escalus :send (Alice , escalus_stanza :chat_to (Bob , <<" Hi, Bob!" >>)),
1532
+ mam_helper :wait_for_archive_size (Alice , 1 ),
1533
+ escalus :send (Alice , escalus_stanza :chat_to (Bob , <<" Hi, Kate!" >>)),
1534
+ mam_helper :wait_for_archive_size (Alice , 2 ),
1535
+ escalus :send (Kate , escalus_stanza :chat_to (Alice , <<" Hi, Alice!" >>)),
1536
+ escalus :assert (is_chat_message , [<<" Hi, Alice!" >>], escalus :wait_for_stanza (Alice )),
1537
+ mam_helper :wait_for_archive_size (Alice , 3 ),
1538
+ escalus :send (Kate , escalus_stanza :chat_to (Alice , <<" How are you?" >>)),
1539
+ escalus :assert (is_chat_message , [<<" How are you?" >>], escalus :wait_for_stanza (Alice )),
1540
+ mam_helper :wait_for_archive_size (Alice , 4 ),
1541
+ escalus :send (Bob , escalus_stanza :chat_to (Alice , <<" I am busy now" >>)),
1542
+ escalus :assert (is_chat_message , [<<" I am busy now" >>], escalus :wait_for_stanza (Alice )),
1543
+ mam_helper :wait_for_archive_size (Alice , 5 ),
1544
+ escalus :send (Alice , mam_helper :stanza_lookup_messages_iq (P , #{})),
1545
+ AllRes = wait_archive_respond (Alice ),
1546
+ assert_respond_size (5 , AllRes ),
1547
+ % % Third message overall, second message in the conversation with Kate
1548
+ Msg3 = lists :nth (3 , respond_messages (AllRes )),
1549
+ # forwarded_message {result_id = MamId3 , message_body = <<" Hi, Alice!" >>} =
1550
+ parse_forwarded_message (Msg3 ),
1551
+ KateJid = escalus_client :short_jid (Kate ),
1552
+ Params = #{
1553
+ with_jid => KateJid ,
1554
+ rsm => # rsm_in {max = 50 , direction = 'after' , id = MamId3 }
1555
+ },
1556
+ escalus :send (Alice , mam_helper :stanza_lookup_messages_iq (P , Params )),
1557
+ WithRes = wait_archive_respond (Alice ),
1558
+ assert_respond_size (1 , WithRes ),
1559
+ [WithMsg ] = respond_messages (WithRes ),
1560
+ # forwarded_message {message_body = <<" How are you?" >>} =
1561
+ parse_forwarded_message (WithMsg )
1562
+ end ,
1563
+ escalus :fresh_story (Config , [{alice , 1 }, {bob , 1 }, {kate , 1 }], F ).
1564
+
1565
+ querying_with_invalid_mam_id_in_after (Config ) ->
1566
+ P = ? config (props , Config ),
1567
+ F = fun (Alice ) ->
1568
+ Params = #{rsm => # rsm_in {max = 50 , direction = 'after' , id = <<" PURPLEFE965CC9" >>}},
1569
+ escalus :send (Alice , mam_helper :stanza_lookup_messages_iq (P , Params )),
1570
+ Result = escalus :wait_for_stanza (Alice ),
1571
+ escalus :assert (is_iq_error , [], Result ),
1572
+ escalus :assert (is_error , [<<" modify" >>, <<" not-acceptable" >>], Result )
1573
+ end ,
1574
+ escalus :fresh_story (Config , [{alice , 1 }], F ).
1575
+
1525
1576
muc_querying_for_all_messages (Config ) ->
1526
1577
P = ? config (props , Config ),
1527
1578
F = fun (Alice ) ->
0 commit comments