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: try:
self.stream_handler('connecting to {0}:{1}'.format(self.host, self.port))
retries = 0 retries = 0
while True: while True:
try: try:

View File

@ -74,7 +74,9 @@ def unhandled(cli, prefix, cmd, *args):
def connect_callback(cli): def connect_callback(cli):
@hook("endofmotd", hookid=294) @hook("endofmotd", hookid=294)
@hook("nomotd", 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 # just in case we haven't managed to successfully auth yet
if not botconfig.SASL_AUTHENTICATION: if not botconfig.SASL_AUTHENTICATION:
cli.ns_identify(botconfig.USERNAME or botconfig.NICK, cli.ns_identify(botconfig.USERNAME or botconfig.NICK,

View File

@ -3295,8 +3295,9 @@ def update_last_said(cli, nick, chan, rest):
@hook("join") @hook("join")
def on_join(cli, raw_nick, chan, acc="*", rname=""): def on_join(cli, raw_nick, chan, acc="*", rname=""):
nick, _, ident, host = parse_nick(raw_nick) nick, _, ident, host = parse_nick(raw_nick)
if nick != botconfig.NICK: if nick == botconfig.NICK:
if nick not in var.USERS.keys(): 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()) var.USERS[nick] = dict(ident=ident,host=host,account=acc,inchan=chan == botconfig.CHANNEL,modes=set(),moded=set())
else: else:
var.USERS[nick]["ident"] = ident var.USERS[nick]["ident"] = ident

View File

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