clix/publish_atom.lua

changeset 130
11d526d74460
parent 129
e805c014efa9
child 168
75e8ca131178
equal deleted inserted replaced
129:e805c014efa9 130:11d526d74460
8 return function (opts, arg) 8 return function (opts, arg)
9 if opts.short_help then 9 if opts.short_help then
10 print("Publish an Atom entry to a pubsub node"); 10 print("Publish an Atom entry to a pubsub node");
11 return; 11 return;
12 end 12 end
13 if opts.help or not opts.node then 13 if opts.help or not (opts.node or opts.title or opts.content) then
14 print("clix publish_atom \\"); 14 print("clix publish_atom \\");
15 print("","--service=pubsub.shakespeare.lit \\"); 15 print("","--service=pubsub.shakespeare.lit \\");
16 print("","--node=princely_musings \\"); 16 print("","--node=princely_musings \\");
17 print("","--id=123 \\"); 17 print("","--id=123 \\");
18 print("","--author=Hamlet \\"); 18 print("","--author=Hamlet \\");
42 atom_entry:tag(opt:sub(4), { xmlns = xmlns_activitystreams } ) 42 atom_entry:tag(opt:sub(4), { xmlns = xmlns_activitystreams } )
43 :text(optval):up(); 43 :text(optval):up();
44 end 44 end
45 end 45 end
46 46
47 conn.pubsub(opts.service, opts.node):publish(entry_id, nil, atom_entry 47 conn.pubsub(opts.service, opts.node or "urn:xmpp:microblog:0"):publish(entry_id, nil, atom_entry
48 , function(ok) 48 , function(ok)
49 -- TODO Report success? 49 -- TODO Report success?
50 conn:close(); 50 conn:close();
51 end); 51 end);
52 52

mercurial