Fri, 10 Aug 2012 13:02:10 +0100
Better handling of timeouts (or other errors), and allow matching errors with false
xmpp-fingerprint.lua | file | annotate | diff | comparison | revisions |
--- a/xmpp-fingerprint.lua Sun Jun 05 16:32:20 2011 +0100 +++ b/xmpp-fingerprint.lua Fri Aug 10 13:02:10 2012 +0100 @@ -95,9 +95,17 @@ received = data or partial or ""; conn:close(); received_cache[question] = received; - debug("<<", #received ~= "" and tostring(received) or nil); + if received ~= "" then + debug("<<", received); + else + debug("!!", tostring(err)); + end end - return received ~= "" and received:match(answer); + if received == "" then + return answer == false + elseif answer then + return received:match(answer); + end end function test(question, answer)