- EDA2C9E8930F8207A7588763084768F494B4CAD89C6CCCEC07E9C7412AE8CE238A07B970A7F937048B7CAE1F5D7D92CF67ED88E9802A7694CE0CB274D9A81DD3
+ 80D24124B12055C919F68583A83445477D13680DB62960B9AC57A6D7CA066F52973E9FC1BC3F80ECF6B541D0784CFBFA10195792F2A9D786C57143720584F88A
logotron/bot.py
(14 . 7)(14 . 7)
38 ##############################################################################
39
40 # Version. If changing this program, always set this to same # as in MANIFEST
41 Ver = 597604
42 Ver = 597858
43
44 ##############################################################################
45
(66 . 6)(66 . 7)
47 Pass = cfg.get("irc", "pass")
48 Channels = [x.strip() for x in cfg.get("irc", "chans").split(',')]
49 Join_Delay = int(cfg.get("irc", "join_t"))
50 Discon_TO = int(cfg.get("irc", "disc_t"))
51 Prefix = cfg.get("control", "prefix")
52 # DBism:
53 DB_Name = cfg.get("db", "db_name")
(129 . 6)(130 . 9)
55 # Used to compute 'uptime'
56 time_last_conn = datetime.now()
57
58 # Used to monitor disconnection timeout
59 time_last_recv = datetime.now()
60
61 # Socket will be here:
62 sock = None;
63
(244 . 6)(248 . 7)
65 def irc():
66 global connected
67 global time_last_conn
68 global time_last_recv
69 global sock
70
71 # Initialize a socket
(274 . 8)(279 . 15)
73 while connected:
74 try:
75 data = sock.recv(Buf_Size)
76 time_last_recv = datetime.now() # Received anything -- reset timer
77 except socket.timeout as e:
78 logging.debug("Receive timed out")
79 # Determine whether the connection has timed out:
80 since_recv = (datetime.now() - time_last_recv).seconds
81 if since_recv > Discon_TO:
82 logging.info("Exceeded %d seconds of silence " % Discon_TO
83 + "from server: disconnecting!")
84 deinit_socket()
85 continue
86 except socket.error as e:
87 logging.warning("Receive socket error, disconnecting.")