Ping fixes
authorMyhailo Danylenko <isbear@ukrpost.net>
Mon, 23 Mar 2009 04:17:02 +0200
changeset 60 b9fd051c0d7c
parent 59 4660c4f10ef1
child 61 5182f466da7d
Ping fixes
TODO
examples/ping.lua
examples/x_data.lua
--- a/TODO	Mon Mar 23 04:16:22 2009 +0200
+++ b/TODO	Mon Mar 23 04:17:02 2009 +0200
@@ -20,4 +20,5 @@
 tune should set self-song only on reply from server
 test node config
 publish library handlers?
+fix add_feature to 1) not add existing items 2) not add default items
 
--- a/examples/ping.lua	Mon Mar 23 04:16:22 2009 +0200
+++ b/examples/ping.lua	Mon Mar 23 04:17:02 2009 +0200
@@ -11,7 +11,10 @@
 ping = { }
 
 function ping.send ( conn, to, success, fail )
-	iq.send ( conn, to, 'get', success, fail )
+	iq.send ( conn, to, 'get',
+		{
+			ping = { xmlns = 'urn:xmpp:ping' },
+		}, success, fail )
 end
 
 -- private
@@ -42,13 +45,14 @@
 		local time = os.time ()
 		ping.send ( lm.connection.bless ( main.connection () ), who,
 			function ()
-				main.print_info ( ('Pong: %d seconds'):format ( os.time () - time ) )
+				main.print_info ( who, ('Pong: %d seconds'):format ( os.time () - time ) )
 			end,
 			function ( mesg )
-				main.print_info ( 'Ping failed: ' .. mesg )
+				main.print_info ( who, 'Ping failed: ' .. mesg )
 			end )
 	end, true, 'jid' )
 
+--[[
 local ping_handler_registered = false
 
 hooks_d['hook-post-connect'].ping =
@@ -65,5 +69,6 @@
 	end
 
 main.add_feature ( 'urn:xmpp:ping' )
+--]]
 
 -- vim: se ts=4: --
--- a/examples/x_data.lua	Mon Mar 23 04:16:22 2009 +0200
+++ b/examples/x_data.lua	Mon Mar 23 04:17:02 2009 +0200
@@ -206,6 +206,6 @@
 		end
 	end, true, form_cid )
 
-commands_help['form'] = "[del form_id | send form_id | form_id [field_name {clear | [set] value}]\n\nWith bare form id prints info on that form.\nWith field name sets or clears field value. Set subcommand is optional, just to allow values, starting with 'clear'.\nWithout arguments prints form list."
+commands_help['form'] = "[form_id [send | reject | [set] fieldname [value]]]\n\nWithout arguments prints form list.\nWith bare form id prints info on that form.\nWhen setting multivalue field, new values are added, not replacing previous.\nWithout value unsets field, multivalue fields lose all their values."
 
 -- vim: se ts=4: --