Kim Alvefur
c888b5fd8d
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
16d07ca58c
core.moduleapi: Use resource path for :load_resource()
5 years ago
Kim Alvefur
291523df28
core.moduleapi: Allow passing a config table trough :measure
7 years ago
Kim Alvefur
d4c500cb06
moduleapi: Rename argument to silence luacheck
6 years ago
Kim Alvefur
ad142872d4
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
23ded0507b
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
ab5b83d85a
core.moduleapi: Rename local name for util.error for consistency
...
It's called 'errors' everywhere else except here.
6 years ago
Kim Alvefur
a24af51032
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
bd3c389d48
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
790a10f47d
core.moduleapi: Uppercase "IQ stanza" for consistency
...
It's written like that elsewhere in the send_iq method
6 years ago
Kim Alvefur
5336659f02
moduleapi: Prevent loading disabled module as dependency of enabled one
...
Explicitly disabled module should stay disabled.
7 years ago
Kim Alvefur
22839913a5
core.moduleapi: Remove redundant condition
7 years ago
Matthew Wild
2f6ae2f1fc
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
7e9fabadf4
moduleapi: Use :send API from :broadcast for compactness
8 years ago
Kim Alvefur
32e7b31ec7
moduleapi: Lazy-load statsmanager on demand
8 years ago
Kim Alvefur
aae7d4bce5
moduleapi: Lazy-load configmanager on demand simplify dependency graph
8 years ago
Kim Alvefur
65abcbb563
moduleapi: Remove unused and undocumented :has_feature and :has_identity
8 years ago
Kim Alvefur
9f6611dab7
moduleapi: Warn if a module being loaded as a dependency has been disabled
8 years ago
Kim Alvefur
054f116c7d
core.moduleapi: Factor out code for getting a scalar config option
9 years ago
Kim Alvefur
014168ff18
core: Split some very long lines [luacheck]
9 years ago
Matthew Wild
be752a7c9e
moduleapi: 'duration' became 'times'
10 years ago
Kim Alvefur
c82d43ec12
moduleapi: Allow an origin session to be passed to module:send()
10 years ago
Kim Alvefur
cecd6ca31d
loggingmanager,modulemanager,moduleapi: Ignore warning about accessing _G.unpack [luacheck]
10 years ago
Kim Alvefur
de7b01d7d2
loggingmanager,modulemanager,moduleapi: Localize unpack compatible with Lua 5.2+
10 years ago
Matthew Wild
166f2cfd89
moduleapi: Silence luacheck warning about unused 'id' parameter
10 years ago
Kim Alvefur
66a03adf5d
moduleapi: Add API method for getting a file path
10 years ago
Matthew Wild
d0c5e1571f
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
e75d7d79c9
moduleapi: Import util.stanza required for module:broadcast()
11 years ago
Matthew Wild
b3ab537add
moduleapi: Add luacheck annotation
11 years ago
Matthew Wild
f6e5d8089b
moduleapi: Minor variable renaming to avoid clashes with the 'type' function
11 years ago
Matthew Wild
d08df18e9c
moduleapi: Clear self.event_handlers when unhooking an event, to prevent leaks
11 years ago
Matthew Wild
3da0331d8a
moduleapi: module:measure_event(), module:measure_global_event(): Fix copy/paste error
11 years ago
Matthew Wild
82633f6735
moduleapi: Remove accidental use of undefined and unnecessary 'priority' variable
11 years ago
Matthew Wild
2648f37aa0
moduleapi: Add module:broadcast() to send a stanza to a list of JIDs
11 years ago
Matthew Wild
5b4edd3877
moduleapi: New methods for modules to conveniently wrap events
11 years ago
Matthew Wild
dca21b3a3d
moduleapi: Experimental API for modules to measure the rate+duration of events
11 years ago
Kim Alvefur
075278ff98
core.*: Remove use of module() function
11 years ago
Matthew Wild
5723bad906
moduleapi: Module API for statsmanager
11 years ago
Kim Alvefur
ad7e3d7233
core.module{manager,api}: Fix for 010b141e91ed (Thanks v1ct0r)
11 years ago
Kim Alvefur
3d4d152711
core.modulemanager, core.moduleapi: Hack around dependency loop
11 years ago
Kim Alvefur
1b3c4c26a1
core.moduleapi: Use require instead of global to get storagemanager in module:open_store()
11 years ago
Kim Alvefur
e31991a773
core.certmanager, core.moduleapi, mod_storage_sql, mod_storage_sql2: Import from util.paths
12 years ago
Waqas Hussain
c6d12b1a10
core.moduleapi: Fix some global accesses.
12 years ago
daurnimator
b2c50851b2
core/moduleapi: Return timer object from module:add_timer
12 years ago
Matthew Wild
11c4b857b8
moduleapi: Add module:unhook()
13 years ago
Florian Zeitz
4b618a8727
Remove all trailing whitespace
13 years ago
Matthew Wild
f7a578448d
moduleapi: module:get_host_type() now returns 'global' for * and 'local' for non-components
13 years ago
Kim Alvefur
82b393b7fc
moduleapi: in module:provides(), add the name of the module in item._provided_by
13 years ago
Kim Alvefur
0ccbb6e726
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
edecb033c4
moduleapi: Add module:get_option_inherited_set() to return a set that inherits items from a globally set set, if set
13 years ago