]> git.mxchange.org Git - friendica.git/commitdiff
Support for real repeated messages
authorMichael Vogel <icarus@dabo.de>
Thu, 10 Dec 2015 17:16:16 +0000 (18:16 +0100)
committerMichael Vogel <icarus@dabo.de>
Thu, 10 Dec 2015 17:16:16 +0000 (18:16 +0100)
include/ostatus.php

index 73b10bd1d90d04c484691c1e5b057a2fe98495d7..d915b56cb1b2dc03cc71862202f70d4a26d07489 100644 (file)
@@ -1354,9 +1354,9 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false, $repeat = false)
        if (!$toplevel AND !$repeat) {
                $entry = $doc->createElement("entry");
                $title = sprintf("New note by %s", $owner["nick"]);
-       //} elseif (!$toplevel AND $repeat) {
-       //      $entry = $doc->createElement("activity:object");
-       //      $title = sprintf("New note by %s", $owner["nick"]);
+       } elseif (!$toplevel AND $repeat) {
+               $entry = $doc->createElement("activity:object");
+               $title = sprintf("New note by %s", $owner["nick"]);
        } else {
                $entry = $doc->createElementNS(NS_ATOM, "entry");
 
@@ -1392,10 +1392,10 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false, $repeat = false)
        // But: it seems as if it doesn't federate well between the GS servers
        // So we just set it to "note" to be sure that it reaches their target systems
 
-       //if (!$repeat)
+       if (!$repeat)
                xml_add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE);
-       //else
-       //      xml_add_element($doc, $entry, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA.'activity');
+       else
+               xml_add_element($doc, $entry, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA.'activity');
 
        xml_add_element($doc, $entry, "id", $item["uri"]);
        xml_add_element($doc, $entry, "title", $title);
@@ -1421,20 +1421,30 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false, $repeat = false)
        xml_add_element($doc, $entry, "status_net", "", array("notice_id" => $item["id"]));
 
        //$repeated_item = $item;
-       //$is_repeat = false;
+       $is_repeat = false;
 
-       //if (!$repeat)
-       //      $is_repeat = api_share_as_retweet($repeated_item);
+/*     if (!$repeat) {
+               $repeated_guid = get_reshared_guid($item);
 
-       //if (!$is_repeat)
+               if ($repeated_guid != "") {
+                       $r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1",
+                               intval($owner["uid"]), dbesc($repeated_guid));
+                       if ($r) {
+                               $repeated_item = $r[0];
+                               $is_repeat = true;
+                       }
+               }
+       }
+*/
+       if (!$is_repeat)
                xml_add_element($doc, $entry, "activity:verb", construct_verb($item));
-       //else
-       //      xml_add_element($doc, $entry, "activity:verb", ACTIVITY_SHARE);
+       else
+               xml_add_element($doc, $entry, "activity:verb", ACTIVITY_SHARE);
 
        xml_add_element($doc, $entry, "published", datetime_convert("UTC","UTC",$item["created"]."+00:00",ATOM_TIME));
        xml_add_element($doc, $entry, "updated", datetime_convert("UTC","UTC",$item["edited"]."+00:00",ATOM_TIME));
 
-       /*if ($is_repeat) {
+       if ($is_repeat) {
                $repeated_owner = array();
                $repeated_owner["name"] = $repeated_item["author-name"];
                $repeated_owner["url"] = $repeated_item["author-link"];
@@ -1461,7 +1471,7 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false, $repeat = false)
                $profile["about"] = $owner["about"];
                $author = ostatus_add_author($doc, $owner, $profile);
                $entry->appendChild($author);
-       }*/
+       }
 
        $mentioned = array();
 
@@ -1545,8 +1555,8 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false, $repeat = false)
 
 
        $attributes = array("local_id" => $item["id"], "source" => $app);
-       //if ($is_repeat)
-       //      $attributes["repeat_of"] = $item["id"];
+       if ($is_repeat)
+               $attributes["repeat_of"] = $repeated_item["id"];
 
        xml_add_element($doc, $entry, "statusnet:notice_info", "", $attributes);