1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-05-06 08:54:04 +00:00

Added third "recipient" argument to send

This commit is contained in:
LDDestroier 2019-05-07 17:49:48 -04:00 committed by GitHub
parent 79b3e2822c
commit 78b190d4a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@ disknet.closeAll = function()
openChannels = {} openChannels = {}
end end
disknet.send = function(channel, message) disknet.send = function(channel, message, recipient)
local valid, grr = checkValidChannel(channel) local valid, grr = checkValidChannel(channel)
if valid then if valid then
if not fs.exists(fs.combine(disknet.mainPath, tostring(channel))) then if not fs.exists(fs.combine(disknet.mainPath, tostring(channel))) then
@ -109,6 +109,7 @@ disknet.send = function(channel, message)
uniqueID = uniqueID, uniqueID = uniqueID,
messageID = math.random(1, 2^31 - 1), messageID = math.random(1, 2^31 - 1),
channel = channel, channel = channel,
recipient = recipient,
message = message, message = message,
} }
if #contents > maximumBufferSize then if #contents > maximumBufferSize then
@ -172,6 +173,7 @@ disknet.receive = function(channel)
if not output then if not output then
for look = 1, #contents do for look = 1, #contents do
if (contents[look].uniqueID ~= uniqueID) and (not msgCheckList[contents[look].messageID]) then if (contents[look].uniqueID ~= uniqueID) and (not msgCheckList[contents[look].messageID]) then
if (not conetnts[look].recipient) or contents[look].recipient == yourID then
if getTime() - (contents[look].time or 0) <= 0.001 then if getTime() - (contents[look].time or 0) <= 0.001 then
msgCheckList[contents[look].messageID] = true msgCheckList[contents[look].messageID] = true
output = {} output = {}
@ -183,6 +185,7 @@ disknet.receive = function(channel)
end end
end end
end end
end
-- delete old msesages -- delete old msesages
doRewrite = false doRewrite = false