mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-25 19:38:07 +11:00
Compare commits
6 Commits
3b0d652e3a
...
f8903ad587
Author | SHA1 | Date | |
---|---|---|---|
|
f8903ad587 | ||
|
98fbf0e7d5 | ||
|
23915e4737 | ||
|
a78a3758f8 | ||
|
074a980d81 | ||
|
4f0efd256c |
@ -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 false end
|
||||
if port ~= cfg.port then return end
|
||||
local service, level, msg = data:match("(.-)\t(%d)\t(.+)")
|
||||
if not service or not level or not msg then return false end
|
||||
if not service or not level or not msg then return 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 false end
|
||||
if not service or not level or not msg then return 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",wentry)
|
||||
event.listen("syslog",local_listener)
|
||||
listeners[#listeners+1] = {"syslog",local_listener}
|
||||
if havenet and cfg.receive then
|
||||
event.listen("net_msg",remote_listener)
|
||||
|
Loading…
Reference in New Issue
Block a user