[vhffs-dev] [919] Modobot configuration is now in vhffs.conf

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 919
Author:   gradator
Date:     2007-09-12 18:46:45 +0000 (Wed, 12 Sep 2007)

Log Message:
-----------
Modobot configuration is now in vhffs.conf

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Conf.pm
    trunk/vhffs-backend/conf/vhffs.conf.dist.in
    trunk/vhffs-irc/modobot.pl


Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm	2007-09-12 18:20:25 UTC (rev 918)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm	2007-09-12 18:46:45 UTC (rev 919)
@@ -131,7 +131,12 @@
 	return $Config{'robots'};
 }
 
+sub get_irc
+{
+	return $Config{'irc'};
+}
 
+
 # -- global parameters ---
 
 sub get_host_name

Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in	2007-09-12 18:20:25 UTC (rev 918)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in	2007-09-12 18:46:45 UTC (rev 919)
@@ -467,3 +467,19 @@
 	use_lock	=	yes
 	lockfile	=	/var/lock/vhffs
 </robots>
+
+
+######
+# IRC
+#################################
+<irc>
+	# Where modobot should connect ?
+	modobot_server	=	irc.mynetwork
+	modobot_port	=	6667
+
+	# On which channel it should join ?
+	modobot_channel	=	\#adm-myservice
+
+	# Which is its name ?
+	modobot_name	=	modobot
+</irc>

Modified: trunk/vhffs-irc/modobot.pl
===================================================================
--- trunk/vhffs-irc/modobot.pl	2007-09-12 18:20:25 UTC (rev 918)
+++ trunk/vhffs-irc/modobot.pl	2007-09-12 18:46:45 UTC (rev 919)
@@ -23,40 +23,26 @@
 use Net::IRC;
 use Text::Wrapper;
 
-use constant
-{
-    SERVER  => 'PUT YOUR IRC SERVER HERE',
-    PORT    => '6667',
-    CHANNEL => 'IRC CHANNEL TO JOIN WITH #',
-    NAME    => 'BOT NAME',
-};
-
-
-################# DO NOT EDIT BELOW THIS LINE ######################
-
-# Configuration
-my $srv = SERVER;
-my $chan = CHANNEL;
-my $botname = NAME;
 my $bot;
-my $port = PORT;
+my $cmpt = 0;
 
 my %oldobjects = ();
 
 my $irc=new Net::IRC;
 
-my $cmpt = 0;
-
 # Connections to servers
 
 my $vhffs = init Vhffs::Main;
 exit 1 unless $vhffs;
 
-my $conn=$irc->newconn(Nick     =>  $botname,
-                       Server   =>      $srv,
-                       Port     =>     $port,
-                       Username =>  'pacman',
-                       Ircname  =>  'Bernard Minet' );
+my $configirc = $vhffs->get_config->get_irc;
+my $chan = $configirc->{modobot_channel};
+
+my $conn=$irc->newconn(Nick     =>  $configirc->{modobot_name},
+                       Server   =>  $configirc->{modobot_server},
+                       Port     =>  $configirc->{modobot_port},
+                       Username =>  'modobot',
+                       Ircname  =>  'VHFFS Moderation bot' );
 exit 2 unless $conn;
 
 
@@ -158,7 +144,7 @@
     my $self=shift;
     $bot=$self;
     $self->join($chan);
-    irc_msg ("--> $botname started");
+    irc_msg ("--> $configirc->{modobot_name} started");
     &CatchAlrm();
 } # on_connect
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/