Sun, 15 Nov 2020 15:05:24 +0100
clix.watch_pep: Subscribe to a PEP node
local verse = require "verse"; return function (opts, arg) if opts.short_help then print("Watches PEP notifications from all contacts") print("clix watch_pep [--node PEP-NODE] [--noempty]") return; end local function onconnect(conn) conn:hook_pep(opts.node or "urn:xmpp:microblog:0", function (event) local payload = event.item; if not payload then return end if opts.noempty and not payload[1] then return end if event.from then io.stderr:write("# From "..event.from.."\n"); end if payload.attr.xmlns == "urn:xmpp:json:0" then print(payload:get_tex()) elseif opts.pretty then print(payload:indent(nil, " ")); else print(payload); end end); if not opts.presence then conn:send(verse.presence()); end end clix_connect(opts, onconnect, {"pep"}) end;