# HG changeset patch # User Kim Alvefur # Date 1537713783 -7200 # Node ID 7d39ffd058d5884a574487986bd3a33561d3cb3e # Parent 3af2da0303979a36f94091bfc4124745cc193fd9 mod_pubsub_text_interface: Handle lack of `pubsub:get_last_item` in Prosody 0.10 diff -r 3af2da030397 -r 7d39ffd058d5 mod_pubsub_text_interface/mod_pubsub_text_interface.lua --- a/mod_pubsub_text_interface/mod_pubsub_text_interface.lua Sun Sep 23 14:20:06 2018 +0200 +++ b/mod_pubsub_text_interface/mod_pubsub_text_interface.lua Sun Sep 23 16:43:03 2018 +0200 @@ -12,9 +12,10 @@ - `help` - this help message - `list` - list available nodes - `subscribe node` - subscribe to a node -- `unsubscribe node` - unsubscribe from a node -- `last node` - send the last item (again) -]]; +- `unsubscribe node` - unsubscribe from a node]]; +if pubsub.get_last_item then -- COMPAT not available in 0.10 + help = help .. "\n- `last node` - send the last item (again)" +end module:hook("message/host", function (event) local origin, stanza = event.origin, event.stanza; @@ -48,7 +49,7 @@ elseif command == "unsubscribe" then local ok, err = pubsub:remove_subscription(node_arg, from, jid.bare(from)); reply:body(ok and "OK" or err); - elseif command == "last" then + elseif command == "last" and pubsub.get_last_item then local ok, item_id, item = pubsub:get_last_item(node_arg, from); if not ok then reply:body(item_id); -- err message