From: Andreas Scherbaum Date: Sat, 11 Aug 2012 23:07:50 +0000 (+0200) Subject: - implement "autojoin" configuration setting (default: yes) X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=6ce1d65d58d22cf94297e10fe4135bc748729806;p=docbot.git - implement "autojoin" configuration setting (default: yes) --- diff --git a/docbot.conf b/docbot.conf index c716513..9e9babc 100644 --- a/docbot.conf +++ b/docbot.conf @@ -4,6 +4,7 @@ channels: password: '' session: 1 language: 'de' + autojoin: '1' '#pg_docbot_test1': password: '' session: 2 diff --git a/docbot.pl b/docbot.pl index 24b96ee..33787f6 100755 --- a/docbot.pl +++ b/docbot.pl @@ -3515,7 +3515,21 @@ sub on_connect { my @join_channels = (); foreach my $channel (@channels) { my $channel_session = config_get_key3('channels', $channel, 'session'); - if ($channel_session == $session) { + my $channel_autojoin = config_get_key3('channels', $channel, 'autojoin'); + if (!defined($channel_autojoin)) { + $channel_autojoin = ''; + } + # autojoin is the default + my $channel_autojoin_result = 1; + given ($channel_autojoin) { + when(/^0$/) {$channel_autojoin_result = 0;} + when(/^n$/) {$channel_autojoin_result = 0;} + when(/^no$/) {$channel_autojoin_result = 0;} + when(/^1$/) {$channel_autojoin_result = 1;} + when(/^y$/) {$channel_autojoin_result = 1;} + when(/^yes$/) {$channel_autojoin_result = 1;} + } + if ($channel_session == $session and $channel_autojoin_result == 1) { push(@join_channels, $channel); print_msg("assign irc channel '$channel' to session '$session'", DEBUG); } diff --git a/todo.txt b/todo.txt index b8b1e0a..536baa4 100644 --- a/todo.txt +++ b/todo.txt @@ -9,7 +9,6 @@ - nickserv handling (passwords) - verify channel list from time to time, autojoin missing channels - allow a password for the ?join command -- predefine channels in the configuration which are not autojoined @@ -29,3 +28,4 @@ - verify existence of required tables at startup OK - move translations to a separate file OK - channel passwords OK +- predefine channels in the configuration which are not autojoined OK