-
I changed a bit RSM classes. I split it to RSM.Query and RSM.Result. To ask for latest messages use RSMBuilder:
val rsm: RSM.Query = RSM.query { before() }
Of course you can create
RSM.Query
with any other parameters:val rsm2 = RSM.query { index(73) before("b191") after("a714") max(99) }
-
Is
before()
supposed to call for all messages starting from the latest message without parameters? I've just tried this and It hasn't worked as intended if this is the case.I see that
before(messageID)
also exists, but it still poses the question of how to retrieve the latest message ID to use in thebefore()
function. -
Andrzej said that. If you send empty
<before/>
(added to RSM bybefore()
function) and<max>10</max>
then you will get 10 latest messages.I thought I explained it during video call: You have to retrieve it from received message. If you have no messages locally (fresh client) then use empty
before()
to retrieve latest messages. -
Right. Pardon me if I'm missing something here, but I'm trying to send an empty
<before/>
. Here is the RSM query that i am currently sending:mamModule.query(rsm = RSM.query {before(); max(20)})
. As it looks, It's receiving the first 30 messages in the chat, starting at 3/17/21.Here are the print-outs from the exchange:
ID of message in Archive == 950a029a-e515-4605-a5b3-1d27898e562b Received stanza from MAM: 1616007021815 :: null ID of message in Archive == 3c870170-f26d-4e0e-a4a1-f1b168327f15 Received stanza from MAM: 1616007021820 :: null ID of message in Archive == a269abc6-d883-441e-8e22-1980f96d8dd8 Received stanza from MAM: 1616007041969 :: works? :-) ID of message in Archive == 7a1ec669-6f44-4695-8da2-5a57665db43f Received stanza from MAM: 1616007042226 :: null ID of message in Archive == ddf8e04b-f9fb-470c-a547-5afa0c02323d Received stanza from MAM: 1616007125716 :: yes sir! testing the avatar_click functionality ID of message in Archive == 5eacaccb-aad5-476c-968c-d509fd9ee6cc Received stanza from MAM: 1616007125784 :: null ID of message in Archive == 377e5a0c-0bd7-4ba3-95f6-39f6b75fa37a Received stanza from MAM: 1616007125787 :: null ID of message in Archive == 9e50a55f-d8b9-41ec-9dc9-6ee5f24f7b25 Received stanza from MAM: 1616007164770 :: where would I set my avatar / name / role for an xmpp account? ID of message in Archive == e1f5c4b4-3467-49b8-b205-5317ff9d25b9 Received stanza from MAM: 1616007164835 :: null ID of message in Archive == 17dab9ed-f655-4964-b363-f9fd67b8e791 Received stanza from MAM: 1616007164848 :: null ID of message in Archive == 214d2a5d-138f-4594-a647-27b6dbd5c362 Received stanza from MAM: 1616007251742 :: hmm, which XMPP client do you use? or do you mean in convene using halcyon library? ID of message in Archive == fed975f6-ff3a-44de-b8dc-b01a1d0ac4e1 Received stanza from MAM: 1616007251966 :: null ID of message in Archive == d52129b6-6e75-42a1-a4d1-d4065cf3c4ff Received stanza from MAM: 1616024256013 :: In convene. Is there a halcyon method for changing profile attributes? ID of message in Archive == 3639467f-63f4-4b37-97a9-fb9c35d045c4 Received stanza from MAM: 1616024256079 :: null ID of message in Archive == 05fd492e-745b-437e-9699-efca2d12b38f Received stanza from MAM: 1616024256083 :: null ID of message in Archive == 32769cc1-1e2d-4696-84d1-0e8210421db3 Received stanza from MAM: 1616035670611 :: Sevan, in Convene, and XMPP in general, it is called vCard. ID of message in Archive == 212d33b6-0e54-4d6c-a91a-0a6ab362e30f Received stanza from MAM: 1616035670641 :: Sevan, in Convene, and XMPP in general, it is called vCard. ID of message in Archive == e0cb41ed-e56c-43ef-99ce-1abe335be750 Received stanza from MAM: 1616035762737 :: You can find code in XMPPSession.kt file for downloading vCards for contacts ID of message in Archive == bc3eb911-677b-4ec0-b6c3-2764526c2e6f Received stanza from MAM: 1616035762774 :: You can find code in XMPPSession.kt file for downloading vCards for contacts ID of message in Archive == 52d1e4a7-03ea-4a8c-a141-7e03a13f0ad5 Received stanza from MAM: 1616035801141 :: Additionally, we have something we call public vCard and private vCard in Convene and Kangaroo ID of message in Archive == 3b719244-c84f-4fbd-9b13-6816a61c0861 Received stanza from MAM: 1616035801142 :: Additionally, we have something we call public vCard and private vCard in Convene and Kangaroo ID of message in Archive == 8a7d81e4-c04b-4cc3-bc0e-dda7580978a4 Received stanza from MAM: 1616035826212 :: For testing and experimenting BeagleIM also support private and public vcards ID of message in Archive == 38e215f3-1123-4f18-be72-6d3055341928 Received stanza from MAM: 1616035826277 :: For testing and experimenting BeagleIM also support private and public vcards ID of message in Archive == 77c8cab6-3468-4924-987b-c49c38e04e46 Received stanza from MAM: 1616035869404 :: I think I have not yet implemented in Convene setting user’s own vcard data, only downloading vcards for contacts ID of message in Archive == 0fb00983-1c0d-4387-bfcb-b94ec5d16824 Received stanza from MAM: 1616035869440 :: I think I have not yet implemented in Convene setting user’s own vcard data, only downloading vcards for contacts ID of message in Archive == 698dfd50-fe25-4557-9f4c-99c33e5e4084 Received stanza from MAM: 1616035892148 :: check method: handleVCardEvent in XMPPSession ID of message in Archive == fd071b0e-c3a6-402d-9926-7953fdca758d Received stanza from MAM: 1616035892195 :: check method: handleVCardEvent in XMPPSession ID of message in Archive == 5bd78c39-cf3a-476c-94f7-c528ef3813a6 Received stanza from MAM: 1616192168800 :: It seems that vCards are only downloaded about 20% of the time. I did 10 tests, and the vCard was only loaded 2 times. Is this an issue with connectivity? ID of message in Archive == ec5ac5d4-d4b5-4a9d-b36e-af7c715540e1 Received stanza from MAM: 1616192168861 :: null ID of message in Archive == 8b47ccb3-1c42-4ced-a2bf-8377f444c52e Received stanza from MAM: 1616192168897 :: null ID of message in Archive == 8ab8b9e4-47aa-4f56-ba2d-a034427df7d0 Received stanza from MAM: 1616413329930 :: @Sevan could you give more details? did you get any error? which accounts were you using? were you downloading your own vcard or for particular person? ID of message in Archive == 3458f087-5518-4661-87ff-f58870001620 Received stanza from MAM: 1616413330012 :: @Sevan could you give more details? did you get any error? which accounts were you using? were you downloading your own vcard or for particular person? ID of message in Archive == 2e073c99-7df1-425b-a1e1-4a4a8e8236c1 Received stanza from MAM: 1617016270929 :: ping? ID of message in Archive == 57fc64fa-9c41-4bd5-ab5c-d0a75f873823 Received stanza from MAM: 1617016271024 :: ping? ID of message in Archive == ded7e4ce-6aad-4e26-a3a1-7efab0a91b38 Received stanza from MAM: 1617018454123 :: pong ID of message in Archive == 51cde807-6d11-489d-a261-51c7443a6781 Received stanza from MAM: 1617018454171 :: pong ID of message in Archive == b9fd2d1a-ac67-4790-87d6-ca755f39fb64 Received stanza from MAM: 1617053815519 :: Sorry wojtek, I didn't check in on this tab for a few days. I'm using my sevan.evans@tigase.org XMPP account, and when downloading other users' vcards, it seems like it doesn't load 8 times out of 10. ID of message in Archive == 4e2805e8-7ce6-4015-9982-b2385eafa6ce Received stanza from MAM: 1617053815602 :: null ID of message in Archive == 813ebf96-fb8f-40dc-8a78-72d9e940a1ef Received stanza from MAM: 1617053815624 :: null ID of message in Archive == 84c90d7f-275c-49ab-acbc-4128a5da7acb Received stanza from MAM: 1617053845070 :: I'm not getting any errors in console ID of message in Archive == 20cd039d-91ba-4333-ac35-3fd7b2013c4f Received stanza from MAM: 1617053845168 :: null ID of message in Archive == b0b2a036-a209-4a40-a8e2-0e22263a609a Received stanza from MAM: 1617053845176 :: null ID of message in Archive == 7ab7b753-7d04-417f-a194-a14341785962 Received stanza from MAM: 1617053984293 :: It also seems like certain contacts don't load sometimes. In the contacts menu of Convene (tygrys), sometimes only 2 people show up. (wotjek, and artur) ID of message in Archive == 4b59911a-bccf-4a79-807b-98e76aa6a9c6 Received stanza from MAM: 1617053984369 :: null ID of message in Archive == 149ef2d6-25c3-4753-9950-48356319ab84 Received stanza from MAM: 1617053984373 :: null ID of message in Archive == b3024f41-8173-47dd-97f5-fe044e367273 Received stanza from MAM: 1617054014074 :: And often times, their vcard doesnt load. ID of message in Archive == 03794a18-4c53-491c-9e65-8987ddbd0966 Received stanza from MAM: 1617054014140 :: null ID of message in Archive == 4cc81885-e39f-4c10-9d99-73ede8cd6a34 Received stanza from MAM: 1617054014152 :: null ID of message in Archive == f70c5919-c690-4209-a51b-3c24ad859dfb Received stanza from MAM: 1617054197065 :: null ID of message in Archive == 652e4087-059d-43d7-b352-38d83b707b70 Received stanza from MAM: 1617054197912 :: null ID of message in Archive == 21f30932-8bde-499d-a892-92f85f49fbd7 Received stanza from MAM: 1617106057146 :: @Sevan this is quite weird. just to confirm - it doesn't work randomly for contacts or it doesn't work for any particular contact (and it's failing consistently)? ID of message in Archive == 62ed13f2-c3b9-42a9-b04b-7e54e13c5d54 Received stanza from MAM: 1617106057182 :: @Sevan this is quite weird. just to confirm - it doesn't work randomly for contacts or it doesn't work for any particular contact (and it's failing consistently)? ID of message in Archive == 8fb9d4a3-3767-4121-bc4e-b39f90b77076 Received stanza from MAM: 1617106085302 :: @kobit is there any console/debug log log in the convene app to try to troubleshoot it (either exception or no response from the server)? ID of message in Archive == 4551b4ed-d901-48b5-af5c-3617b67096bb Received stanza from MAM: 1617106085334 :: @kobit is there any console/debug log log in the convene app to try to troubleshoot it (either exception or no response from the server)? ID of message in Archive == 98cab435-814c-4369-bbcd-16b1df54b105 Received stanza from MAM: 1617111699557 :: null ID of message in Archive == df8af90e-82dd-40c0-82ca-e9290f77a5d4 Received stanza from MAM: 1617111699569 :: null ID of message in Archive == 3845ccbc-1bff-4391-bae5-05d0a6eccb90 Received stanza from MAM: 1617111700155 :: null ID of message in Archive == 907e7f20-5b6d-4055-8497-1f9602285242 Received stanza from MAM: 1617111700158 :: null ID of message in Archive == b7151216-d534-46c3-a424-d231627b52a3 Received stanza from MAM: 1617141472632 :: @wojtek It fails consistently for most contacts except for you and artur. I would have thought that it was because you both have v-cards associated with your account, but bartosz' doesn't load either, and he has a vcard. ID of message in Archive == b08552e6-9e97-461c-a7a5-43b100506b19 Received stanza from MAM: 1617141472700 :: null ID of message in Archive == 1bbc21a3-960b-42fc-9dfc-ed083a9440d7 Received stanza from MAM: 1617141472703 :: null ID of message in Archive == 08e2d355-00da-45d8-9d4f-c526bf3f6507 Received stanza from MAM: 1617141549427 :: For this launch, Wojciech, Andrzej, Bartosz, and RK were loaded. ID of message in Archive == 23cf508c-2554-45d7-aa3b-e5482293ec14 Received stanza from MAM: 1617141549490 :: null ID of message in Archive == beb3ea64-9a82-40e0-b97f-50aa21d8e9b8 Received stanza from MAM: 1617141549499 :: null ID of message in Archive == 462b51fe-52ac-43ea-a3aa-5586438e43da Received stanza from MAM: 1617141693546 :: Launch 2: #int did not load, nor did any contacts ID of message in Archive == 8d4f72e5-dc79-4872-82a4-2d6fbbf605d0 Received stanza from MAM: 1617141693613 :: null ID of message in Archive == c0e7a87a-24be-49f4-9f26-a4139c7c29b6 Received stanza from MAM: 1617141693620 :: null ID of message in Archive == cb1ec971-2e2c-4863-97f9-0600ab785c0d Received stanza from MAM: 1617141711304 :: Launch 3: All contacts loaded, as well as #int working. ID of message in Archive == d846d891-64c5-4a5c-8638-1abdf277df1e Received stanza from MAM: 1617141711356 :: null ID of message in Archive == 1b201e9b-8e1a-413c-9b59-29563c94bc03 Received stanza from MAM: 1617141711368 :: null ID of message in Archive == 9a3ee831-9d6b-4717-908e-91e81a00a9dd Received stanza from MAM: 1617141742165 :: Hm, strange, I did not experience problems like this ID of message in Archive == 8b6655e2-2c12-406f-89b8-73460dca8989 Received stanza from MAM: 1617141742256 :: null ID of message in Archive == cd524d5c-2f66-462a-9f4b-499ae7d86dac Received stanza from MAM: 1617141742279 :: null ID of message in Archive == bfdb550b-aec4-4399-ab14-8e87eef063a5 Received stanza from MAM: 1617141742282 :: null ID of message in Archive == a9d7e2f7-52dc-462e-abc3-d5b0309ce970 Received stanza from MAM: 1617141776411 :: Have you looked in the XML data sent to the server and received from the server? ID of message in Archive == 3c02b679-9c5c-493e-b62d-df7b82176662 Received stanza from MAM: 1617141776635 :: null ID of message in Archive == 50b38538-1133-48d6-9a3e-abdafa4a2f0b Received stanza from MAM: 1617141776663 :: null ID of message in Archive == e362feee-cb49-4c6d-83af-3059fa13c45c Received stanza from MAM: 1617141776666 :: null ID of message in Archive == e39135f4-eec4-47bf-8afc-954b7363ec2d Received stanza from MAM: 1617141804036 :: Maybe this is some kind of problem in procesding vcads and displaying them? ID of message in Archive == cd027043-59b3-4a6d-b79d-680e5e5746e2 Received stanza from MAM: 1617141804127 :: null ID of message in Archive == 7fe72d3c-ffdc-4d86-b07a-188c3e1d10ec Received stanza from MAM: 1617141804145 :: null ID of message in Archive == d45dd944-48fc-4c51-b8ac-162360994b93 Received stanza from MAM: 1617141804149 :: null ID of message in Archive == 41ecfab3-2fcd-499e-bbeb-183ae4275239 Received stanza from MAM: 1617141871534 :: null ID of message in Archive == 6fe98ec5-87ed-4ed8-82fc-dd7f85c75852 Received stanza from MAM: 1617141872396 :: null ID of message in Archive == af32ff63-a0f9-403a-b9b1-d19c00ab3f66 Received stanza from MAM: 1617141872480 :: null ID of message in Archive == 768d579c-f634-4a2d-bda6-28589e62d418 Received stanza from MAM: 1617141872799 :: null ID of message in Archive == fa97f334-ea94-46dc-b0a7-b979752b912f Received stanza from MAM: 1617141872863 :: null ID of message in Archive == 126d8d3c-8d64-44f2-8a62-6fa9eb099e63 Received stanza from MAM: 1617141873167 :: null ID of message in Archive == 6174878b-d4fb-4c12-89a8-99ff10dfd7b1 Received stanza from MAM: 1617141873172 :: null ID of message in Archive == 8059e5ec-e5a4-463d-858e-3451d56e7171 Received stanza from MAM: 1617141874071 :: null ID of message in Archive == 69ee506a-dc86-49fd-84fe-94161e188ede Received stanza from MAM: 1617141874290 :: null ID of message in Archive == c9fdbfa5-a0cf-4c36-9d36-7399c09a041e Received stanza from MAM: 1617141874492 :: null ID of message in Archive == 3fdff4c2-aa64-4db1-8d05-31b939d7100e Received stanza from MAM: 1617141874542 :: null ID of message in Archive == 77a46a1c-3eed-4a00-8d2d-06a5377148fb Received stanza from MAM: 1617141874627 :: null ID of message in Archive == 46323709-8d69-412f-b9b4-eee4fad69b2a Received stanza from MAM: 1617141874668 :: null ID of message in Archive == 1e72bf85-b23a-4541-bc7c-a096025796c7 Received stanza from MAM: 1617141874817 :: null ID of message in Archive == a562783f-dffc-4ec9-ae75-be092237ec56 Received stanza from MAM: 1617141950163 :: Are there logs that I can find and send to wojciech? ID of message in Archive == 21224dbc-6345-4bcb-85bf-2d13c1bec2ba Received stanza from MAM: 1617141950234 :: null ID of message in Archive == 7ad5c485-b002-4dd4-acb7-4cf80fdbfa81 Received stanza from MAM: 1617141950245 :: null ID of message in Archive == 96cda851-9da3-4048-acdd-b4562396d54f First 0: 950a029a-e515-4605-a5b3-1d27898e562b Last: 96cda851-9da3-4048-acdd-b4562396d54f Count: 695```
-
I just checked: this code
mamModule.query(with = "andrzej.wojcik@tigase.org", rsm = RSM.query { before() max(20) }).response { res -> res.onSuccess { println("Complete: ${it.complete} :: ${it.rsm}") } }.consume { forwardedStanza: ForwardedStanza<Message> -> println( "FROM MAM | ${forwardedStanza.resultId} ${ timestampToISO8601( forwardedStanza.timestamp!! ) } ${forwardedStanza.stanza.from?.localpart}: ${forwardedStanza.stanza.body}" ) }.send()
produces:
FROM MAM | a7b068b3-0be2-43d1-97cd-e890f6fd61ce 2021-07-06T15:52:48.191Z andrzej.wojcik: null FROM MAM | e6e4e1d7-03dd-41f7-a9ab-da363d41f983 2021-07-06T15:53:07.891Z bmalkow: Czy to taki skrót myślowy FROM MAM | d392e87d-129f-41fc-ac22-73d4f082e7f6 2021-07-06T15:53:08.106Z andrzej.wojcik: null FROM MAM | d19735cc-9500-46a0-909a-e88e14a7fa39 2021-07-06T15:53:11.606Z andrzej.wojcik: czyli w enum mam .lastItems(count:), .before(id:), .after(id:) FROM MAM | b7c61b34-83eb-4ae7-a9e1-f1e07209779f 2021-07-06T15:53:11.855Z bmalkow: null FROM MAM | 3b34288c-d8c3-489a-a362-40380e714c71 2021-07-06T15:53:11.913Z bmalkow: null FROM MAM | 3cef31b4-2a70-4da8-bffc-80685f9b954b 2021-07-06T15:53:55.313Z bmalkow: Wiem! Zrobię sobie dsla FROM MAM | e1616b89-48bb-4a1e-b4e2-b4d6202142cd 2021-07-06T15:53:55.528Z andrzej.wojcik: null FROM MAM | ebbfc3b0-c144-4612-8b1f-079b113e521a 2021-07-06T15:54:09.875Z bmalkow: Dzięki! FROM MAM | c69681f4-8763-4663-9908-874913b10513 2021-07-06T15:54:10.091Z andrzej.wojcik: null FROM MAM | 9b7c8d6f-c8db-451a-959d-c2f22036308d 2021-07-06T15:56:45.072Z andrzej.wojcik: nie ma za co FROM MAM | 5f4373a3-c7b7-421f-b1fb-61f0135e6ebe 2021-07-06T15:56:45.271Z bmalkow: null FROM MAM | 9be9077e-af35-467d-93b5-0962d20de75d 2021-07-06T15:56:45.402Z bmalkow: null FROM MAM | 776f955e-c918-4e30-93d1-e4123902b14f 2021-07-06T19:05:48.236Z bmalkow: null FROM MAM | 4a134b31-c07f-4682-823c-95a64692d3de 2021-07-06T19:42:52.197Z andrzej.wojcik: null FROM MAM | 3fc201b2-395b-4881-aaae-02a1afbc531c 2021-07-06T19:42:52.199Z andrzej.wojcik: null FROM MAM | 4ee4eaa2-ad5c-4a6e-85c8-61127e822966 2021-07-06T19:42:52.201Z andrzej.wojcik: null FROM MAM | 2f0c9f85-1c31-498b-af6d-fe549883b39a 2021-07-07T17:45:10.603Z andrzej.wojcik: null FROM MAM | df73b222-8af2-4b5b-977c-449611c6fd49 2021-07-07T17:45:10.613Z andrzej.wojcik: null FROM MAM | 5100344d-5816-4ba8-9e03-1405ad10782c 2021-07-07T17:45:10.615Z andrzej.wojcik: null Complete: true :: Result(first=a7b068b3-0be2-43d1-97cd-e890f6fd61ce, last=5100344d-5816-4ba8-9e03-1405ad10782c, index=72976, count=72996)
so it looks OK for me: I received last 20 messages from mam in conversation with Andrzej.
-
I just copy and pasted your code, but instead with arturs JID, as I don't believe i have any messages with Andrzej.
No messages were produced from it, unless these null bodies are messages?:
FROM MAM | 0f6f778a-16f1-41bd-93aa-5ae17e862da0 2021-04-07T19:54:51.309Z artur.hefczyc: null FROM MAM | 0c2c2358-0a76-4e60-8a57-fc844f491693 2021-04-07T19:54:51.330Z artur.hefczyc: null FROM MAM | b3ed53e2-a42a-4eef-bdd1-8e5411e5355e 2021-04-07T19:54:51.588Z artur.hefczyc: null FROM MAM | 7e121ac7-b31a-43a4-a776-93ffac2843e0 2021-04-07T19:54:51.609Z artur.hefczyc: null FROM MAM | 75609ab2-65dc-4677-ba29-359d429839bb 2021-04-07T19:54:51.645Z artur.hefczyc: null Complete: true :: Result(first=07cce62d-e0d1-45c5-9e7f-7c3e567e9fac, last=75609ab2-65dc-4677-ba29-359d429839bb, index=0, count=6)```
-
I just tried removing the max parameter, and I received the same log:
FROM MAM | 0f6f778a-16f1-41bd-93aa-5ae17e862da0 2021-04-07T19:54:51.309Z artur.hefczyc: null FROM MAM | 0c2c2358-0a76-4e60-8a57-fc844f491693 2021-04-07T19:54:51.330Z artur.hefczyc: null FROM MAM | b3ed53e2-a42a-4eef-bdd1-8e5411e5355e 2021-04-07T19:54:51.588Z artur.hefczyc: null FROM MAM | 7e121ac7-b31a-43a4-a776-93ffac2843e0 2021-04-07T19:54:51.609Z artur.hefczyc: null FROM MAM | 75609ab2-65dc-4677-ba29-359d429839bb 2021-04-07T19:54:51.645Z artur.hefczyc: null Complete: true :: Result(first=07cce62d-e0d1-45c5-9e7f-7c3e567e9fac, last=75609ab2-65dc-4677-ba29-359d429839bb, index=0, count=6)```
-
@bmalkow It looks like this might be the case. Especially, as "count" in the response is set to "6" which means that according to the request parameters (excluding RSM), only 6 messages in MAM were found.
-
I took the weekend to try & figure this out on my own, as I thought that I might have been missing something. I'm still out of luck, however.
When using the query
mamModule.query(rsm = RSM.query {before(); max(20)})
, It doesn't look like it obeys any of the parameters. It's not retrieving the most recent messages, nor is it delimiting to themax(20)
parameter.Also, does the max() parameter limit the amount of bodied messages, or overall message entries? As it looks in my tests, it doesn't limit either to 20, as I'm receiving 30 bodied messages.
-
I checked again, and it still works as in my previous example. When max==20 then I get 20 messages since index 72976. When I change max to 10: I get 10 messages since index 72986. If it doesn't works for you, then we have to debug it on stanza level: I need to know what client sends to server and when server sends in response.
-
12 July 2021 20:00 CEST ? https://us02web.zoom.us/j/83777438042
Type |
New Feature
|
Priority |
Normal
|
Assignee |
Asking for N latest messages from MAM, without defining time frames is currently hard. Change API of MAMModule to allow creating request to MAM what asks for just N latest messages.