1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-26 03:48:06 +11:00

Compare commits

..

No commits in common. "f8903ad587d47ad7eaf0d97596e13a40e533590d" and "3b0d652e3aacbaaf647413ff96fe98620679e944" have entirely different histories.

View File

@ -3,7 +3,7 @@ local serial = require "serialization"
local computer = require "computer"
local havenet, net = pcall(require,"minitel")
local hostname = os.getenv("HOSTNAME") or computer.address():sub(1,8)
local hostname = os.getenv("HOSTNAME") or computer.address:sub(1,8)
local cfg = {}
cfg.port = 514
cfg.relay = false
@ -41,7 +41,7 @@ function reload()
f:close()
end
end
hostname = os.getenv("HOSTNAME") or computer.address():sub(1,8)
hostname = os.getenv("HOSTNAME") or computer.address:sub(1,8)
end
local function wentry(_,msg,level,service,host)
@ -69,15 +69,15 @@ local function wentry(_,msg,level,service,host)
end
local function remote_listener(_,from,port,data)
if port ~= cfg.port then return end
if port ~= cfg.port then return false end
local service, level, msg = data:match("(.-)\t(%d)\t(.+)")
if not service or not level or not msg then return end
if not service or not level or not msg then return false end
msg, level, service = tostring(msg),tonumber(level),tostring(service)
wentry(nil,msg,level,service,from)
end
local function local_listener(_,msg,level,service)
if not service or not level or not msg then return end
if not service or not level or not msg then return false end
msg, level, service = tostring(msg),tonumber(level),tostring(service)
wentry(nil,msg,level,service,hostname)
end
@ -85,7 +85,7 @@ end
function start()
reload()
if #listeners > 0 then return end
event.listen("syslog",local_listener)
event.listen("syslog",wentry)
listeners[#listeners+1] = {"syslog",local_listener}
if havenet and cfg.receive then
event.listen("net_msg",remote_listener)