[vhffs-dev] 2 patch about DNS and ircbot

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


Hi !

I hope this time my patch working...

First fixed bug for DNS serial

Last add function for ircbot

misric
diff -Naur vhffs/trunk/vhffs-api/src/Vhffs/Services/DNS.pm vhffs-dev/trunk/vhffs-api/src/Vhffs/Services/DNS.pm
--- vhffs/trunk/vhffs-api/src/Vhffs/Services/DNS.pm     2006-12-29 00:47:36.000000000 +0100
+++ vhffs-dev/trunk/vhffs-api/src/Vhffs/Services/DNS.pm 2006-12-29 00:54:48.000000000 +0100
@@ -713,8 +713,7 @@

        #Update the serial to refresh the domain
        my ($second,$minutes,$hours,$day,$month,$year) = localtime(time);
-       $year+=1900;
-       my $newserial = sprintf('%.4u%.2u%.2u01',$year,$month,$day);
+       my $newserial = sprintf('%.4u%.2u%.2u01',$year+1900,$month+1,$day);

        if( $self->{SOA}->{serial} =~ /^$year$month$day/  ||  $self->{SOA}->{serial} > $newserial )
        {

diff -Naur vhffs/trunk/vhffs-irc/modobot.pl vhffs-dev/trunk/vhffs-irc/modobot.pl
--- vhffs/trunk/vhffs-irc/modobot.pl	2006-12-29 00:47:38.000000000 +0100
+++ vhffs-dev/trunk/vhffs-irc/modobot.pl	2006-12-29 00:59:59.000000000 +0100
@@ -468,7 +468,7 @@
     my $self=shift;
     $bot=$self;
     $self->join($chan);
-    irc_msg ("--> Pacman started");
+    irc_msg ("--> $botname started");
 } # on_connect
 
 sub is_modo
@@ -500,6 +500,21 @@
     }
 }
 
+sub find_group_from_web
+{
+    my $name = shift;
+    my $web;
+    if ((! defined ($web = new Vhffs::Services::Httpd( $vhffs , $name, $name ) ) ) || ( $web->fetch < 0 ))
+   {
+       irc_msg ("$name : No such website");
+   }
+   else
+   {
+       irc_msg ("$name => group  ".Vhffs::Group::get_name_by_gid($vhffs,$web->get_ownergid));
+   }
+
+}
+
 sub irc_msg
 {
     my $text = shift;
@@ -550,6 +565,7 @@
         irc_msg("refuse <oid> <reason> - refuse object with id <oid> for reason <reason>");
 	irc_msg("list - force listing of all objects waiting for moderation");
 	irc_msg("desc <group> - give the description of <group>");
+        irc_msg("web2group <website> - give the groupe name of <website>");
     }
     elsif ($texte =~ m/^${mynick}: list$/)
     {
@@ -571,6 +587,15 @@
 	$groupid =~ s/^${mynick}: desc //;
         get_desc ($groupid);
     }
+
+    elsif ($texte =~ m/^${mynick}: web2group [a-z0-9\.\-]+$/)
+    {
+        my $webtogroup = $texte;
+        $webtogroup =~ s/^${mynick}: web2group //;
+        find_group_from_web($webtogroup);
+    }
+
+
 } # on_public
 
 sub on_kick {


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