Don't reissue the MOTD if it changes

This commit is contained in:
Tony Garnock-Jones 2017-08-04 12:14:35 -04:00
parent 81bd857259
commit 1e42059c0f
1 changed files with 10 additions and 9 deletions

View File

@ -32,15 +32,16 @@
(define/dataflow conn-info (ircd-connection-info this-conn (nick) (user)))
(assert (conn-info))
(during (ircd-motd $motd-lines)
(field [motd-sent? #f])
(begin/dataflow
(unless (motd-sent?)
(when (and (nick) (user))
(motd-sent? #t)
(send* 375 (nick) #:trailing (format "- ~a Message of the day - " server-name))
(for [(line motd-lines)] (send* 372 (nick) #:trailing (format "- ~a" line)))
(send* 376 (nick) #:trailing (format "End of /MOTD command"))))))
(on-start
(react
(stop-when (asserted (ircd-motd $motd-lines))
(react
(begin/dataflow
(when (and (nick) (user))
(send* 375 (nick) #:trailing (format "- ~a Message of the day - " server-name))
(for [(line motd-lines)] (send* 372 (nick) #:trailing (format "- ~a" line)))
(send* 376 (nick) #:trailing (format "End of /MOTD command"))
(stop-current-facet)))))))
(field [peer-common-channels (hash)]
[peer-names (hash)])