clix/publish_atom.lua

changeset 93
8ab81c304073
parent 72
0f69e1902f5b
child 94
6f038202a502
equal deleted inserted replaced
92:a629b953780c 93:8ab81c304073
16 print("","--title=Soliloquy \\"); 16 print("","--title=Soliloquy \\");
17 print("","--summary=\"To be, or not to be: that is the question\""); 17 print("","--summary=\"To be, or not to be: that is the question\"");
18 return 0; 18 return 0;
19 end 19 end
20 local function on_connect(conn) 20 local function on_connect(conn)
21 conn:add_plugin"pubsub";
22 -- Required: id, title, updated, author (which must have a name) 21 -- Required: id, title, updated, author (which must have a name)
23 local entry_id = opts.entry_id or ("clix-"..new_uuid()); 22 local entry_id = opts.entry_id or ("clix-"..new_uuid());
24 local atom_entry = verse.stanza("entry", { xmlns="http://www.w3.org/2005/Atom" }) 23 local atom_entry = verse.stanza("entry", { xmlns="http://www.w3.org/2005/Atom" })
25 :tag("id"):text(entry_id):up(id) 24 :tag("id"):text(entry_id):up(id)
26 :tag("title"):text(opts.title or ""):up() 25 :tag("title"):text(opts.title or ""):up()
41 conn:close(); 40 conn:close();
42 end); 41 end);
43 42
44 --conn:send(verse.message({ to = opts.to, type = "chat" }) :body(text)); 43 --conn:send(verse.message({ to = opts.to, type = "chat" }) :body(text));
45 end 44 end
46 clix_connect(opts, on_connect); 45 clix_connect(opts, on_connect, {"pubsub"});
47 end 46 end

mercurial