Comparison

mod_auth_external/examples/lua/prosody-auth-example.lua @ 1164:b6280e8886f4

mod_auth_external: Move example scripts to new examples/ dir, and add Lua and Go examples
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Aug 2013 16:44:43 +0100
comparison
equal deleted inserted replaced
1163:52bee1247014 1164:b6280e8886f4
1 local actions = {};
2
3 function actions.auth(data)
4 local user, host, pass = data:match("^([^:]+):([^:]+):(.+)$");
5 if user == "someone" then
6 return "1";
7 end
8 end
9
10 for line in io.lines() do
11 local action, data = line:match("^([^:]+)(.*)$");
12 print(actions[action] and actions[action](data) or "0");
13 end