From 5d5b5d4d47c481486924b16ab64e07abe2a65993 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 21 Feb 2018 20:31:47 +0000 Subject: [PATCH] Make connection notifications configurable --- conf/example/config.json | 2 +- threshold | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conf/example/config.json b/conf/example/config.json index 7a944c1..f7bc320 100644 --- a/conf/example/config.json +++ b/conf/example/config.json @@ -9,7 +9,7 @@ "UsePassword": true, "ConnectOnCreate": false, "HighlightNotifications": true, - "ConnectionNotifications": true, + "ConnectionNotifications": true, "Dist": { "Enabled": true, "SendOutput": false, diff --git a/threshold b/threshold index cc7569f..0fe6149 100755 --- a/threshold +++ b/threshold @@ -193,7 +193,8 @@ class IRCBot(IRCClient): def signedOn(self): self.connected = True log("signed on: %s" % self.name) - helper.sendMaster("SIGNON: %s" % self.name) + if config["ConnectionNotifications"]: + helper.sendMaster("SIGNON: %s" % self.name) if self.authtype == "ns": self.msg(self.authentity, "IDENTIFY %s" % self.nspass) for i in self.autojoin: @@ -272,7 +273,8 @@ class IRCBotFactory(ReconnectingClientFactory): error = reason.getErrorMessage() log("%s: connection lost: %s" % (self.name, error)) helper.sendAll("%s: connection lost: %s" % (self.name, error)) - helper.sendMaster("CONNLOST %s: %s" % (self.name, error)) + if config["ConnectionNotifications"]: + helper.sendMaster("CONNLOST %s: %s" % (self.name, error)) self.retry(connector) #ReconnectingClientFactory.clientConnectionLost(self, connector, reason) @@ -283,7 +285,8 @@ class IRCBotFactory(ReconnectingClientFactory): error = reason.getErrorMessage() log("%s: connection failed: %s" % (self.name, error)) helper.sendAll("%s: connection failed: %s" % (self.name, error)) - helper.sendMaster("CONNFAIL %s: %s" % (self.name, error)) + if config["ConnectionNotifications"]: + helper.sendMaster("CONNFAIL %s: %s" % (self.name, error)) self.retry(connector) #ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)