summaryrefslogtreecommitdiffstats
path: root/vmail-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'vmail-model.lua')
-rw-r--r--vmail-model.lua41
1 files changed, 22 insertions, 19 deletions
diff --git a/vmail-model.lua b/vmail-model.lua
index f329b27..2b53a9e 100644
--- a/vmail-model.lua
+++ b/vmail-model.lua
@@ -236,27 +236,30 @@ local getuserparams = function(username)
end
end
end
- if retval.username and username then retval.username.value = username end
- local users = listusers(username)
- if #users == 1 then
- -- Get password from voicemail_prefs
- sql = "SELECT password FROM voicemail_prefs"..generatewhereclause(username)
- local password = getselectresponse(sql)
- if retval["vm-password"] and password[1] then
- retval["vm-password"].value = password[1].password
- end
+ if retval.username and username then
+ retval.username.value = username
+
+ local users = listusers(username)
+ if #users == 1 then
+ -- Get password from voicemail_prefs
+ sql = "SELECT password FROM voicemail_prefs"..generatewhereclause(username)
+ local password = getselectresponse(sql)
+ if retval["vm-password"] and password[1] then
+ retval["vm-password"].value = password[1].password
+ end
- local uid = users[1].uid
- if uid then
- -- Get other parameters from voicemail_values
- sql = "SELECT * FROM voicemail_values"..generatewhereclause(nil, nil, nil, uid)
- local params = getselectresponse(sql)
- for i,param in ipairs(params) do
- if param.nid and reverse_nids[param.nid] and retval[reverse_nids[param.nid]] and param.value then
- if retval[reverse_nids[param.nid]].type == "boolean" then
- param.value = (param.value == "true")
+ local uid = users[1].uid
+ if uid then
+ -- Get other parameters from voicemail_values
+ sql = "SELECT * FROM voicemail_values"..generatewhereclause(nil, nil, nil, uid)
+ local params = getselectresponse(sql)
+ for i,param in ipairs(params) do
+ if param.nid and reverse_nids[param.nid] and retval[reverse_nids[param.nid]] and param.value then
+ if retval[reverse_nids[param.nid]].type == "boolean" then
+ param.value = (param.value == "true")
+ end
+ retval[reverse_nids[param.nid]].value = param.value
end
- retval[reverse_nids[param.nid]].value = param.value
end
end
end