[vhffs-dev] patch for modobot

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi !

In attachement, a patch for modobot.pl (add user lang in moderation)

Vhffs::Panel::User->get_lang is now in Vhffs::User->get_lang too

misric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRaAFJcmD1AtgNpAgAQKTSAf9GT5xc65+KAKYBKnu604zbU/wMYNUvW6D
HDQ6JwlHdt/Y3aM0NLro7oo5VfO6onwxrnboFDO3yJL8Vi3TclR3zKSBvn7OIcUp
p70LVMATKhHzut2gB6KhwaE4coDbUU82OaKsNW4Qc0uLjeLJjnUo1lYqx2OsI9/3
8pEZP70eEpk5OV7kwKkjhgT5ghP+n7jQlO3mry8Bo/ebmbrPOhu8VL/fsPP+1iB6
nOu438HqjnJxYNY6YDud53I/CiPV3arHy8kSJOHLOlEyu6mcN6i9nciEgMCxIVQ+
AGavZ9pnlUOWRiDQvt5z6rSCaO1JhfSm7LOH5I0vcSi4fk1AhGTTsg==
=urJp
-----END PGP SIGNATURE-----
diff -Naur vhffs/branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm vhffs-dev/branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm
--- vhffs/branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm	2007-01-06 17:07:08.000000000 +0100
+++ vhffs-dev/branches/vhffs_4.1/vhffs-api/src/Vhffs/User.pm	2007-01-06 21:12:45.000000000 +0100
@@ -676,7 +676,24 @@
     }
 }
 
+sub get_lang
+{
+    my $self = shift;
 
+    my $query = "SELECT language FROM vhffs_panel_user_prefs WHERE uid='".$self->get_uid."'";
+    my $request = $self->{'db'}->{'DB_READ'}->prepare( $query );
+    my $rows = $request->execute;
+ 
+   if( $rows == 0 )
+   {
+     return Vhffs::Constants::DEFAULT_LANG;
+   }
+   else
+   {
+     my $value = $request->fetchrow_arrayref;
+     return $value->[0];
+   }
+}
 
 
 sub get_mail
@@ -1055,6 +1072,8 @@
 
 get_gid( )
 
+get_lang( )
+
 get_mail( )
 
 get_group( )
