5 vjuserinfo - return current user info as json
9 http://your.server.org/cgi-bin/vjuserinfo/your-blog-top
13 Returns info about current user using following format
16 url:"somebody.livejournal.com",
17 displayname:"somebody@lj",
19 avatar: {src: "http://your.server.org/avatars/somebody@lj.gif",
20 width:100, height:100},
23 B<state> can be B<owner>, B<guest> or B<banned>.
25 If user is not logged in, returns following structure:
30 {name: "Live journal",icon:"/avatars/lj.gif",id: "lj"}
36 use VJournal::Session;
37 use VJournal::ProviderList;
42 my $session = VJournal::Session->new($cgi);
44 if (!defined $session) {
45 # User is not authenticated. Return list of providers;
46 $out->{state}="notlogged";
47 $sites=VJournal::ProviderList->new;
48 $out->{providers}=[ $sites->menu ] ;
51 if ($session->isowner()) {
52 $out->{state}="owner";
53 } elsif ($session->banned()) {
54 $out->{state}="banned";
56 $out->{state}="guest";
59 $out->{url}=$session->identity();
60 $out->{displayname}=$session->name();
61 %avatar=$session->avatar();
62 if(exists $avatar{-src}) {
63 $out->{avatar}={src=>$avatar{-src},-width=>$avatar{-width},
64 -height=>$avatar{-height}};
68 print $session->header(-content_type=>"text/json",-charset=>"utf-8");
69 print encode_json($out);