clix.publish_atom: Don't quit until the server responds to our publish request.

Sun, 19 Feb 2012 23:50:09 +0100

author
Kim Alvefur <zash@zash.se>
date
Sun, 19 Feb 2012 23:50:09 +0100
changeset 71
075ecfa46484
parent 70
5e93cfc73444
child 72
0f69e1902f5b

clix.publish_atom: Don't quit until the server responds to our publish request.

clix/publish_atom.lua file | annotate | diff | comparison | revisions
--- a/clix/publish_atom.lua	Sun Feb 12 20:45:06 2012 +0000
+++ b/clix/publish_atom.lua	Sun Feb 19 23:50:09 2012 +0100
@@ -35,10 +35,13 @@
 			atom_entry:tag("content"):text(opts.content):up();
 		end
 
-		conn.pubsub(opts.service, opts.node):publish(entry_id, nil, atom_entry);
+		conn.pubsub(opts.service, opts.node):publish(entry_id, nil, atom_entry
+		, function(ok)
+			-- TODO Report success?
+			conn:close();
+		end);
 
 		--conn:send(verse.message({ to = opts.to, type = "chat" }) :body(text));
-		conn:close();
 	end
 	clix_connect(opts, on_connect);
 end

mercurial