Both requests below do NOT return the latest status of the user if the
status is set from the Orkut WEB interface. They only returns the
latest status that is sent to orkut via the orkut API sent by remote
application!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$request = $this->__Library->people->get(array('userId' => '@me',
'groupId' => '@self', 'fields' => array('status')));

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        $params = array(
            'userId'  => '@me',
            'groupId' => '@self',
            'count'   => 20
        );
$request = $this->__Library->activities->get($params);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Code to get status – request sent to Orkut


        $statusArray = $this->get_last_status();
        $statusArrayTime = $statusArray['timestamp'];
        Log::trace('@@@@@@@@@@ result from get_last_status: ' .
print_r($statusArray, true));
        $restmp = $this->get_status();
        Log::trace('@@@@@@@@@@ result from get_status: ' .
print_r($restmp, true));


    /**
     * Returns user's status.
     *
     * @access     public
     * @return     string
     */
    public function get_status()
    {
        $batch = $this->__Library->newBatch();
        $request = $this->__Library->people->get(array('userId' =>
'@me', 'groupId' => '@self', 'fields' => array('status')));
        $batch->add($request, 'people');
        try
        {
            $this->__om_request_start();

            $result = $batch->execute();
            $result = self::__check($result['people']);

            $this->__om_request_end();
        }
        catch ( Exception $e )
        {
            $this->__om_request_end($this->parse_exception($e));
        }

        return isset($result->status) ? $result->status : '';
    }

    /**
     * Returns user's last status activity. Can provide status body to
return that status.
     *
     * @access     public
     * @return     array
     */
    public function get_last_status()
    {
        $batch = $this->__Library->newBatch();

        // prepare params
        // include filter to return last 20 activities and see if they
contain status
        $params = array(
            'userId'  => '@me',
            'groupId' => '@self',
            'count'   => 20
        );

        $request = $this->__Library->activities->get($params);
        $batch->add($request, 'activities');
        try
        {
            $this->__om_request_start();

            $result = $batch->execute();
            $result = self::__check($result['activities']);

            $this->__om_request_end();

            $body = '';
            $timestamp = 0;
            if ( $result->totalResults )
            {
                $found = null;
                foreach ( $result->list as $item )
                {
                    if ( isset($item->templateParams) && isset($item-
>templateParams['activityType']) && 'STATUS_MSG' === $item-
>templateParams['activityType'])
                    {
                        $found = $item;
                        break;
                    }
                }
                if ( $found )
                {
                    $body = $found->body;
                    $timestamp = $found->postedTime;
                }
            }

            return array(
                'status'    => $body,
                'timestamp' => $timestamp,
            );
        }
        catch ( Exception $e )
        {
            Log::trace ('error when sending request to orkut: ' .
print_r ($e, true));
            $this->__om_request_end($this->parse_exception($e));
        }
    }


Data obtained from calling Orkut API:


Never the latest status ‘Orkut status Dec 03 #1’ set from the Orkut
WEB site is returned in the result!!!! Only the status ‘LS status Dec
03 Idealife #1’, ‘LS status Dec 03 Idealife #2’ sent to Orkut by a
remote app are returned!!!!



lmti30shyfjs4mrqmo2zj2q1zgn24k7w - 17:27:09 [TRACE] - 192.75.88.231 -
[Plugin_Orkut_Connection->get_basic_user_info: 313] - @@@@@@@@@@
result from get_last_status: Array
(
    [status] => LS status Dec 03 Idealife #2
    [timestamp] => 1291391489
)

 [Plugin_Orkut_Connection->get_basic_user_info: 315] - @@@@@@@@@@
result from get_status: LS status Dec 03 Idealife #2
 [Plugin_Orkut_Connection->get_basic_user_info: 316] -
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


////////////////////////////////////////////////

