diff --git a/monitor/bot.py b/monitor/bot.py index 068f2de..6f02a03 100644 --- a/monitor/bot.py +++ b/monitor/bot.py @@ -33,6 +33,8 @@ class MonitorBot(irc.IRCClient): def privmsg(self, user, channel, msg): """Called when the bot receives a message.""" + pass + """ sendTo = None prefix = '' senderNick = user.split('!', 1)[0] @@ -55,6 +57,7 @@ class MonitorBot(irc.IRCClient): "sent message to {receiver}, triggered by {sender}:\n\t{reply}" .format(receiver=sendTo, sender=senderNick, reply=reply) ) + """ class MonitorBotFactory(protocol.ClientFactory): protocol = MonitorBot @@ -64,3 +67,11 @@ class MonitorBotFactory(protocol.ClientFactory): self.channel = channel self.nickname = nickname self.realname = realname + + def clientConnectionLost(self, connector, reason): + """If we get disconnected, reconnect to server.""" + connector.connect() + + def clientConnectionFailed(self, connector, reason): + print "connection failed:", reason + reactor.stop() diff --git a/twisted/plugins/monitorbot_plugin.py b/twisted/plugins/monitorbot_plugin.py index fd68f2b..5f37b97 100644 --- a/twisted/plugins/monitorbot_plugin.py +++ b/twisted/plugins/monitorbot_plugin.py @@ -67,7 +67,6 @@ class MonitorBotService(Service): msg = "ftp> /%s (%s)" % (new_path, ', '.join(humanReadableMask(mask))) if msg not in self._messages: self._messages.append(msg) - self._callid = reactor.callLater(5.0, sendQueuedMessages) def sendQueuedMessages():