--- 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' )