examples/xep0060.lua
changeset 25 38c68c285e41
parent 24 25552b21d3fb
child 26 fc83934f9b8d
equal deleted inserted replaced
24:25552b21d3fb 25:38c68c285e41
    82 											x = { xmlns = 'jabber:x:data', type = 'submit',
    82 											x = { xmlns = 'jabber:x:data', type = 'submit',
    83 												field = form.val,
    83 												field = form.val,
    84 											},
    84 											},
    85 										},
    85 										},
    86 									},
    86 									},
    87 								})
    87 								},
       
    88 								function ( conn, mess )
       
    89 									local mt, st = mess:type ()
       
    90 									if st == 'result' then
       
    91 										main.print_info ( to, 'Now you can run /form del ' .. fid .. ' to delete form from list' )
       
    92 										form.status = 'acquired'
       
    93 									elseif st == 'error' then
       
    94 										main.print_info ( to, 'Got non-successful response to form:\n' .. mess:xml () )
       
    95 										form.status = 'rejected'
       
    96 									else
       
    97 										print ( 'Weird response to submitted form:\n' .. mess:xml () )
       
    98 										form.status = 'unknown'
       
    99 										return false
       
   100 									end
       
   101 									return true
       
   102 								end )
       
   103 							form.status = 'sent'
    88 						end
   104 						end
    89 					forms[fid].status = 'filling'
   105 					forms[fid].status = 'filling'
    90 					main.print_info ( to, 'You have new form. To fill it, use /form ' .. fid .. ' fieldname value' )
   106 					main.print_info ( to, 'You have new form. To fill it, use /form ' .. fid .. ' fieldname value' )
    91 				else
   107 				else
    92 					main.print_info ( to, 'Weird, no error and no node configuration form: ' .. mess:xml () )
   108 					main.print_info ( to, 'Weird, no error and no node configuration form: ' .. mess:xml () )