NOTICE support

This commit is contained in:
Tony Garnock-Jones 2019-02-09 10:36:03 +00:00
parent 94c66094e6
commit f4f3b67cdf
2 changed files with 13 additions and 7 deletions

View File

@ -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)

View File

@ -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