Archived
1
0
Disbranĉigi 0

Allow messages sans sender

This commit is contained in:
Jaidyn Ann 2023-06-06 12:08:24 -05:00
parent 9ed56247e3
commit 8a94a0fa82

View File

@ -65,15 +65,16 @@
[message-text (if last-message [message-text (if last-message
(car last-message) "")] (car last-message) "")]
[message-sender (if last-message [message-sender (if last-message
(alist-ref 'user.chat.sender (or (alist-ref 'user.chat.sender
(cdr last-message)) (cdr last-message))
"")
"")] "")]
[message-time [message-time
(if last-message (if last-message
(date->string (alist-ref 'user.chat.date (date->string (alist-ref 'user.chat.date
(cdr last-message)) (cdr last-message))
"[~H:~M:~S]") "[~H:~M:~S]")
"")]) "")])
(html-from-template (html-from-template
"templates/room-list-item.html" "templates/room-list-item.html"
`(("ROOM_TITLE" . ,(html-encode-string room)) `(("ROOM_TITLE" . ,(html-encode-string room))
@ -176,7 +177,7 @@
"templates/room-messages-item.html" "templates/room-messages-item.html"
`(("MESSAGE_SENDER" `(("MESSAGE_SENDER"
. ,(html-encode-string . ,(html-encode-string
(alist-ref 'user.chat.sender (cdr message)))) (or (alist-ref 'user.chat.sender (cdr message)) "")))
("MESSAGE_DATE" ("MESSAGE_DATE"
. ,(html-encode-string . ,(html-encode-string
(date->string (date->string
@ -305,10 +306,10 @@
;; Handle all POST requests. ;; Handle all POST requests.
(define (http-post irc-dir request continue) (define (http-post irc-dir request continue)
(let* ([path (uri:uri-path (intarweb:request-uri request))] (let* ([path (uri:uri-path (intarweb:request-uri request))]
[handler (assoc-by-path path http-post-handlers)]) [handler (assoc-by-path path http-post-handlers)])
(if handler (if handler
(apply (cdr handler) (list irc-dir request path)) (apply (cdr handler) (list irc-dir request path))
(continue)))) (continue))))
;; Creates a handler for all HTTP requests, with the given IRC dir. ;; Creates a handler for all HTTP requests, with the given IRC dir.