Kim Alvefur
d53dcee890
core.moduleapi: Return resource path from module:get_directory() (API BC)
...
:get_directory has so far returned the base directory of the current
module source code. This has worked well so far to load resources which
tend to be included in the same directory, but with the plugin installer
using LuaRocks, extra resources (e.g. templates and other assets) these
are saved in a completely different directory.
In be73df6765b9 core.modulemanager gained some code for finding that
directory and saving it in module.resource_path but now the question is
how this should be reflected in the API.
A survey of community modules suggest the vast majority use the
:get_directory method for locating templates and other assets, rather
than the code (which would use module:require instead).
Therefore this commit changes :get_directory to return the resource_path
when available. This should work for most modules.
5 years ago
Kim Alvefur
58be93c184
core.moduleapi: Use resource path for :load_resource()
5 years ago
Kim Alvefur
1f80e42aa5
core.moduleapi: Allow passing a config table trough :measure
7 years ago
Kim Alvefur
38742f7b50
moduleapi: Rename argument to silence luacheck
6 years ago
Kim Alvefur
7e181e31e0
moduleapi: Fix handling of replies to :send_iq from internal modules
...
Unclear exactly why, but replies to some queries to local modules would
be discarded by stanza_router. This appears to fix it.
6 years ago
Kim Alvefur
3db27c3696
core.moduleapi: Hook correct event type in some cases
...
In rare cases, module.host can be a bare JID, in which case this test
did the wrong thing.
6 years ago
Kim Alvefur
adc4440fd8
core.moduleapi: Rename local name for util.error for consistency
...
It's called 'errors' everywhere else except here.
6 years ago
Kim Alvefur
cdd6144dcc
core.moduleapi: Fix error context in :send_iq API
...
It got passed as argument to reject() instead of the util.error
function and was lost.
6 years ago
Kim Alvefur
e0125bcb4c
core.moduleapi: Restructure send_iq method for more atomic cleanup
...
All cleanup in one spot instead of two, and at the end which fits with
cleanup happening afterwards.
6 years ago
Kim Alvefur
2dd7b57175
core.moduleapi: Uppercase "IQ stanza" for consistency
...
It's written like that elsewhere in the send_iq method
6 years ago
Kim Alvefur
fb6abdb161
moduleapi: Prevent loading disabled module as dependency of enabled one
...
Explicitly disabled module should stay disabled.
7 years ago
Kim Alvefur
2de254acf7
core.moduleapi: Remove redundant condition
7 years ago
Matthew Wild
10fe4432f4
moduleapi: Remove multiple-parameters feature from module:shared()
...
Multiple paths are rarely used, and leads to less clear code than just
calling module:shared() once per shared table. It also prevents us from
extending the API with new parameters in the future.
8 years ago
Kim Alvefur
c86e5f565c
moduleapi: Use :send API from :broadcast for compactness
8 years ago
Kim Alvefur
b58c44e43a
moduleapi: Lazy-load statsmanager on demand
8 years ago
Kim Alvefur
5884db59cc
moduleapi: Lazy-load configmanager on demand simplify dependency graph
8 years ago
Kim Alvefur
61c6bb76de
moduleapi: Remove unused and undocumented :has_feature and :has_identity
8 years ago
Kim Alvefur
9526273a1b
moduleapi: Warn if a module being loaded as a dependency has been disabled
8 years ago
Kim Alvefur
911bea7746
core.moduleapi: Factor out code for getting a scalar config option
9 years ago
Kim Alvefur
1ecc3a7918
core: Split some very long lines [luacheck]
9 years ago
Matthew Wild
e2dbea53b4
moduleapi: 'duration' became 'times'
9 years ago
Kim Alvefur
bb95b569ef
moduleapi: Allow an origin session to be passed to module:send()
10 years ago
Kim Alvefur
e349fb9c87
loggingmanager,modulemanager,moduleapi: Ignore warning about accessing _G.unpack [luacheck]
10 years ago
Kim Alvefur
bad300a675
loggingmanager,modulemanager,moduleapi: Localize unpack compatible with Lua 5.2+
10 years ago
Matthew Wild
ee4541c4d8
moduleapi: Silence luacheck warning about unused 'id' parameter
10 years ago
Kim Alvefur
2ab1810f7d
moduleapi: Add API method for getting a file path
10 years ago
Matthew Wild
a1e077c5e7
modulemanager, util.pluginloader: Move logic for locating some module libraries to pluginloader, to fix problems with non-filesystem errors being masked by the second load_code call
10 years ago
Matthew Wild
dfcb1b6c06
moduleapi: Import util.stanza required for module:broadcast()
11 years ago
Matthew Wild
a068b1d383
moduleapi: Add luacheck annotation
11 years ago
Matthew Wild
e5323b0c7f
moduleapi: Minor variable renaming to avoid clashes with the 'type' function
11 years ago
Matthew Wild
343f4f8c29
moduleapi: Clear self.event_handlers when unhooking an event, to prevent leaks
11 years ago
Matthew Wild
07fcf555ba
moduleapi: module:measure_event(), module:measure_global_event(): Fix copy/paste error
11 years ago
Matthew Wild
aec67b444e
moduleapi: Remove accidental use of undefined and unnecessary 'priority' variable
11 years ago
Matthew Wild
1b81160835
moduleapi: Add module:broadcast() to send a stanza to a list of JIDs
11 years ago
Matthew Wild
b3965a9069
moduleapi: New methods for modules to conveniently wrap events
11 years ago
Matthew Wild
be7107c0ab
moduleapi: Experimental API for modules to measure the rate+duration of events
11 years ago
Kim Alvefur
27265c20e2
core.*: Remove use of module() function
11 years ago
Matthew Wild
e0c0cffcc2
moduleapi: Module API for statsmanager
11 years ago
Kim Alvefur
b58d3248b7
core.module{manager,api}: Fix for 010b141e91ed (Thanks v1ct0r)
11 years ago
Kim Alvefur
93a297bc8f
core.modulemanager, core.moduleapi: Hack around dependency loop
11 years ago
Kim Alvefur
a36064641e
core.moduleapi: Use require instead of global to get storagemanager in module:open_store()
11 years ago
Kim Alvefur
36b77bca8b
core.certmanager, core.moduleapi, mod_storage_sql, mod_storage_sql2: Import from util.paths
12 years ago
Waqas Hussain
37895d0d71
core.moduleapi: Fix some global accesses.
12 years ago
daurnimator
f725efa472
core/moduleapi: Return timer object from module:add_timer
12 years ago
Matthew Wild
88613e4e18
moduleapi: Add module:unhook()
12 years ago
Florian Zeitz
1d833bb807
Remove all trailing whitespace
13 years ago
Matthew Wild
c8e0c8a63b
moduleapi: module:get_host_type() now returns 'global' for * and 'local' for non-components
13 years ago
Kim Alvefur
d9bff06d21
moduleapi: in module:provides(), add the name of the module in item._provided_by
13 years ago
Kim Alvefur
7ad8f743bb
moduleapi: module:provides called without an item makes a copy of the environment instead. Fixes warnings about non-existent globals
13 years ago
Matthew Wild
bcc1074dd5
moduleapi: Add module:get_option_inherited_set() to return a set that inherits items from a globally set set, if set
13 years ago