return $guid_prefix.$host_hash;
}
+/**
+ * @brief Store the conversation data
+ *
+ * @param array $arr Item array with conversation data
+ * @return array Item array with removed conversation data
+ */
function store_conversation($arr) {
if (in_array($arr['network'], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
$conversation = array('item-uri' => $arr['uri'], 'received' => dbm::date());
$arr['origin'] = 1;
$arr['last-child'] = 1;
$arr['network'] = NETWORK_DFRN;
+ $arr['protocol'] = PROTOCOL_DFRN;
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
// In difference to the call to "uri_to_guid" several lines below we add the hash of our own host.
$datarray['last-child'] = 1;
$datarray['visible'] = 1;
+ $datarray['protocol'] = PROTOCOL_DFRN;
+
+ $r = dba::fetch_first("SELECT `conversation-uri`, `conversation-href` FROM `conversation` WHERE `item-uri` = ?", $datarray['parent-uri']);
+ if (dbm::is_result($r)) {
+ if ($r['conversation-uri'] != '') {
+ $datarray['conversation-uri'] = $r['conversation-uri'];
+ }
+ if ($r['conversation-href'] != '') {
+ $datarray['conversation-href'] = $r['conversation-href'];
+ }
+ }
+
if ($orig_post) {
$datarray['edit'] = true;
}
// Fill the cache field
put_item_in_cache($datarray);
+ $datarray = store_conversation($datarray);
+
if ($orig_post) {
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($datarray['title']),