Mercurial > xib
comparison bot.py @ 207:a97a7e930697
added optionnal "message" argument to Bot.restart()
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sat, 06 Mar 2010 15:39:22 +0100 |
parents | 2a81c480439a |
children | 3fe9fed07b64 |
comparison
equal
deleted
inserted
replaced
206:ba5ecd71065f | 207:a97a7e930697 |
---|---|
865 bridge = None | 865 bridge = None |
866 | 866 |
867 return commands.execute(self, message, bot_admin, bridge) | 867 return commands.execute(self, message, bot_admin, bridge) |
868 | 868 |
869 | 869 |
870 def restart(self): | 870 def restart(self, message='Restarting bot'): |
871 # Stop the bridges | 871 # Stop the bridges |
872 for b in self.bridges: | 872 for b in self.bridges: |
873 b.stop(message='Restarting bot', log=False) | 873 b.stop(message=message, log=False) |
874 | 874 |
875 # Reopen the bot's XMPP connection | 875 # Reopen the bot's XMPP connection |
876 self.reopen_xmpp_connection(self.xmpp_c) | 876 self.reopen_xmpp_connection(self.xmpp_c) |
877 | 877 |
878 # Restart the bridges | 878 # Restart the bridges |
879 for b in self.bridges: | 879 for b in self.bridges: |
880 b.init2() | 880 b.init2() |
881 | 881 |
882 self.error(-1, 'Bot restarted.', send_to_admins=True) | 882 self.error(-1, 'Bot restarted with message: '+message, send_to_admins=True) |
883 | 883 |
884 | 884 |
885 def restart_bridges_delayed(self, bridges, delay, error, protocol='xmpp'): | 885 def restart_bridges_delayed(self, bridges, delay, error, protocol='xmpp'): |
886 if len(bridges) > 0: | 886 if len(bridges) > 0: |
887 found = False | 887 found = False |