Annotate

teal-src/module.d.tl @ 12807:f0f7b0c61465

mod_s2s: Avoid sending too large stanzas Just dropping them isn't great but hopefully something more sensible can be done in the future. Will need work to ensure that this signal is handled correctly in sending modules etc.
author Kim Alvefur <zash@zash.se>
date Tue, 16 Mar 2021 18:30:54 +0100
parent 12643:9fa749cbd376
child 12979:fbbf4f0db8f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11941
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 local st = require"util.stanza"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 global record moduleapi
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 get_name : function (moduleapi) : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 get_host : function (moduleapi) : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 enum host_type
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 "global"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 "local"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 "component"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 get_host_type : function (moduleapi) : host_type
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 set_global : function (moduleapi)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 add_feature : function (moduleapi, string)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 add_identity : function (moduleapi, string, string, string) -- TODO enum?
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 add_extension : function (moduleapi, st.stanza_t)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 fire_event : function (moduleapi, string, any) : any
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 type handler = function (any) : any
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 record util_events
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 -- TODO import def
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 hook_object_event : function (moduleapi, util_events, string, handler, number)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 unhook_object_event : function (moduleapi, util_events, string, handler)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 hook : function (moduleapi, string, handler, number)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 hook_global : function (moduleapi, string, handler, number)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 hook_tag : function (moduleapi, string, string, handler, number)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 unhook : function (moduleapi, string, handler)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 wrap_object_event : function (moduleapi, util_events, string, handler)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 wrap_event : function (moduleapi, string, handler)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 wrap_global : function (moduleapi, string, handler)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 require : function (moduleapi, string) : table
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31 depends : function (moduleapi, string) : table
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 shared : function (moduleapi, string) : table
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 type config_getter = function<A> (moduleapi, string, A) : A
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 get_option : config_getter<any>
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 get_option_scalar : config_getter<nil | boolean | number | string>
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 get_option_string : config_getter<string>
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37 get_option_number : config_getter<number>
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 get_option_boolean : config_getter<boolean>
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39 record util_array
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
40 -- TODO import def
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41 { any }
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 get_option_array : config_getter<util_array>
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
44 record util_set
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
45 -- TODO import def
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
46 _items : { any : boolean }
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
47 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
48 get_option_set : function (moduleapi, string, { any }) : util_set
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
49 get_option_inherited_set : function (moduleapi, string, { any }) : util_set
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
50 get_option_path : function (moduleapi, string, string, string) : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
51 context : function (moduleapi, string) : moduleapi
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
52 add_item : function (moduleapi, string, any)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
53 remove_item : function (moduleapi, string, any)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
54 get_host_items : function (moduleapi, string) : { any }
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
55 handle_items : function (moduleapi, string, handler, handler, boolean)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
56 provides : function (moduleapi, string, table)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
57 record util_session
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
58 -- TODO import def
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
59 send : function ( st.stanza_t | string )
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
60 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
61 send : function (moduleapi, st.stanza_t, util_session)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
62 send_iq : function (moduleapi, st.stanza_t, util_session, number)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
63 broadcast : function (moduleapi, { string }, st.stanza_t, function)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
64 type timer_callback = function (number, ... : any) : number
12502
5862ddf71e3c teal/moduleapi: Describe timer wrapper
Kim Alvefur <zash@zash.se>
parents: 11941
diff changeset
65 record timer_wrapper
5862ddf71e3c teal/moduleapi: Describe timer wrapper
Kim Alvefur <zash@zash.se>
parents: 11941
diff changeset
66 stop : function (timer_wrapper)
5862ddf71e3c teal/moduleapi: Describe timer wrapper
Kim Alvefur <zash@zash.se>
parents: 11941
diff changeset
67 disarm : function (timer_wrapper)
5862ddf71e3c teal/moduleapi: Describe timer wrapper
Kim Alvefur <zash@zash.se>
parents: 11941
diff changeset
68 reschedule : function (timer_wrapper, number)
5862ddf71e3c teal/moduleapi: Describe timer wrapper
Kim Alvefur <zash@zash.se>
parents: 11941
diff changeset
69 end
5862ddf71e3c teal/moduleapi: Describe timer wrapper
Kim Alvefur <zash@zash.se>
parents: 11941
diff changeset
70 add_timer : function (moduleapi, number, timer_callback, ... : any) : timer_wrapper
11941
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
71 get_directory : function (moduleapi) : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
72 enum file_mode
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
73 "r" "w" "a" "r+" "w+" "a+"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
74 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
75 load_resource : function (moduleapi, string, file_mode) : FILE
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
76 enum store_type
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
77 "keyval"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
78 "map"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
79 "archive"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
80 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
81 open_store : function (moduleapi, string, store_type)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
82 enum stat_type
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
83 "amount"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
84 "counter"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
85 "rate"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
86 "distribution"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
87 "sizes"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
88 "times"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
89 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
90 record stats_conf
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
91 initial : number
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
92 units : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
93 type : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
94 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
95 measure : function (moduleapi, string, stat_type, stats_conf)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
96 measure_object_event : function (moduleapi, util_events, string, string)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
97 measure_event : function (moduleapi, string, string)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
98 measure_global_event : function (moduleapi, string, string)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
99 enum status_type
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
100 "error"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
101 "warn"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
102 "info"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
103 "core"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
104 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
105 set_status : function (moduleapi, status_type, string, boolean)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
106 enum log_level
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
107 "debug"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
108 "info"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
109 "warn"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
110 "error"
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
111 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
112 log_status : function (moduleapi, log_level, string, ... : any)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
113 get_status : function (moduleapi) : status_type, string, number
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
114
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
115 -- added by modulemanager
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
116 name : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
117 host : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
118 _log : function (log_level, string, ... : any)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
119 log : function (moduleapi, log_level, string, ... : any)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
120 reloading : boolean
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
121 saved_state : any
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
122 record module_environment
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
123 module : moduleapi
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
124 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
125 environment : module_environment
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
126 path : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
127 resource_path : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
128
12643
9fa749cbd376 teal-src: update module.d.tl with new access control methods
Matthew Wild <mwild1@gmail.com>
parents: 12502
diff changeset
129 -- access control
9fa749cbd376 teal-src: update module.d.tl with new access control methods
Matthew Wild <mwild1@gmail.com>
parents: 12502
diff changeset
130 may : function (moduleapi, string, table|string)
9fa749cbd376 teal-src: update module.d.tl with new access control methods
Matthew Wild <mwild1@gmail.com>
parents: 12502
diff changeset
131 default_permission : function (string, string)
9fa749cbd376 teal-src: update module.d.tl with new access control methods
Matthew Wild <mwild1@gmail.com>
parents: 12502
diff changeset
132 default_permissions : function (string, { string })
9fa749cbd376 teal-src: update module.d.tl with new access control methods
Matthew Wild <mwild1@gmail.com>
parents: 12502
diff changeset
133
11941
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
134 -- methods the module can add
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
135 load : function ()
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
136 add_host : function (moduleapi)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
137 save : function () : any
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
138 restore : function (any)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
139 unload : function ()
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
140 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
141
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
142 global module : moduleapi
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
143
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
144 global record common_event
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
145 stanza : st.stanza_t
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
146 record origin
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
147 send : function (st.stanza_t)
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
148 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
149 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
150
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
151 global record prosody
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
152 version : string
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
153 end
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
154
cfd37453e6b6 teal: Describe the module API interface
Kim Alvefur <zash@zash.se>
parents:
diff changeset
155 return module