1 local verse = require "verse"; |
1 local verse = require "verse"; |
|
2 |
|
3 local well_known = { |
|
4 geoloc = "http://jabber.org/protocol/geoloc"; -- XEP-0080 |
|
5 avatar = "urn:xmpp:avatar:metadata"; -- XEP-0084 |
|
6 mood = "http://jabber.org/protocol/mood"; -- XEP-0107 |
|
7 activity = "http://jabber.org/protocol/activity"; -- XEP-0108 |
|
8 tune = "http://jabber.org/protocol/tune"; -- XEP-0118 |
|
9 nick = "http://jabber.org/protocol/nick"; -- XEP-0172 |
|
10 chatting = "urn:xmpp:chatting:0"; -- XEP-0194 |
|
11 browsing = "urn:xmpp:browsing:0"; -- XEP-0195 |
|
12 gaming = "urn:xmpp:gaming:0"; -- XEP-0196 |
|
13 viewing = "urn:xmpp:viewing:0"; -- XEP-0197 |
|
14 vcard4 = "urn:xmpp:vcard4"; -- XEP-0292 |
|
15 }; |
2 |
16 |
3 return function (opts, arg) |
17 return function (opts, arg) |
4 if opts.short_help or not arg[1] then |
18 if opts.short_help or not arg[1] then |
5 print("Watches PEP notifications from all contacts") |
19 print("Watches PEP notifications from all contacts") |
6 print("clix watch_pep [--noempty] PEP-NODE+") |
20 print("clix watch_pep [--noempty] PEP-NODE+") |
23 end |
37 end |
24 end |
38 end |
25 |
39 |
26 local function onconnect(conn) |
40 local function onconnect(conn) |
27 for _, node in ipairs(arg) do |
41 for _, node in ipairs(arg) do |
28 conn:hook_pep(node, handle_notification); |
42 conn:hook_pep(well_known[node] or node, handle_notification); |
29 end |
43 end |
30 if not opts.presence then |
44 if not opts.presence then |
31 conn:send(verse.presence()); |
45 conn:send(verse.presence()); |
32 end |
46 end |
33 end |
47 end |