clix.watch_pep: Include short names for some common PEP nodes

Mon, 16 Nov 2020 17:16:01 +0100

author
Kim Alvefur <zash@zash.se>
date
Mon, 16 Nov 2020 17:16:01 +0100
changeset 142
05ec7103c0f7
parent 141
93eda3dd85f7
child 143
6b1fc3238318

clix.watch_pep: Include short names for some common PEP nodes

clix/watch_pep.lua file | annotate | diff | comparison | revisions
--- a/clix/watch_pep.lua	Mon Nov 16 17:15:38 2020 +0100
+++ b/clix/watch_pep.lua	Mon Nov 16 17:16:01 2020 +0100
@@ -1,5 +1,19 @@
 local verse = require "verse";
 
+local well_known = {
+	geoloc = "http://jabber.org/protocol/geoloc"; -- XEP-0080
+	avatar = "urn:xmpp:avatar:metadata"; -- XEP-0084
+	mood = "http://jabber.org/protocol/mood"; -- XEP-0107
+	activity = "http://jabber.org/protocol/activity"; -- XEP-0108
+	tune = "http://jabber.org/protocol/tune"; -- XEP-0118
+	nick = "http://jabber.org/protocol/nick"; -- XEP-0172
+	chatting = "urn:xmpp:chatting:0"; -- XEP-0194
+	browsing = "urn:xmpp:browsing:0"; -- XEP-0195
+	gaming = "urn:xmpp:gaming:0"; -- XEP-0196
+	viewing = "urn:xmpp:viewing:0"; -- XEP-0197
+	vcard4 = "urn:xmpp:vcard4"; -- XEP-0292
+};
+
 return function (opts, arg)
 	if opts.short_help or not arg[1] then
 		print("Watches PEP notifications from all contacts")
@@ -25,7 +39,7 @@
 
 	local function onconnect(conn)
 		for _, node in ipairs(arg) do
-			conn:hook_pep(node, handle_notification);
+			conn:hook_pep(well_known[node] or node, handle_notification);
 		end
 		if not opts.presence then
 			conn:send(verse.presence());

mercurial