From: plugd Date: Thu, 15 Aug 2024 19:53:33 +0000 (+0200) Subject: Made handle-specification more robust. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=47f8cdc566ef8ad1a0d8ca5daa0813341163eac7;p=qwikboard.git Made handle-specification more robust. --- diff --git a/qwikboard b/qwikboard index cfd26c9..2da9e31 100755 --- a/qwikboard +++ b/qwikboard @@ -468,12 +468,20 @@ exec: { local input_string = io.stdin:read("*all") - if string.match(input_string, "^get%s%w+%s$") then + if string.match(input_string, "^%s*get") then - local user_name = string.match(input_string, "^get%s(%w+)%s$") + local user_name = string.match(input_string, "^%s*get%s+(%w+)%s*$") + if user_name then + nncp_usernames[node_id] = user_name + store_nncp_usernames() + else + user_name = nncp_usernames[node_id] + end - nncp_usernames[node_id] = user_name - store_nncp_usernames() + if not user_name then + print("Error: no known handle for node " .. node_id .. ". Aborting.") + return false + end print("Building QWK packet for user '" .. user_name .. "'") -- Construct QWK packet @@ -495,7 +503,7 @@ exec: { local user_name = nncp_usernames[node_id] if not user_name then - print("No user name for node " .. node_id .. " found. Aborting.") + print("Error: No user name for node " .. node_id .. " found. Aborting.") return false end