[vhffs-dev] [386] Merging misric patches, dns date serial fix and some improvements in modobot

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


Revision: 386
Author:   gradator
Date:     2006-12-30 16:14:06 +0000 (Sat, 30 Dec 2006)

Log Message:
-----------
Merging misric patches, dns date serial fix and some improvements in modobot

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm
    branches/vhffs_4.1/vhffs-irc/modobot.pl
    trunk/vhffs-api/src/Vhffs/Services/DNS.pm
    trunk/vhffs-irc/modobot.pl


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm	2006-12-22 23:50:27 UTC (rev 385)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm	2006-12-30 16:14:06 UTC (rev 386)
@@ -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 )
 	{

Modified: branches/vhffs_4.1/vhffs-irc/modobot.pl
===================================================================
--- branches/vhffs_4.1/vhffs-irc/modobot.pl	2006-12-22 23:50:27 UTC (rev 385)
+++ branches/vhffs_4.1/vhffs-irc/modobot.pl	2006-12-30 16:14:06 UTC (rev 386)
@@ -461,7 +461,7 @@
     my $self=shift;
     $bot=$self;
     $self->join($chan);
-    irc_msg ("--> Pacman started");
+    irc_msg ("--> $botname started");
     &CatchAlrm();
 } # on_connect
 
@@ -485,6 +485,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;
@@ -535,6 +550,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$/)
     {
@@ -556,6 +572,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 {

Modified: trunk/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/DNS.pm	2006-12-22 23:50:27 UTC (rev 385)
+++ trunk/vhffs-api/src/Vhffs/Services/DNS.pm	2006-12-30 16:14:06 UTC (rev 386)
@@ -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 )
 	{

Modified: trunk/vhffs-irc/modobot.pl
===================================================================
--- trunk/vhffs-irc/modobot.pl	2006-12-22 23:50:27 UTC (rev 385)
+++ trunk/vhffs-irc/modobot.pl	2006-12-30 16:14:06 UTC (rev 386)
@@ -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/