/LIST
This commit is contained in:
parent
894ae9d238
commit
9215682e5c
|
@ -9,6 +9,7 @@
|
|||
(require/activate imperative-syndicate/reload)
|
||||
(require/activate imperative-syndicate/drivers/tcp)
|
||||
(require syndicate/support/hash)
|
||||
(require (only-in racket/list append*))
|
||||
|
||||
(define (ircd-connection-facet this-conn peer-host)
|
||||
(define (send-to-remote #:newline [with-newline #t] fmt . vs)
|
||||
|
@ -160,6 +161,23 @@
|
|||
(define Present (string-join (filter on? Nicks) " "))
|
||||
(send! (ircd-event conn (irc-message server-prefix 303 '("*") Present)))))
|
||||
|
||||
(spawn #:name 'list-responder
|
||||
(stop-when-reloaded)
|
||||
(define/query-hash topics (ircd-channel-topic $Ch $topic) Ch topic)
|
||||
(define/query-hash counts (ircd-channel-user-count $Ch $count) Ch count)
|
||||
(on (message (ircd-action $conn (irc-message _ "LIST" $requested-channel-names0 _)))
|
||||
(define requested-channel-names
|
||||
(append* (map (lambda (ns) (string-split ns #px",+")) requested-channel-names0)))
|
||||
(send! (ircd-event conn (irc-message server-prefix 321 '("*" "Channel") "Users Name")))
|
||||
(for [(Ch (if (null? requested-channel-names)
|
||||
(in-hash-keys (topics))
|
||||
(in-list requested-channel-names)))]
|
||||
(when (hash-has-key? (topics) Ch)
|
||||
(define topic (hash-ref (topics) Ch))
|
||||
(define count (hash-ref (counts) Ch 0))
|
||||
(send! (ircd-event conn (irc-message server-prefix 322 (list "*" Ch count) topic)))))
|
||||
(send! (ircd-event conn (irc-message server-prefix 323 '("*") "End of /LIST")))))
|
||||
|
||||
(spawn #:name 'session-listener-factory
|
||||
(stop-when-reloaded)
|
||||
(during/spawn (ircd-listener $port)
|
||||
|
|
Loading…
Reference in New Issue