diff -Naur vhffs/branches/vhffs_4.1/vhffs-irc/modobot.pl vhffs-dev/branches/vhffs_4.1/vhffs-irc/modobot.pl
--- vhffs/branches/vhffs_4.1/vhffs-irc/modobot.pl	2007-01-06 17:07:13.000000000 +0100
+++ vhffs-dev/branches/vhffs_4.1/vhffs-irc/modobot.pl	2007-01-06 21:15:31.000000000 +0100
@@ -87,7 +87,7 @@
 	    map { last GR if (($_->get_oid eq $temp->get_oid) && ($_->get_groupname eq $temp->get_groupname)); } @oldgroup;
             if( $vhffs->get_config->use_notation == 1 )
             {
-                irc_msg ("Groupe :      " . $temp->get_oid . "   " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")   " . $temp->get_groupname . "   " . Vhffs::Functions::stripslashes($temp->get_description));
+                irc_msg ("Groupe :      " . $temp->get_oid . "   " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " .  $temp->get_groupname . "   " . Vhffs::Functions::stripslashes($temp->get_description));
             }
             else
             {
@@ -115,7 +115,7 @@
 
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Web :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_servername . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Web :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_servername . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -143,7 +143,7 @@
 	        map { last DN if (($_->get_oid eq $temp->get_oid) && ($_->get_domain eq $temp->get_domain)); } @olddns;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("DNS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("DNS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
 		}
                 else
                 {
@@ -172,7 +172,7 @@
 	        map { last CV if (($_->get_oid eq $temp->get_oid) && ($_->get_cvsroot eq $temp->get_cvsroot)); } @oldcvs;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("CVS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_cvsroot . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("CVS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_cvsroot . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -228,7 +228,7 @@
                 map { last SV if (($_->get_oid eq $temp->get_oid) && ($_->get_reponame eq $temp->get_reponame)); } @oldsvn;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("SVN :          " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_reponame . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("SVN :          " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_reponame . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -256,7 +256,7 @@
                 map { last MA if (($_->get_oid eq $temp->get_oid) && ($_->get_domain eq $temp->get_domain)); } @oldmail;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Mail :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Mail :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -284,7 +284,7 @@
                 map { last MY if (($_->get_oid eq $temp->get_oid) && ($_->get_dbname eq $temp->get_dbname)); } @oldmysql;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("MySql :        " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("MySql :        " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -312,7 +312,7 @@
                 map { last PO if (($_->get_oid eq $temp->get_oid) && ($_->get_dbname eq $temp->get_dbname)); } @oldpostgres;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Postgres :     " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Postgres :     " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -340,7 +340,7 @@
 	        map { last RP if (($_->get_oid eq $temp->get_oid) && ($_->get_name eq $temp->get_name)); } @oldrepository;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("REPOSITORY :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_name . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("REPOSITORY :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_name . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
diff -Naur vhffs/trunk/vhffs-api/src/Vhffs/User.pm vhffs-dev/trunk/vhffs-api/src/Vhffs/User.pm
--- vhffs/trunk/vhffs-api/src/Vhffs/User.pm	2007-01-06 17:03:47.000000000 +0100
+++ vhffs-dev/trunk/vhffs-api/src/Vhffs/User.pm	2007-01-06 20:41:51.000000000 +0100
@@ -595,6 +595,24 @@
     }
 }
 
+sub get_lang
+{
+    my $self = shift;
+
+    my $query = "SELECT language FROM vhffs_panel_user_prefs WHERE uid='".$self->get_uid."'";
+    my $request = $self->{'db'}->{'DB_READ'}->prepare( $query );
+    my $rows = $request->execute;
+ 
+   if( $rows == 0 )
+   {
+     return Vhffs::Constants::DEFAULT_LANG;
+   }
+   else
+   {
+     my $value = $request->fetchrow_arrayref;
+     return $value->[0];
+   }
+}
 
 
 
@@ -946,6 +964,8 @@
 
 get_gid( )
 
+get_lang( )
+
 get_mail( )
 
 get_group( )
diff -Naur vhffs/trunk/vhffs-irc/modobot.pl vhffs-dev/trunk/vhffs-irc/modobot.pl
--- vhffs/trunk/vhffs-irc/modobot.pl	2007-01-06 17:03:51.000000000 +0100
+++ vhffs-dev/trunk/vhffs-irc/modobot.pl	2007-01-06 20:52:34.000000000 +0100
@@ -87,7 +87,7 @@
 	    map { last GR if (($_->get_oid eq $temp->get_oid) && ($_->get_groupname eq $temp->get_groupname)); } @oldgroup;
             if( $vhffs->get_config->use_notation == 1 )
             {
-                irc_msg ("Groupe :      " . $temp->get_oid . "   " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")   " . $temp->get_groupname . "   " . Vhffs::Functions::stripslashes($temp->get_description));
+                irc_msg ("Groupe :      " . $temp->get_oid . "   " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_groupname . "   " . Vhffs::Functions::stripslashes($temp->get_description));
             }
             else
             {
@@ -115,7 +115,7 @@
 
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Web :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_servername . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Web :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_servername . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -143,7 +143,7 @@
 	        map { last DN if (($_->get_oid eq $temp->get_oid) && ($_->get_domain eq $temp->get_domain)); } @olddns;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("DNS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("DNS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
 		}
                 else
                 {
@@ -172,7 +172,7 @@
 	        map { last CV if (($_->get_oid eq $temp->get_oid) && ($_->get_cvsroot eq $temp->get_cvsroot)); } @oldcvs;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("CVS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_cvsroot . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("CVS :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_cvsroot . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -200,7 +200,7 @@
                 map { last ML if (($_->get_oid eq $temp->get_oid) && ($_->get_localpart eq $temp->get_localpart)); } @oldmailing;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Mailing list : " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_localpart . "@" . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Mailing list : " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_localpart . "@" . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -228,7 +228,7 @@
                 map { last SV if (($_->get_oid eq $temp->get_oid) && ($_->get_reponame eq $temp->get_reponame)); } @oldsvn;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("SVN :          " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_reponame . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("SVN :          " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_reponame . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -256,7 +256,7 @@
                 map { last MA if (($_->get_oid eq $temp->get_oid) && ($_->get_domain eq $temp->get_domain)); } @oldmail;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Mail :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Mail :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_domain . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -284,7 +284,7 @@
                 map { last MY if (($_->get_oid eq $temp->get_oid) && ($_->get_dbname eq $temp->get_dbname)); } @oldmysql;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("MySql :        " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("MySql :        " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -312,7 +312,7 @@
                 map { last PO if (($_->get_oid eq $temp->get_oid) && ($_->get_dbname eq $temp->get_dbname)); } @oldpostgres;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("Postgres :     " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("Postgres :     " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_dbname . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {
@@ -340,7 +340,7 @@
 	        map { last RP if (($_->get_oid eq $temp->get_oid) && ($_->get_name eq $temp->get_name)); } @oldrepository;
                 if( $vhffs->get_config->use_notation == 1 )
                 {
-                    irc_msg ("REPOSITORY :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")    " . $temp->get_group->get_groupname . "    " . $temp->get_name . "    " . Vhffs::Functions::stripslashes($temp->get_description));
+                    irc_msg ("REPOSITORY :         " . $temp->get_oid . "    " . $temp->get_user->get_username . "(" .  Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."]   " . $temp->get_group->get_groupname . "    " . $temp->get_name . "    " . Vhffs::Functions::stripslashes($temp->get_description));
                 }
                 else
                 {


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