2010-01-17 04:24:36 +00:00
|
|
|
import socket
|
2010-03-11 23:34:54 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
from util import hook
|
2010-01-17 04:24:36 +00:00
|
|
|
|
2010-03-11 23:34:54 +00:00
|
|
|
socket.setdefaulttimeout(10) # global setting
|
2010-01-17 04:24:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
#autorejoin channels
|
|
|
|
@hook.event('KICK')
|
2010-02-02 04:42:34 +00:00
|
|
|
def rejoin(inp, paraml=[], conn=None):
|
|
|
|
if paraml[1] == conn.nick:
|
|
|
|
if paraml[0].lower() in conn.channels:
|
|
|
|
conn.join(paraml[0])
|
2010-01-17 04:24:36 +00:00
|
|
|
|
2010-03-01 02:32:41 +00:00
|
|
|
|
2010-01-17 04:24:36 +00:00
|
|
|
#join channels when invited
|
|
|
|
@hook.event('INVITE')
|
2010-02-02 04:42:34 +00:00
|
|
|
def invite(inp, command='', conn=None):
|
|
|
|
if command == 'INVITE':
|
|
|
|
conn.join(inp)
|
2010-01-17 04:24:36 +00:00
|
|
|
|
2010-03-01 02:32:41 +00:00
|
|
|
|
2010-01-17 04:24:36 +00:00
|
|
|
#join channels when server says hello & identify bot
|
|
|
|
@hook.event('004')
|
2010-02-02 04:42:34 +00:00
|
|
|
def onjoin(inp, conn=None):
|
|
|
|
nickserv_password = conn.conf.get('nickserv_password', '')
|
|
|
|
nickserv_name = conn.conf.get('nickserv_name', 'nickserv')
|
|
|
|
nickserv_command = conn.conf.get('nickserv_command', 'IDENTIFY %s')
|
2010-01-17 04:24:36 +00:00
|
|
|
if nickserv_password:
|
2010-02-02 04:42:34 +00:00
|
|
|
conn.msg(nickserv_name, nickserv_command % nickserv_password)
|
2010-03-11 23:34:54 +00:00
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
for channel in conn.channels:
|
|
|
|
conn.join(channel)
|
|
|
|
time.sleep(1) # don't flood JOINs
|