[Slashdotjp-dev 565] CVS update: slashjp/plugins/Zoo

アーカイブの一覧に戻る

Tatsuki SUGIURA sugi****@users*****
2006年 7月 13日 (木) 10:12:27 JST


Index: slashjp/plugins/Zoo/zoo.pl
diff -u slashjp/plugins/Zoo/zoo.pl:1.7 slashjp/plugins/Zoo/zoo.pl:1.8
--- slashjp/plugins/Zoo/zoo.pl:1.7	Wed Jul 12 21:24:23 2006
+++ slashjp/plugins/Zoo/zoo.pl	Thu Jul 13 10:12:27 2006
@@ -2,7 +2,7 @@
 # This code is a part of Slash, and is released under the GPL.
 # Copyright 1997-2005 by Open Source Technology Group. See README
 # and COPYING for more information, or see http://slashcode.com/.
-# $Id: zoo.pl,v 1.7 2006/07/12 12:24:23 sugi Exp $
+# $Id: zoo.pl,v 1.8 2006/07/13 01:12:27 sugi Exp $
 
 use strict;
 use Slash 2.003;	# require Slash 2.3.x
@@ -14,7 +14,7 @@
 use Digest::SHA1;
 use vars qw($VERSION);
 
-($VERSION) = ' $Revision: 1.7 $ ' =~ /\$Revision:\s+([^\s]+)/;
+($VERSION) = ' $Revision: 1.8 $ ' =~ /\$Revision:\s+([^\s]+)/;
 
 sub main {
 	my $zoo		= getObject('Slash::Zoo');
@@ -33,6 +33,7 @@
 		action	=> [ $user_ok,	\&action  ],
 		check	=> [ 1,		\&check   ],
 		all	=> [ 1,		\&people  ],
+		foaf	=> [ 1,		\&foaf    ],
 	);
 
 	$ops{$_} = $ops{action} for qw(add delete);
@@ -110,7 +111,11 @@
 	my $editable = ($uid == $user->{uid} ? 1 : 0);
 	my $people = $zoo->getRelationships($uid, $zoo_vars->{constant});
 
-	if ($form->{content_type} && $form->{content_type} =~ $constants->{feed_types}) {
+	if ($form->{content_type} 
+	    && $form->{content_type} =~ $constants->{feed_types}
+	    && $form->{content_type} eq 'foaf' ) {
+		_foaf($people, $uid, $zoo_vars->{op});
+	} elsif ($form->{content_type} && $form->{content_type} =~ $constants->{feed_types}) {
 		_rss($people, $nick, $zoo_vars->{op});
 	} else {
 		my $implied;
@@ -375,8 +380,28 @@
 	});
 }
 
+sub foaf {
+	my ($zoo, $constants, $user, $form, $slashdb) = @_;
+
+	my ($uid, $nick);
+	if ($form->{uid} || $form->{nick}) {
+		 $uid = $form->{uid} ? $form->{uid} : $slashdb->getUserUID($form->{nick});
+		 $nick = $form->{nick} ? $form->{nick} : $slashdb->getUser($uid, 'nickname');
+	 } else {
+		 $uid = $user->{uid};
+		 $nick = $user->{nick};
+	 }
+
+	 my $known = $zoo->getRelationships($uid, FRIEND);
+	 my $foes = $zoo->getRelationships($uid, FOE);
+	 push( @$known,  @$foes );
+
+	 _foaf($known, $uid, "foaf" );
+
+ }
+
 sub _foaf {
-	my( $entries, $uid, $type) = @_;
+	my ($entries, $uid, $type) = @_;
 	my $constants	= getCurrentStatic();
 	my $form	= getCurrentForm();
 	my $reader	= getObject('Slash::DB', { db_type => 'reader' });


Slashdotjp-dev メーリングリストの案内
アーカイブの一覧に戻る