wel8dfaqopqp81m48f2p1b4czh3jep55 - 15:55:13 [TRACE] - 174.142.116.12 -
[Plugin_Orkut_Connection->get_stream: 695] - result of batch req
people|activities->get from orkut: Array
(
    [self] => osapiPerson Object
        (
            [displayName] => Cheng-Jun LI
            [id] => 04750500299161576361
            [name] => Array
                (
                    [familyName] => LI
                    [givenName] => Cheng-Jun
                )

            [profileUrl] => /Profile.aspx?
uid=4358740843465410040&mt=os
            [thumbnailUrl] => 
http://img3.orkut.com/images/small/1278787675/545632857/ln.jpg
            [isOwner] =>
            [isViewer] => 1
        )

    [friends] => osapiCollection Object
        (
            [list] => Array
                (
                    [0] => osapiPerson Object
                        (
                            [displayName] => t tester
                            [id] => 08162007637829796723
                            [name] => Array
                                (
                                    [familyName] => tester
                                    [givenName] => t
                                )

                            [profileUrl] => /Profile.aspx?
uid=17264954266639475911&mt=os
                            [thumbnailUrl] =>
http://img1.orkut.com/images/small/1266920678/576901875/ln.jpg
                            [isOwner] =>
                            [isViewer] =>
                        )

                    [1] => osapiPerson Object
                        (
                            [displayName] => bobt tester
                            [id] => 12532530288492145785
                            [name] => Array
                                (
                                    [familyName] => tester
                                    [givenName] => bobt
                                )

                            [profileUrl] => /Profile.aspx?
uid=13871750830763802933&mt=os
                            [thumbnailUrl] => 
http://static1.orkut.com/img/i_nophoto64.gif
                            [isOwner] =>
                            [isViewer] =>
                        )

                    [2] => osapiPerson Object
                        (
                            [displayName] => Amir Hashemi
                            [id] => 12388813524914066638
                            [name] => Array
                                (
                                    [familyName] => Hashemi
                                    [givenName] => Amir
                                )

                            [profileUrl] => /Profile.aspx?
uid=3642547492907212753&mt=os
                            [thumbnailUrl] => 
http://static1.orkut.com/img/i_nophoto64.gif
                            [isOwner] =>
                            [isViewer] =>
                        )

                    [3] => osapiPerson Object
                        (
                            [displayName] => T B
                            [id] => 12794047980219934417
                            [name] => Array
                                (
                                    [familyName] => B
                                    [givenName] => T
                                )

                            [profileUrl] => /Profile.aspx?
uid=18409190764276686079&mt=os
                            [thumbnailUrl] =>
http://img4.orkut.com/images/small/1278593816/608164024/ln.jpg
                            [isOwner] =>
                            [isViewer] =>
                        )

                )

            [startIndex] => 0
            [totalResults] => 4
            [itemsPerPage] =>
            [filtered] =>
            [sorted] =>
            [updatedSince] =>
        )

    [allActivities] => osapiCollection Object
        (
            [list] => Array
                (
                    [0] => osapiActivity Object
                        (
                            [body] => LS status Dec 03 Idealife #2
                            [id] => -60942815
                            [mediaItems] => Array
                                (
                                )

                            [postedTime] => 1291391489
                            [templateParams] => Array
                                (
                                    [activityType] => STATUS_MSG
                                )

                            [userId] => 04750500299161576361
                        )

                    [1] => osapiActivity Object
                        (
                            [body] => LS status Dec 03 Idealife #1
                            [id] => -61123483
                            [mediaItems] => Array
                                (
                                )

                            [postedTime] => 1291391427
                            [templateParams] => Array
                                (
                                    [activityType] => STATUS_MSG
                                )

                            [userId] => 04750500299161576361
                        )

                )

            [startIndex] => 0
            [totalResults] => 2
            [itemsPerPage] =>
            [filtered] =>
            [sorted] =>
            [updatedSince] =>
        )

)

wel8dfaqopqp81m48f2p1b4czh3jep55 - 15:55:13 [TRACE] - 174.142.116.12 -
[Plugin_Orkut_Connection->get_stream: 838] - no need to send
additional request to get album & mediaItem from orkut
wel8dfaqopqp81m48f2p1b4czh3jep55 - 15:55:13 [TRACE] - 174.142.116.12 -
[Plugin_Orkut_Connection->get_stream: 845] - @@@SMP style orkut stream
result = Array
(
    [posts] => Array
        (
            [post-60942815] => Array
                (
                    [post_id] => -60942815
                    [created_time] => 1291391489
                    [userId] => 04750500299161576361
                    [activityType] => STATUS_MSG
                    [message] => LS status Dec 03 Idealife #2
                )

            [post-61123483] => Array
                (
                    [post_id] => -61123483
                    [created_time] => 1291391427
                    [userId] => 04750500299161576361
                    [activityType] => STATUS_MSG
                    [message] => LS status Dec 03 Idealife #1
                )

        )

    [profiles] => Array
        (
            [profile04750500299161576361] => Array
                (
                    [displayName] => Cheng-Jun LI
                    [profileUrl] => 
http://www.orkut.com/Profile.aspx?uid=4358740843465410040&mt=os
                    [thumbnailUrl] => 
http://img3.orkut.com/images/small/1278787675/545632857/ln.jpg
                )

            [profile08162007637829796723] => Array
                (
                    [displayName] => t tester
                    [profileUrl] => 
http://www.orkut.com/Profile.aspx?uid=17264954266639475911&mt=os
                    [thumbnailUrl] => 
http://img1.orkut.com/images/small/1266920678/576901875/ln.jpg
                )

            [profile12532530288492145785] => Array
                (
                    [displayName] => bobt tester
                    [profileUrl] => 
http://www.orkut.com/Profile.aspx?uid=13871750830763802933&mt=os
                    [thumbnailUrl] => 
http://static1.orkut.com/img/i_nophoto64.gif
                )

            [profile12388813524914066638] => Array
                (
                    [displayName] => Amir Hashemi
                    [profileUrl] => 
http://www.orkut.com/Profile.aspx?uid=3642547492907212753&mt=os
                    [thumbnailUrl] => 
http://static1.orkut.com/img/i_nophoto64.gif
                )

            [profile12794047980219934417] => Array
                (
                    [displayName] => T B
                    [profileUrl] => 
http://www.orkut.com/Profile.aspx?uid=18409190764276686079&mt=os
                    [thumbnailUrl] => 
http://img4.orkut.com/images/small/1278593816/608164024/ln.jpg
                )

        )

    [albums] => Array
        (
        )

)


team3:/var/log/smp/sns/2010/12 #

-- 
You received this message because you are subscribed to the Google Groups 
"orkut Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en.

Reply via email to