diff --git a/imperative/examples/ircd/message.rkt b/imperative/examples/ircd/message.rkt index 9087d3b..0d02e1e 100644 --- a/imperative/examples/ircd/message.rkt +++ b/imperative/examples/ircd/message.rkt @@ -51,7 +51,7 @@ (struct irc-message (prefix command params trailing) #:prefab) (struct irc-user (username hostname realname) #:prefab) -(struct irc-privmsg (source target text) #:prefab) +(struct irc-privmsg (source target text notice?) #:prefab) (struct irc-source-servername (servername) #:prefab) (struct irc-source-nick (nick user) #:prefab) diff --git a/imperative/examples/ircd/session.rkt b/imperative/examples/ircd/session.rkt index 25b79e6..8d37947 100644 --- a/imperative/examples/ircd/session.rkt +++ b/imperative/examples/ircd/session.rkt @@ -130,16 +130,16 @@ (list (nick) Ch U H server-name (nick) "H") (format "0 ~a" R))))) - (on (message (ircd-action $other-conn (irc-privmsg $source Ch $text))) + (on (message (ircd-action $other-conn (irc-privmsg $source Ch $text $notice?))) (when (not (equal? other-conn this-conn)) - (send* #:source source "PRIVMSG" Ch #:trailing text)))) + (send* #:source source (if notice? "NOTICE" "PRIVMSG") Ch #:trailing text)))) (on (message (ircd-event this-conn $m)) (send-irc-message m)) - (on (message (ircd-action $other-conn (irc-privmsg $source (nick) $text))) + (on (message (ircd-action $other-conn (irc-privmsg $source (nick) $text $notice?))) (when (not (equal? other-conn this-conn)) - (send* #:source source "PRIVMSG" (nick) #:trailing text))) + (send* #:source source (if notice? "NOTICE" "PRIVMSG") (nick) #:trailing text))) (on (message (tcp-in-line this-conn $bs)) (define m (parse-irc-message (bytes->string/utf-8 bs))) @@ -179,10 +179,16 @@ (retract! (ircd-channel-member Ch this-conn)))] [(irc-message _ "WHOIS" _ _) (send* 318 (nick) #:trailing "End of /WHOIS list")] ;; TODO - [(irc-message _ "PRIVMSG" (list Targets) Text) + [(irc-message _ + (and cmd (or "PRIVMSG" "NOTICE")) + (list Targets) + Text) (for [(T (string-split Targets #px",+"))] (send! (ircd-action this-conn - (irc-privmsg (irc-source-nick (nick) (user)) T Text))))] + (irc-privmsg (irc-source-nick (nick) (user)) + T + Text + (equal? cmd "NOTICE")))))] [_ (void)]))]))) (spawn #:name 'ison-responder