Log connection, end of MOTD and joining channels in normal mode

This commit is contained in:
nyuszika7h 2015-11-27 17:36:59 +01:00
parent d72eadf34f
commit c6a5cea715
4 changed files with 15 additions and 12 deletions

View File

@ -174,7 +174,6 @@ class IRCClient(object):
"""
try:
self.stream_handler('connecting to {0}:{1}'.format(self.host, self.port))
retries = 0
while True:
try:

View File

@ -74,7 +74,9 @@ def unhandled(cli, prefix, cmd, *args):
def connect_callback(cli):
@hook("endofmotd", hookid=294)
@hook("nomotd", hookid=294)
def prepare_stuff(cli, *args):
def prepare_stuff(cli, prefix, *args):
alog("Received end of MOTD from {0}".format(prefix))
# just in case we haven't managed to successfully auth yet
if not botconfig.SASL_AUTHENTICATION:
cli.ns_identify(botconfig.USERNAME or botconfig.NICK,

View File

@ -3295,16 +3295,17 @@ def update_last_said(cli, nick, chan, rest):
@hook("join")
def on_join(cli, raw_nick, chan, acc="*", rname=""):
nick, _, ident, host = parse_nick(raw_nick)
if nick != botconfig.NICK:
if nick not in var.USERS.keys():
var.USERS[nick] = dict(ident=ident,host=host,account=acc,inchan=chan == botconfig.CHANNEL,modes=set(),moded=set())
else:
var.USERS[nick]["ident"] = ident
var.USERS[nick]["host"] = host
var.USERS[nick]["account"] = acc
if not var.USERS[nick]["inchan"]:
# Will be True if the user joined the main channel, else False
var.USERS[nick]["inchan"] = (chan == botconfig.CHANNEL)
if nick == botconfig.NICK:
plog("Joined {0}".format(chan))
elif nick not in var.USERS.keys():
var.USERS[nick] = dict(ident=ident,host=host,account=acc,inchan=chan == botconfig.CHANNEL,modes=set(),moded=set())
else:
var.USERS[nick]["ident"] = ident
var.USERS[nick]["host"] = host
var.USERS[nick]["account"] = acc
if not var.USERS[nick]["inchan"]:
# Will be True if the user joined the main channel, else False
var.USERS[nick]["inchan"] = (chan == botconfig.CHANNEL)
if chan != botconfig.CHANNEL:
return
with var.GRAVEYARD_LOCK:

View File

@ -45,6 +45,7 @@ import src
from src import handler
def main():
src.logger(None)("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
cli = IRCClient(
{"privmsg": handler.on_privmsg,
"notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),