| 51 excepterm (traceback.format_exception(excType, excValue, trace)) |
51 excepterm (traceback.format_exception(excType, excValue, trace)) |
| 52 |
52 |
| 53 def excepterm (data): |
53 def excepterm (data): |
| 54 for segment in data: |
54 for segment in data: |
| 55 for line in segment.splitlines(): |
55 for line in segment.splitlines(): |
| 56 print line |
56 #print line |
| 57 Irc.broadcast (line) |
57 Irc.broadcast (line) |
| 58 |
58 |
| 59 for client in Irc.all_clients: |
59 for client in Irc.all_clients: |
| 60 if len(data) > 0: |
60 if len(data) > 0: |
| 61 client.exceptdie() |
61 client.exceptdie() |
| 62 else: |
62 else: |
| 63 client.quit_irc() |
63 client.quit_irc() |
| 64 |
64 |
| 65 if g_BotActive: |
65 quit() |
| 66 restart_self() |
66 #if g_BotActive: |
| 67 else: |
67 # restart_self() |
| 68 quit() |
68 #else: |
| |
69 # quit() |
| 69 |
70 |
| 70 def restart_self(): |
71 def restart_self(): |
| 71 os.execl (sys.executable, sys.executable, * sys.argv) |
72 os.execl (sys.executable, sys.executable, * sys.argv) |
| 72 |
73 |
| 73 def main(): |
74 def main(): |
| 97 quit() |
98 quit() |
| 98 |
99 |
| 99 for aconn in autoconnects: |
100 for aconn in autoconnects: |
| 100 for conndata in Config.get_nodelist ('connections'): |
101 for conndata in Config.get_nodelist ('connections'): |
| 101 if conndata.get_value ('name') == aconn: |
102 if conndata.get_value ('name') == aconn: |
| 102 Irc.irc_client (conndata, 0) |
103 #Irc.irc_client (conndata, 0) |
| 103 break |
104 break |
| 104 else: |
105 else: |
| 105 raise ValueError ("unknown autoconnect entry %s" % (aconn)) |
106 raise ValueError ("unknown autoconnect entry %s" % (aconn)) |
| 106 |
107 |
| 107 # Start the REST server |
108 # Start the REST server |