mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Move some more IRC configuration to network_config
This commit is contained in:
parent
00b742445e
commit
0e144e14b3
2 changed files with 12 additions and 13 deletions
|
@ -12,13 +12,6 @@
|
|||
|
||||
tipbot_name = "monero-testnet-tipbot"
|
||||
|
||||
irc_network = 'irc.freenode.net'
|
||||
irc_port = 6697
|
||||
irc_send_delay = 0.4
|
||||
irc_welcome_line = 'Welcome to the freenode Internet Relay Chat Network'
|
||||
irc_channels = ['#txtptest000']
|
||||
irc_timeout_seconds = 600
|
||||
|
||||
redis_host="127.0.0.1"
|
||||
redis_port=7777
|
||||
|
||||
|
@ -49,10 +42,13 @@ network_config = {
|
|||
'host': 'irc.freenode.net',
|
||||
'port': 6697,
|
||||
'login': tipbot_name,
|
||||
'delay': irc_send_delay,
|
||||
'delay': 0.4,
|
||||
'ssl': True,
|
||||
'sasl': True,
|
||||
'sasl_name': 'monero-tipbot',
|
||||
'welcome_line': 'Welcome to the freenode Internet Relay Chat Network',
|
||||
'timeout_seconds': 600,
|
||||
'channels': ['#txtptest000'],
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@ class IRCNetwork(Network):
|
|||
delay=cfg['delay']
|
||||
self.use_ssl=cfg['ssl']
|
||||
self.use_sasl=cfg['sasl']
|
||||
self.welcome_line=cfg['welcome_line']
|
||||
self.timeout_seconds=cfg['timeout_seconds']
|
||||
self.channels=cfg['channels']
|
||||
if self.use_sasl:
|
||||
self.sasl_name=cfg['sasl_name']
|
||||
except Exception,e:
|
||||
|
@ -162,14 +165,14 @@ class IRCNetwork(Network):
|
|||
try:
|
||||
data=self._getline()
|
||||
except Exception,e:
|
||||
log_warn('Exception from IRCNetwork:_getline, we were probably disconnected, reconnecting in %s seconds' % config.irc_timeout_seconds)
|
||||
log_warn('Exception from IRCNetwork:_getline, we were probably disconnected, reconnecting in %s seconds' % self.timeout_seconds)
|
||||
time.sleep(5)
|
||||
self.last_ping_time = time.time()
|
||||
self._reconnect()
|
||||
return True
|
||||
if data == None:
|
||||
if time.time() - self.last_ping_time > config.irc_timeout_seconds:
|
||||
log_warn('%s seconds without PING, reconnecting in 5 seconds' % config.irc_timeout_seconds)
|
||||
if time.time() - self.last_ping_time > self.timeout_seconds:
|
||||
log_warn('%s seconds without PING, reconnecting in 5 seconds' % self.timeout_seconds)
|
||||
time.sleep(5)
|
||||
self.last_ping_time = time.time()
|
||||
self._reconnect()
|
||||
|
@ -181,12 +184,12 @@ class IRCNetwork(Network):
|
|||
# consider any IRC data as a ping
|
||||
self.last_ping_time = time.time()
|
||||
|
||||
if data.find ( config.irc_welcome_line ) != -1:
|
||||
if data.find ( self.welcome_line ) != -1:
|
||||
self.userstable = dict()
|
||||
self.registered_users.clear()
|
||||
if not self.use_sasl:
|
||||
self.login()
|
||||
for chan in config.irc_channels:
|
||||
for chan in self.channels:
|
||||
self.join(chan)
|
||||
#ScanWho(None,[chan])
|
||||
|
||||
|
|
Loading…
Reference in a new issue