[vhffs-dev] [1217] Tags are now displayed by moderation bot.

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


Revision: 1217
Author:   beuss
Date:     2008-06-04 23:24:00 +0200 (Wed, 04 Jun 2008)

Log Message:
-----------
Tags are now displayed by moderation bot.

Modified Paths:
--------------
    trunk/vhffs-irc/modobot.pl


Modified: trunk/vhffs-irc/modobot.pl
===================================================================
--- trunk/vhffs-irc/modobot.pl	2008-06-04 20:46:12 UTC (rev 1216)
+++ trunk/vhffs-irc/modobot.pl	2008-06-04 21:24:00 UTC (rev 1217)
@@ -19,6 +19,7 @@
 use Vhffs::Constants;
 use Vhffs::Object;
 use Vhffs::ObjectFactory;
+use Vhffs::Tag;
 
 use Net::IRC;
 use Net::DNS;
@@ -75,6 +76,7 @@
 			my $msg = '['.$duration.'] '.Vhffs::Functions::type_string_from_type_id( $obj->{type} ).':   '.$obj->get_oid.'   '.$user->get_username;
 			$msg .= ' ('.$user->get_note.')' if( $vhffs->get_config->get_users->{'use_notation'} eq 'yes' );
 			$msg .= ' ['.$user->get_lang.']   '.$group->get_groupname.'   '.$object->get_label.'   '.$obj->get_description;
+			$msg .= "\n[".format_tags_list($group).']';
 			irc_msg( $msg );
 
 			${%oldobjects}{$obj->get_oid} = '';
@@ -215,10 +217,26 @@
     }
     else
     {
-        irc_msg ("$name : " . $group->get_description );
+        irc_msg ("$name : " . $group->get_description.'['.format_tags_list($group).']' );
     }
 }
 
+sub format_tags_list {
+	my ($object) = @_;
+	my $tag_categories = $object->get_tags(Vhffs::Constants::TAG_VISIBILITY_MODERATORS);
+	
+	return 'No tag' unless(@$tag_categories);
+	
+	my $result = '';
+	foreach(@$tag_categories) {
+		$result .= $_->{label}.': ';
+		foreach(@{$_->{tags}}) {
+			$result .= $_->{label}.', ';
+		}
+	}
+	$result = substr($result, 0, -2);
+}
+
 sub find_group_from_web
 {
     my $name = shift;


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