init.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. mail = {
  2. -- mark webmail fork for other mods
  3. fork = "webmail",
  4. -- api version
  5. apiversion = 1.1,
  6. -- mail directory
  7. maildir = minetest.get_worldpath().."/mails",
  8. -- allow item/node attachments
  9. allow_attachments = minetest.settings:get("mail.allow_attachments") == "true",
  10. webmail = {
  11. -- disallow banned players in the webmail interface
  12. disallow_banned_players = minetest.settings:get("webmail.disallow_banned_players") == "true",
  13. -- url and key to the webmail server
  14. url = minetest.settings:get("webmail.url"),
  15. key = minetest.settings:get("webmail.key")
  16. },
  17. tan = {}
  18. }
  19. local MP = minetest.get_modpath(minetest.get_current_modname())
  20. dofile(MP .. "/chatcommands.lua")
  21. dofile(MP .. "/migrate.lua")
  22. dofile(MP .. "/attachment.lua")
  23. dofile(MP .. "/hud.lua")
  24. dofile(MP .. "/storage.lua")
  25. dofile(MP .. "/api.lua")
  26. dofile(MP .. "/gui.lua")
  27. dofile(MP .. "/onjoin.lua")
  28. -- optional webmail stuff below
  29. local http = minetest.request_http_api()
  30. if http then
  31. local webmail_url = mail.webmail.url
  32. local webmail_key = mail.webmail.key
  33. if not webmail_url then error("webmail.url is not defined") end
  34. if not webmail_key then error("webmail.key is not defined") end
  35. print("[mail] loading webmail-component with endpoint: " .. webmail_url)
  36. mail.handlers = {}
  37. dofile(MP .. "/webmail/tan.lua")
  38. dofile(MP .. "/webmail/webmail.lua")
  39. dofile(MP .. "/webmail/hook.lua")
  40. dofile(MP .. "/webmail/handler_auth.lua")
  41. dofile(MP .. "/webmail/handler_send.lua")
  42. dofile(MP .. "/webmail/handler_messages.lua")
  43. dofile(MP .. "/webmail/handler_delete.lua")
  44. dofile(MP .. "/webmail/handler_mark_read.lua")
  45. dofile(MP .. "/webmail/handler_mark_unread.lua")
  46. mail.webmail_init(http, webmail_url, webmail_key)
  47. end
  48. -- migrate storage
  49. mail.migrate()