[vhffs-dev] [925] Improved the lsgroup in one line :p

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


Revision: 925
Author:   gradator
Date:     2007-09-15 15:11:33 +0000 (Sat, 15 Sep 2007)

Log Message:
-----------
Improved the lsgroup in one line :p

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


Modified: trunk/vhffs-irc/modobot.pl
===================================================================
--- trunk/vhffs-irc/modobot.pl	2007-09-15 14:50:48 UTC (rev 924)
+++ trunk/vhffs-irc/modobot.pl	2007-09-15 15:11:33 UTC (rev 925)
@@ -206,33 +206,24 @@
 
 sub fetch_usergroup
 {
- my $groupname = shift;
- my $group;
- if (! defined ($group= Vhffs::Group::get_by_groupname( $vhffs , $groupname , '401' )))
- {
-  irc_msg ("$groupname : No such group");
- }
- else
- {
-  my $users = Vhffs::Group::get_users($group);
-  my $temp;
-  my $list_usergroup_owner;
-  my $list_usergroup_members;
+	my $groupname = shift;
+	my $group = Vhffs::Group::get_by_groupname( $vhffs , $groupname );
+	unless( defined $group )
+	{
+		irc_msg ($groupname.' : No such group');
+		return;
+	}
 
-  foreach $temp ( @{$users} )
-  {
-   if ( $temp->get_username =~ $group->get_owner_username)
-   {
-    $list_usergroup_owner .= "@".$temp->get_username." ";
-   }   
-   else
-   {
-    $list_usergroup_members .= "+".$temp->get_username." ";
-   }
-  }
-  my $list_usergroup .= $list_usergroup_owner.$list_usergroup_members;
-  irc_msg($list_usergroup);
- }
+	my $users = Vhffs::Group::get_users( $group );
+	my $list = '';
+
+	foreach ( @{$users} )
+	{
+		$list .= '@' if( $_->get_username eq $group->get_owner_username );
+		$list .= $_->get_username.' ';
+	}
+
+	irc_msg( $list );
 }
 
 


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