summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Sluift/Examples/MAMRSM.lua')
-rw-r--r--Sluift/Examples/MAMRSM.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/Sluift/Examples/MAMRSM.lua b/Sluift/Examples/MAMRSM.lua
new file mode 100644
index 0000000..c8a1e85
--- /dev/null
+++ b/Sluift/Examples/MAMRSM.lua
@@ -0,0 +1,23 @@
+-- A query using Result Set Management
+-- Usage: ./sluift MAMRSM.lua <jid> <password> <query_dest> <max_results>
+
+sluift.debug = true
+
+c = sluift.new_client(arg[1], arg[2])
+
+c:connect();
+
+query = {
+ result_set={max_items=arg[4]}
+}
+
+c:set_mam{mam=query, to=arg[3]}
+
+c:for_each_message(function(e)
+ if e.payloads[1].tag == 'fin' then return true end
+ if e.payloads[1]._type == 'mam_result' then
+ print(e.payloads[1].payload.stanza.payloads[1].text)
+ end
+end)
+
+c:disconnect()