comparison src/chat.luan @ 83:a47036fd0158

group chat
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Mar 2025 13:56:59 -0600
parents 8270106644db
children
comparison
equal deleted inserted replaced
82:0bc5e0d098f7 83:a47036fd0158
2 local error = Luan.error 2 local error = Luan.error
3 local pairs = Luan.pairs or error() 3 local pairs = Luan.pairs or error()
4 local Table = require "luan:Table.luan" 4 local Table = require "luan:Table.luan"
5 local concat = Table.concat or error() 5 local concat = Table.concat or error()
6 local is_empty = Table.is_empty or error() 6 local is_empty = Table.is_empty or error()
7 local Html = require "luan:Html.luan"
8 local url_encode = Html.url_encode or error()
7 local Http = require "luan:http/Http.luan" 9 local Http = require "luan:http/Http.luan"
8 local Shared = require "site:/lib/Shared.luan" 10 local Shared = require "site:/lib/Shared.luan"
9 local http_push_to_users = Shared.http_push_to_users or error() 11 local http_push_to_users = Shared.http_push_to_users or error()
10 local User = require "site:/lib/User.luan" 12 local User = require "site:/lib/User.luan"
11 local current_user = User.current or error() 13 local current_user = User.current or error()
25 if user == nil then 27 if user == nil then
26 local url = "/login.html" 28 local url = "/login.html"
27 if not is_empty(with) then 29 if not is_empty(with) then
28 local t = {} 30 local t = {}
29 for email in pairs(with) do 31 for email in pairs(with) do
30 t[#t+1] = "with="..email 32 t[#t+1] = "with="..url_encode(email)
31 end 33 end
32 url = url.."?"..concat(t,"&") 34 url = url.."?"..concat(t,"&")
33 end 35 end
34 Http.response.send_redirect(url) 36 Http.response.send_redirect(url)
35 return 37 return