~dricottone/huttese-apk

e54af00a696c4ea16217d6daa4381d742c83b47d — Drew DeVault 3 years ago f275550
alertmanager-irc-relay: upgrade to 1ef886d2e73e9eae1a1be15d515f9d3051b18129
2 files changed, 5 insertions(+), 76 deletions(-)

D sr.ht/alertmanager-irc-relay/0001-Add-option-to-use-PRIVMSG-instead-of-NOTICE.patch
M sr.ht/alertmanager-irc-relay/APKBUILD
D sr.ht/alertmanager-irc-relay/0001-Add-option-to-use-PRIVMSG-instead-of-NOTICE.patch => sr.ht/alertmanager-irc-relay/0001-Add-option-to-use-PRIVMSG-instead-of-NOTICE.patch +0 -68
@@ 1,68 0,0 @@
From e2858e45608b14723624658b3dbbd54464deef66 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Mon, 6 Jan 2020 10:38:31 -0500
Subject: [PATCH] Add option to use PRIVMSG instead of NOTICE

This is desirable in some situations.
---
 config.go | 2 ++
 irc.go    | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/config.go b/config.go
index f0897e1..6bffa81 100644
--- a/config.go
+++ b/config.go
@@ -41,6 +41,7 @@ type Config struct {
 	IRCChannels    []IRCChannel `yaml:"irc_channels"`
 	NoticeTemplate string       `yaml:"notice_template"`
 	NoticeOnce     bool         `yaml:"notice_once_per_alert_group"`
+	UsePrivmsg     bool         `yaml:"use_privmsg"`
 }
 
 func LoadConfig(configFile string) (*Config, error) {
@@ -55,6 +56,7 @@ func LoadConfig(configFile string) (*Config, error) {
 		IRCUseSSL:   true,
 		IRCChannels: []IRCChannel{IRCChannel{Name: "#airtest"}},
 		NoticeOnce:  false,
+		UsePrivmsg:  false,
 	}
 
 	if configFile != "" {
diff --git a/irc.go b/irc.go
index ee27006..ea395a4 100644
--- a/irc.go
+++ b/irc.go
@@ -64,6 +64,8 @@ type IRCNotifier struct {
 
 	NickservDelayWait time.Duration
 	BackoffCounter    Delayer
+
+	usePrivmsg bool
 }
 
 func NewIRCNotifier(config *Config, alertNotices chan AlertNotice) (*IRCNotifier, error) {
@@ -96,6 +98,7 @@ func NewIRCNotifier(config *Config, alertNotices chan AlertNotice) (*IRCNotifier
 		JoinedChannels:    make(map[string]ChannelState),
 		NickservDelayWait: nickservWaitSecs * time.Second,
 		BackoffCounter:    backoffCounter,
+		usePrivmsg:        config.UsePrivmsg,
 	}
 
 	notifier.Client.HandleFunc(irc.CONNECTED,
@@ -196,7 +199,11 @@ func (notifier *IRCNotifier) MaybeSendAlertNotice(alertNotice *AlertNotice) {
 		return
 	}
 	notifier.JoinChannel(&IRCChannel{Name: alertNotice.Channel})
-	notifier.Client.Notice(alertNotice.Channel, alertNotice.Alert)
+	if notifier.usePrivmsg {
+		notifier.Client.Privmsg(alertNotice.Channel, alertNotice.Alert)
+	} else {
+		notifier.Client.Notice(alertNotice.Channel, alertNotice.Alert)
+	}
 }
 
 func (notifier *IRCNotifier) Run() {
-- 
2.24.1


M sr.ht/alertmanager-irc-relay/APKBUILD => sr.ht/alertmanager-irc-relay/APKBUILD +5 -8
@@ 1,8 1,8 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=alertmanager-irc-relay
pkgver=20200105
_commit=aebe137d2e9545de98da1959b3036d5a612c8df3
pkgrel=4
pkgver=20210118
_commit=1ef886d2e73e9eae1a1be15d515f9d3051b18129
pkgrel=0
pkgdesc="Prometheus Alertmanager IRC relay"
url="https://github.com/google/alertmanager-irc-relay"
arch="all"


@@ 14,7 14,6 @@ source="
	alertmanager-irc-relay.confd
	alertmanager-irc-relay.initd
	alertmanager-irc-relay.yml
	0001-Add-option-to-use-PRIVMSG-instead-of-NOTICE.patch
"
subpackages="$pkgname-openrc"
builddir="$srcdir/$pkgname-$_commit"


@@ 22,7 21,6 @@ options="!check" # requires running IRC server

prepare() {
	default_prepare
	go mod init github.com/google/alertmanager-irc-relay
	go mod vendor
}



@@ 51,8 49,7 @@ package() {
		"$pkgdir"/etc/alertmanager/alertmanager-irc-relay.yml
}

sha512sums="bb1ecac858cee6403d591a3e600138a12549adcd27f1d3c6136966f163bef9cac697019af0fcd859bc2fd7c6b3ca7bef444d1566559203f7561408fbdd3eeee9  alertmanager-irc-relay-20200105.tar.gz
sha512sums="b7bf95edb350fbfeae44249b3d1ed2e019d4aa9d9525597a7088ab07d99dc6afacbbcfc13bd7951a3f470a8d813117f61900a376d2d99ea163f8a73abd25bc5b  alertmanager-irc-relay-20210118.tar.gz
43707b80d9baeab8a50ef2489f3bbc61b154b18e2d4ef8be6c7392a8afa27c1884c5f6f121b41fb5095f8cf9d957f4eda98f4fa197774f86a95d3bd930593b1b  alertmanager-irc-relay.confd
4458cea59f5059921da7d609b562e9a74f20f472c320dbaa5382e733cfb18f2d2bc71655f2c574403f1a5047074b1a62e82969eea348e939fbf485bd9e3877c4  alertmanager-irc-relay.initd
646f9241087dd5c595f198b829109c975fb0c637026d59a6a271ae04fe0285744bc527797b171ad3840c543801ebeaad15925f906247de0cf2c86af96b57d9fa  alertmanager-irc-relay.yml
3b2bdd3a5b6b10848bd725648e4f7b1bdbc5c5ad1364bc5c2210953ad75f7cf1b6bd040581f07a2b3bc86783e05645b62471d6847e6597a5865ac8f588c44cbb  0001-Add-option-to-use-PRIVMSG-instead-of-NOTICE.patch"
646f9241087dd5c595f198b829109c975fb0c637026d59a6a271ae04fe0285744bc527797b171ad3840c543801ebeaad15925f906247de0cf2c86af96b57d9fa  alertmanager-irc-relay.yml"