--- a/examples/xep0060.lua Sun Mar 15 20:45:24 2009 +0200
+++ b/examples/xep0060.lua Sun Mar 15 21:13:10 2009 +0200
@@ -84,7 +84,23 @@
},
},
},
- })
+ },
+ function ( conn, mess )
+ local mt, st = mess:type ()
+ if st == 'result' then
+ main.print_info ( to, 'Now you can run /form del ' .. fid .. ' to delete form from list' )
+ form.status = 'acquired'
+ elseif st == 'error' then
+ main.print_info ( to, 'Got non-successful response to form:\n' .. mess:xml () )
+ form.status = 'rejected'
+ else
+ print ( 'Weird response to submitted form:\n' .. mess:xml () )
+ form.status = 'unknown'
+ return false
+ end
+ return true
+ end )
+ form.status = 'sent'
end
forms[fid].status = 'filling'
main.print_info ( to, 'You have new form. To fill it, use /form ' .. fid .. ' fieldname value' )
--- a/examples/xep0077.lua Sun Mar 15 20:45:24 2009 +0200
+++ b/examples/xep0077.lua Sun Mar 15 21:13:10 2009 +0200
@@ -48,9 +48,13 @@
if st == 'result' then
main.print_info ( who, 'Now you can run /form del ' .. id .. ' to delete form from list' )
forms[id].status = 'acquired'
- else
+ elseif st == 'error' then
main.print_info ( who, 'Got non-successful response to form:\n' .. mess:xml () )
forms[id].status = 'rejected'
+ else
+ print ( 'Weird response to submitted form:\n' .. mess:xml () )
+ forms[id].status = 'unknown'
+ return false
end
return true
end
@@ -67,6 +71,7 @@
},
},
}, finalizer )
+ form.status = 'sent'
end
forms[id].status = 'filling'
main.print_info ( who, 'You have new form. To fill it, use /form ' .. id .. ' fieldname value' )
@@ -78,6 +83,7 @@
lm.message.create { mtype = 'iq-set', to = who,
query = format_iq_register ( form.val ),
}, finalizer )
+ form.status = 'sent'
end
forms[id].status = 'filling'
main.print_info ( who, 'You have new form. To fill it, use /form ' .. id .. ' fieldname value' )
@@ -122,12 +128,17 @@
if st == 'result' then
main.print_info ( who, 'Now you can run /form del ' .. id .. ' to delete form from list' )
forms[id].status = 'acquired'
- else
+ elseif st == 'error' then
main.print_info ( who, 'Got non-successful response to form:\n' .. mess:xml () )
forms[id].status = 'rejected'
+ else
+ print ( 'Weird response to submitted form:\n' .. mess:xml () )
+ forms[id].status = 'unknown'
+ return false
end
return true
end )
+ form.status = 'sent'
end
forms[id].status = 'filling'
main.print_info ( who, 'You have new form. To fill it, use /form ' .. id .. ' fieldname value' )
--- a/examples/xep0146.lua Sun Mar 15 20:45:24 2009 +0200
+++ b/examples/xep0146.lua Sun Mar 15 21:13:10 2009 +0200
@@ -21,13 +21,14 @@
function ( conn, mess )
if mess:child ( 'command' ) and mess:child( 'command' ):attribute ( 'status' ) == 'completed' then
main.print_info ( who, 'Now you can run /form del ' .. id .. ' to delete form from list' )
- forms[id].status = 'acquired'
+ forms.status = 'acquired'
else
main.print_info ( who, 'Got non-successful response to form:\n' .. mess:xml () )
- forms[id].status = 'rejected'
+ forms.status = 'rejected'
end
return true
end )
+ form.status = 'sent'
end
forms[id].status = 'filling'
main.print_info ( who, 'You have new form. To fill it, use /form ' .. id .. ' fieldname value' )