return true;
}
+ /**
+ * @brief Fetch the uri from our database if we already have this item (maybe from ourselves)
+ *
+ * @param string $author Author handle
+ * @param string $guid Message guid
+ *
+ * @return string The constructed uri or the one from our database
+ */
+ private function get_uri_from_guid($author, $guid) {
+
+ $r = q("SELECT `uri` FROM `item` WHERE `guid` = '%s' LIMIT 1", dbesc($guid));
+ if ($r)
+ return $r[0]["uri"];
+ else
+ return $author.":".$guid;
+ }
+
/**
* @brief Processes an incoming comment
*
$datarray["owner-avatar"] = ((x($contact,"thumb")) ? $contact["thumb"] : $contact["photo"]);
$datarray["guid"] = $guid;
- $datarray["uri"] = $author.":".$guid;
+ $datarray["uri"] = self::get_uri_from_guid($author, $guid);
$datarray["type"] = "remote-comment";
$datarray["verb"] = ACTIVITY_POST;
$datarray["owner-avatar"] = ((x($contact,"thumb")) ? $contact["thumb"] : $contact["photo"]);
$datarray["guid"] = $guid;
- $datarray["uri"] = $author.":".$guid;
+ $datarray["uri"] = self::get_uri_from_guid($author, $guid);
$datarray["type"] = "activity";
$datarray["verb"] = $verb;
$datarray["owner-avatar"] = $datarray["author-avatar"];
$datarray["guid"] = $guid;
- $datarray["uri"] = $datarray["parent-uri"] = $author.":".$guid;
+ $datarray["uri"] = $datarray["parent-uri"] = self::get_uri_from_guid($author, $guid);
$datarray["verb"] = ACTIVITY_POST;
$datarray["gravity"] = GRAVITY_PARENT;
$datarray["owner-avatar"] = $datarray["author-avatar"];
$datarray["guid"] = $guid;
- $datarray["uri"] = $datarray["parent-uri"] = $author.":".$guid;
+ $datarray["uri"] = $datarray["parent-uri"] = self::get_uri_from_guid($author, $guid);
$datarray["verb"] = ACTIVITY_POST;
$datarray["gravity"] = GRAVITY_PARENT;