feat(panettone): Bring back + fix irccat issue creation announcement
This reverts commit e1067b1497.
The original issue here was misusing ISSUE-ID instead of ID, but also
the associated username for the message should've been CN instead of DN
Change-Id: I1629c0cb7597ff2ee2867f27870378eecdafe126
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2125
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
This commit is contained in:
parent
7dcd518c35
commit
1e43982c92
4 changed files with 43 additions and 6 deletions
26
web/panettone/src/irc.lisp
Normal file
26
web/panettone/src/irc.lisp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
;;;; Using irccat to send IRC notifications
|
||||
|
||||
(in-package :panettone.irc)
|
||||
|
||||
(defun get-irccat-config ()
|
||||
"Reads the IRCCATHOST and IRCCATPORT environment variables, and returns them
|
||||
as two values"
|
||||
(destructuring-bind (host port)
|
||||
(mapcar #'uiop:getenvp '("IRCCATHOST" "IRCCATPORT"))
|
||||
(if (and host port)
|
||||
(values host (parse-integer port))
|
||||
(values "localhost" 4722))))
|
||||
|
||||
(defun send-irc-notification (body &key channel)
|
||||
"Sends BODY to the IRC channel CHANNEL (starting with #),
|
||||
if an IRCCat server is configured (using the IRCCATHOST and IRCCATPORT
|
||||
environment variables).
|
||||
May signal a condition if sending fails."
|
||||
(multiple-value-bind (irchost ircport) (get-irccat-config)
|
||||
(when irchost
|
||||
(let ((socket (socket-connect irchost ircport)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(format (socket-stream socket) "~@[~A ~]~A~%" channel body)
|
||||
(finish-output (socket-stream socket)))
|
||||
(ignore-errors (socket-close socket)))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue