Pinned channels

This commit is contained in:
Tony Garnock-Jones 2019-01-29 20:46:38 +00:00
parent ed0307d4e5
commit 9c5d9768b4
4 changed files with 19 additions and 9 deletions

View File

@ -7,8 +7,12 @@
(spawn #:name 'channel-factory
(stop-when-reloaded)
(during/spawn (ircd-channel-member $Ch _)
#:name `(ircd-channel ,Ch)
(during (ircd-channel-member $Ch _)
(assert (ircd-channel Ch)))
(during/spawn (ircd-channel $Ch)
#:name (ircd-channel Ch)
(field [topic #f])
(assert (ircd-channel-topic Ch (topic)))

View File

@ -18,6 +18,9 @@
(during (config 'ircd `(port ,$port))
(assert (ircd-listener port)))
(during (config 'ircd `(channel ,$Ch))
(assert (ircd-channel Ch)))
(define/query-set motds (config 'ircd `(motd ,$text)) text)
(assert (ircd-motd (append*
(map (lambda (t) (string-split t "\n"))

View File

@ -1,2 +1,3 @@
(port 6667)
(motd "Hello, world!")
(channel "#syndicate")

View File

@ -4,6 +4,7 @@
(struct-out ircd-motd)
(struct-out ircd-connection-info)
(struct-out ircd-channel)
(struct-out ircd-channel-member)
(struct-out ircd-channel-topic)
@ -14,15 +15,16 @@
;; A Connection is a TcpAddress
(struct ircd-listener (port) #:prefab) ;; assertion
(struct ircd-motd (lines) #:prefab) ;; assertion
(assertion-struct ircd-listener (port))
(assertion-struct ircd-motd (lines))
(struct ircd-connection-info (conn nick user) #:prefab) ;;assertion
(struct ircd-channel-member (channel conn) #:prefab) ;; assertion
(struct ircd-channel-topic (channel topic) #:prefab) ;; assertion
(assertion-struct ircd-connection-info (conn nick user))
(assertion-struct ircd-channel (channel))
(assertion-struct ircd-channel-member (channel conn))
(assertion-struct ircd-channel-topic (channel topic))
(struct ircd-action (conn message) #:prefab) ;; message
(struct ircd-event (conn message) #:prefab) ;; message
(message-struct ircd-action (conn message))
(message-struct ircd-event (conn message))
;;---------------------------------------------------------------------------