Remove some legacy code
This commit is contained in:
parent
2fecd98978
commit
7a0e2be66c
34
core/bot.py
34
core/bot.py
|
@ -731,9 +731,8 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
self.relayCommands, self.user, self.stage2 = relayCommands, user, stage2
|
||||
|
||||
def buildProtocol(self, addr):
|
||||
if self.relay is False:
|
||||
entry = IRCBot(self.net, self.num)
|
||||
main.IRCPool[self.name] = entry
|
||||
entry = IRCBot(self.net, self.num)
|
||||
main.IRCPool[self.name] = entry
|
||||
|
||||
self.client = entry
|
||||
return entry
|
||||
|
@ -746,21 +745,20 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
self.client.authenticated = False
|
||||
self.client.channels = []
|
||||
error = reason.getErrorMessage()
|
||||
if not self.relay:
|
||||
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
sendAll("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
ctime = str(datetime.now().isoformat())
|
||||
sendRelayNotification(
|
||||
{
|
||||
"type": "conn",
|
||||
"net": self.net,
|
||||
"num": self.num,
|
||||
"status": "lost",
|
||||
"message": error,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
self.retry(connector)
|
||||
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
sendAll("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
ctime = str(datetime.now().isoformat())
|
||||
sendRelayNotification(
|
||||
{
|
||||
"type": "conn",
|
||||
"net": self.net,
|
||||
"num": self.num,
|
||||
"status": "lost",
|
||||
"message": error,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
self.retry(connector)
|
||||
# ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
||||
|
||||
def clientConnectionFailed(self, connector, reason):
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
class IRCBotFactory(ReconnectingClientFactory):
|
||||
def __init__(self, net, num=None, relayCommands=None, user=None, stage2=None):
|
||||
if net is None:
|
||||
self.num = num
|
||||
self.net = None
|
||||
self.name = "relay - %i" % num
|
||||
self.relay = True
|
||||
else:
|
||||
self.name = net + str(num)
|
||||
self.num = num
|
||||
self.net = net
|
||||
self.relay = False
|
||||
self.client = None
|
||||
self.maxDelay = main.config["Tweaks"]["Delays"]["MaxDelay"]
|
||||
self.initialDelay = main.config["Tweaks"]["Delays"]["InitialDelay"]
|
||||
self.factor = main.config["Tweaks"]["Delays"]["Factor"]
|
||||
self.jitter = main.config["Tweaks"]["Delays"]["Jitter"]
|
||||
|
||||
self.relayCommands, self.user, self.stage2 = relayCommands, user, stage2
|
||||
|
||||
def buildProtocol(self, addr):
|
||||
if self.relay is False:
|
||||
entry = IRCBot(self.net, self.num)
|
||||
main.IRCPool[self.name] = entry
|
||||
else:
|
||||
entry = IRCRelay(self.num, self.relayCommands, self.user, self.stage2)
|
||||
|
||||
self.client = entry
|
||||
return entry
|
||||
|
||||
def clientConnectionLost(self, connector, reason):
|
||||
if not self.relay:
|
||||
userinfo.delChannels(self.net, self.client.channels)
|
||||
if self.client is not None:
|
||||
self.client.isconnected = False
|
||||
self.client.authenticated = False
|
||||
self.client.channels = []
|
||||
error = reason.getErrorMessage()
|
||||
if not self.relay:
|
||||
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
sendAll("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
ctime = str(datetime.now().isoformat())
|
||||
sendRelayNotification(
|
||||
{
|
||||
"type": "conn",
|
||||
"net": self.net,
|
||||
"num": self.num,
|
||||
"status": "lost",
|
||||
"message": error,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
self.retry(connector)
|
||||
# ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
||||
|
||||
def clientConnectionFailed(self, connector, reason):
|
||||
if self.client is not None:
|
||||
self.client.isconnected = False
|
||||
self.client.authenticated = False
|
||||
self.client.channels = []
|
||||
error = reason.getErrorMessage()
|
||||
log("%s - %i: connection failed: %s" % (self.net, self.num, error))
|
||||
if not self.relay:
|
||||
sendAll("%s - %s: connection failed: %s" % (self.net, self.num, error))
|
||||
ctime = str(datetime.now().isoformat())
|
||||
sendRelayNotification(
|
||||
{
|
||||
"type": "conn",
|
||||
"net": self.net,
|
||||
"num": self.num,
|
||||
"status": "failed",
|
||||
"message": error,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
self.retry(connector)
|
||||
# ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
|
Loading…
Reference in New Issue