Skip to content

Commit

Permalink
more sanity checks and default values
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 20, 2020
1 parent be51cff commit 18592b0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ mail.read_later_message = "You can read your messages later by using the /mail c
mail sending function, can be invoked with one object argument (new api) or
all 4 parameters (old compat version)
see: "Mail format" api.md
TODO: refactor this garbage code!
--]]
function mail.send(src, dst, subject, body)
-- figure out format
Expand All @@ -33,6 +35,15 @@ function mail.send(src, dst, subject, body)
m.to = m.dst
end

if m.src and not m.from then
-- populate "from" field
m.from = m.src
end

-- sane default values
m.subject = m.subject or ""
m.body = m.body or ""

local cc
local bcc
local extra
Expand Down

0 comments on commit 18592b0

Please sign in to comment.