]> git.mxchange.org Git - friendica.git/commitdiff
OStatus: identi.ca seemed to have changed the format of activity streams for their...
authorMichael Vogel <icarus@dabo.de>
Sun, 16 Jun 2013 11:28:04 +0000 (13:28 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 16 Jun 2013 11:28:04 +0000 (13:28 +0200)
API: It is now possible to fetch only posts from one thread.

include/api.php
include/ostatus_conversation.php

index 45cad9ca8c852b9af687046566d380b53874fda0..5b26328d01dd778a19247d718a838538c02a8e0c 100644 (file)
                if ($page<0) $page=0;
                $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
                $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
-               $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
                //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+               $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
+               $parent_id = (x($_REQUEST,'parent_id')?$_REQUEST['parent_id']:0);
 
                $start = $page*$count;
 
                        $sql_extra .= ' AND `item`.`id` <= '.intval($max_id);
                if ($exclude_replies > 0)
                        $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
+               if ($parent_id > 0)
+                       $sql_extra .= ' AND `item`.`parent` = '.intval($parent_id);
 
                $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
                        `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
                $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
                $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
                //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+               $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
+               $parent_id = (x($_REQUEST,'parent_id')?$_REQUEST['parent_id']:0);
 
                $start = $page*$count;
 
 
                if ($max_id > 0)
                        $sql_extra = 'AND `item`.`id` <= '.intval($max_id);
+               if ($exclude_replies > 0)
+                       $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
+               if ($parent_id > 0)
+                       $sql_extra .= ' AND `item`.`parent` = '.intval($parent_id);
 
                /*$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
                        `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
                $page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
                if ($page<0) $page=0;
                $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
-               $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
                //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
-               
+               $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
+               $parent_id = (x($_REQUEST,'parent_id')?$_REQUEST['parent_id']:0);
+
                $start = $page*$count;
 
                $sql_extra = '';
                if ($user_info['self']==1) $sql_extra .= " AND `item`.`wall` = 1 ";
-               if ($exclude_replies > 0)  $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
+
+               if ($exclude_replies > 0)
+                       $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
+               if ($parent_id > 0)
+                       $sql_extra .= ' AND `item`.`parent` = '.intval($parent_id);
 
                $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, 
                        `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
index c63acfadcdd4b0cb4cf07400e1efef08fdab8af0..480506a06d20bbbc4718badf7003118d249958b6 100644 (file)
@@ -100,6 +100,10 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
        $items = array_reverse($items);
 
        foreach ($items as $single_conv) {
+               // identi.ca just changed the format of the activity streams. This is a quick fix.
+               if (@is_string($single_conv->object->id))
+                       $single_conv->id = $single_conv->object->id;
+
                if (@!$single_conv->id AND $single_conv->provider->url AND $single_conv->statusnet_notice_info->local_id)
                        $single_conv->id = $single_conv->provider->url."notice/".$single_conv->statusnet_notice_info->local_id;