OC-MultICE/modules/applications/nshd-auth.lua

39 lines
887 B
Lua
Raw Normal View History

function nshd_w(evPP,cA,sI,pW)
s("nshd - "..tostring(sI),function()
chauths(cA,evPP,pW)
luash({["sI"]=sI})
while true do
if ev[1] == "net_msg" then
local msg=tostring(ev[4])
if ev[3] == evPP and ev[2] == cA then
if msg:sub(1,3) == "key" then
h("key",tT[cT][3].sI,tonumber(msg:sub(4)),0)
elseif msg == "exit" then pcall(killsession,sI) break
end
end
elseif ev[1] == "display" and ev[3] == tT[cT][3].sI then
ns(cA,evPP,"dis"..tostring(ev[2]))
end
C.yield()
end
end,{["sI"]=sI})
end
function nshd(P,pW)
s("nshd",function()
local Cc=1
while true do
if ev[1] == "net_msg" and ev[3] == P then
if ev[4] == "initnsh" then
nnID="nsh-"..tostring(Cc)
Cc=Cc+1
ns(ev[2],P,nnID)
nshd_w(nnID,ev[2],nnID,pW)
print("[nshd]Spawned "..nnID.." for "..tostring(ev[2]))
end
end
C.yield()
end
end,{["sI"]="log"})
end