Skip to content

make timeout var dynamic #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions matrix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,16 @@ function matrix_away_command_run_cb(data, buffer, args)
end

function configuration_changed_cb(data, option, value)
if value == 'on' then
DEBUG = true
w.print('', SCRIPT_NAME..': debugging messages enabled')
else
DEBUG = false
w.print('', SCRIPT_NAME..': debugging messages disabled')
if option == 'plugins.var.lua.matrix.timeout' then
timeout = tonumber(value)*1000
elseif option == 'plugins.var.lua.matrix.debug' then
if value == 'on' then
DEBUG = true
w.print('', SCRIPT_NAME..': debugging messages enabled')
else
DEBUG = false
w.print('', SCRIPT_NAME..': debugging messages disabled')
end
end
end

Expand Down Expand Up @@ -3360,6 +3364,7 @@ if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT
end

w.hook_config('plugins.var.lua.matrix.debug', 'configuration_changed_cb', '')
w.hook_config('plugins.var.lua.matrix.timeout', 'configuration_changed_cb', '')

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