From da2b14dae5988bffac9c32eb1c5d4a1143bc119b Mon Sep 17 00:00:00 2001 From: Nikunj Mehta Date: Mon, 25 Jun 2012 15:40:35 -0400 Subject: [PATCH] Added new config option show_motd (True by default) which allows suppression of MOTD messages. --- bot.py | 11 ++++++----- server.cfg | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index 1bbdee0..1b6278c 100755 --- a/bot.py +++ b/bot.py @@ -127,18 +127,19 @@ def user_join_channel(channel): line = f.readline().rstrip() while line: - if get_config_bool('show_timestamps'): - print '[' + str(datetime.datetime.now()) + '] ' + line - else: - print line message_parts = line.split(' ') + if get_config_bool('show_motd') or len(message_parts) < 2 or message_parts[1] not in ['372','375','376']: + if get_config_bool('show_timestamps'): + print '[' + str(datetime.datetime.now()) + '] ' + line + else: + print line if message_parts[0] == 'PING': write('PONG ' + message_parts[1]) elif len(message_parts) > 4 and message_parts[3] == ':PING': send_notice(get_nick(line), 'PONG ' + message_parts[4]) elif len(line.split(':')) > 2 and line.split(':')[2] == 'VERSION': send_notice(get_nick(line), 'VERSION ' + VERSION + '') - elif message_parts[1] == '001': + elif len(message_parts) > 1 and message_parts[1] == '001': user_identify() user_set_modes(get_config('usermodes')) for channel in get_config_list('channels'): diff --git a/server.cfg b/server.cfg index dc59a2a..2a54d7e 100644 --- a/server.cfg +++ b/server.cfg @@ -1,8 +1,9 @@ [enigma-irc-bot] ; Application -show_timestamps = True command_prefix = @ +show_timestamps = True +show_motd = True ; Connection hostname = irc.dairc.net