Software /
code /
prosody
Annotate
teal-src/util/dataforms.d.tl @ 12763:d26eefe98d09
util.dbuffer: Add efficient shortcuts for discard() in certain cases
If the buffer is already empty, nothing to do. If we're throwing away the
whole buffer, we can just empty it and avoid read_chunk() (which in turn
may collapse()). These shortcuts are much more efficient.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 11 Oct 2022 11:37:55 +0100 |
parent | 12615:b2047b82ec85 |
rev | line source |
---|---|
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local stanza_t = require "util.stanza".stanza_t |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
3 local record lib |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
4 record dataform |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
5 title : string |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
6 instructions : string |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
7 |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
8 record form_field |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
10 enum field_type |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
11 "boolean" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
12 "fixed" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
13 "hidden" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
14 "jid-multi" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
15 "jid-single" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
16 "list-multi" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
17 "list-single" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
18 "text-multi" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
19 "text-private" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
20 "text-single" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
21 end |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
23 type : field_type |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
24 var : string -- protocol name |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
25 name : string -- internal name |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
27 label : string |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
28 desc : string |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
30 datatype : string |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
31 range_min : number |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
32 range_max : number |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
34 value : any -- depends on field_type |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
35 options : table |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
36 end |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
38 { form_field } |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
40 enum form_type |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
41 "form" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
42 "submit" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
43 "cancel" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
44 "result" |
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
45 end |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
47 form : function ( dataform, { string : any }, form_type ) : stanza_t |
12615
b2047b82ec85
util.dataforms: Add missing :data() to Teal definition
Kim Alvefur <zash@zash.se>
parents:
12614
diff
changeset
|
48 data : function ( dataform, stanza_t ) : { string : any } |
12614
d498e7e7853a
util.dataforms: Restructure Teal definition file
Kim Alvefur <zash@zash.se>
parents:
11432
diff
changeset
|
49 end |
11432
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 new : function ( dataform ) : dataform |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
52 end |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
53 |
113f3912c7cb
util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 return lib |