Skip to content

Commit a8e4ce0

Browse files
authored
Merge pull request #94 from erdnaxeli/timeout
make timeout var dynamic
2 parents d11a37a + c516b4c commit a8e4ce0

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

matrix.lua

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,16 @@ function matrix_away_command_run_cb(data, buffer, args)
413413
end
414414

415415
function configuration_changed_cb(data, option, value)
416-
if value == 'on' then
417-
DEBUG = true
418-
w.print('', SCRIPT_NAME..': debugging messages enabled')
419-
else
420-
DEBUG = false
421-
w.print('', SCRIPT_NAME..': debugging messages disabled')
416+
if option == 'plugins.var.lua.matrix.timeout' then
417+
timeout = tonumber(value)*1000
418+
elseif option == 'plugins.var.lua.matrix.debug' then
419+
if value == 'on' then
420+
DEBUG = true
421+
w.print('', SCRIPT_NAME..': debugging messages enabled')
422+
else
423+
DEBUG = false
424+
w.print('', SCRIPT_NAME..': debugging messages disabled')
425+
end
422426
end
423427
end
424428

@@ -3369,6 +3373,7 @@ if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT
33693373
end
33703374

33713375
w.hook_config('plugins.var.lua.matrix.debug', 'configuration_changed_cb', '')
3376+
w.hook_config('plugins.var.lua.matrix.timeout', 'configuration_changed_cb', '')
33723377

33733378
local cmds = {'help', 'connect', 'debug', 'msg'}
33743379
w.hook_command(SCRIPT_COMMAND, 'Plugin for matrix.org chat protocol',

0 commit comments

Comments
 (0)