Make connection notifications configurable

This commit is contained in:
Mark Veidemanis 2018-02-21 20:31:47 +00:00
parent f53cb060d0
commit 5d5b5d4d47
2 changed files with 7 additions and 4 deletions

View File

@ -9,7 +9,7 @@
"UsePassword": true, "UsePassword": true,
"ConnectOnCreate": false, "ConnectOnCreate": false,
"HighlightNotifications": true, "HighlightNotifications": true,
"ConnectionNotifications": true, "ConnectionNotifications": true,
"Dist": { "Dist": {
"Enabled": true, "Enabled": true,
"SendOutput": false, "SendOutput": false,

View File

@ -193,7 +193,8 @@ class IRCBot(IRCClient):
def signedOn(self): def signedOn(self):
self.connected = True self.connected = True
log("signed on: %s" % self.name) 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": if self.authtype == "ns":
self.msg(self.authentity, "IDENTIFY %s" % self.nspass) self.msg(self.authentity, "IDENTIFY %s" % self.nspass)
for i in self.autojoin: for i in self.autojoin:
@ -272,7 +273,8 @@ class IRCBotFactory(ReconnectingClientFactory):
error = reason.getErrorMessage() error = reason.getErrorMessage()
log("%s: connection lost: %s" % (self.name, error)) log("%s: connection lost: %s" % (self.name, error))
helper.sendAll("%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) self.retry(connector)
#ReconnectingClientFactory.clientConnectionLost(self, connector, reason) #ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
@ -283,7 +285,8 @@ class IRCBotFactory(ReconnectingClientFactory):
error = reason.getErrorMessage() error = reason.getErrorMessage()
log("%s: connection failed: %s" % (self.name, error)) log("%s: connection failed: %s" % (self.name, error))
helper.sendAll("%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) self.retry(connector)
#ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) #ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)