make it easier for the bot to exit, allow rejoin after part within 7 seconds

This commit is contained in:
Jimmy Cao 2011-08-17 23:19:21 -05:00
parent 45d8ed53ac
commit abf194b92b
3 changed files with 4 additions and 3 deletions

View File

@ -190,7 +190,7 @@ class IRCClient(object):
try: try:
buffer += self.socket.recv(1024) buffer += self.socket.recv(1024)
except socket.error as e: except socket.error as e:
if not self.blocking and e.errno == 11: if False and not self.blocking and e.errno == 11:
pass pass
else: else:
raise e raise e
@ -228,6 +228,7 @@ class IRCClient(object):
if self.socket: if self.socket:
logging.info('closing socket') logging.info('closing socket')
self.socket.close() self.socket.close()
raise SystemExit
def msg(self, user, msg): def msg(self, user, msg):
for line in msg.split('\n'): for line in msg.split('\n'):
maxchars = 494 - len(self.nickname+self.ident+self.hostmask+user) maxchars = 494 - len(self.nickname+self.ident+self.hostmask+user)

2
var.py
View File

@ -14,7 +14,7 @@ DAY_TIME_LIMIT_CHANGE = 120 # After DAY_TIME_LIMIT_WARN has passed
START_WITH_DAY = False START_WITH_DAY = False
KILL_IDLE_TIME = 300 KILL_IDLE_TIME = 300
WARN_IDLE_TIME = 180 WARN_IDLE_TIME = 180
PART_GRACE_TIME = 0 PART_GRACE_TIME = 7
QUIT_GRACE_TIME = 30 QUIT_GRACE_TIME = 30
LOG_FILENAME = "" LOG_FILENAME = ""

View File

@ -119,5 +119,5 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
try: try:
main() main()
except: except Exception:
logging.error(traceback.format_exc()) logging.error(traceback.format_exc())