*/
public static function import($xml, array $importer, array &$contact, &$hub)
{
- self::process($xml, $importer, $contact, $hub);
+ self::process($xml, $importer, $contact, $hub, false, true, Conversation::PUSH);
}
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true)
+ private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true, $direction = Conversation::UNKNOWN)
{
if ($initialize) {
self::$itemlist = [];
$header["protocol"] = Conversation::PARCEL_SALMON;
$header["source"] = $xml2;
+ $header["direction"] = $direction;
} elseif (!$initialize) {
return false;
}
$conv_data = [];
$conv_data['protocol'] = Conversation::PARCEL_SPLIT_CONVERSATION;
+ $conv_data['direction'] = Conversation::PULL;
$conv_data['network'] = Protocol::OSTATUS;
$conv_data['uri'] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
$conv_data['source'] = $doc2->saveXML();
- $condition = ['item-uri' => $conv_data['uri'],'protocol' => Conversation::PARCEL_FEED];
- if (DBA::exists('conversation', $condition)) {
- Logger::log('Delete deprecated entry for URI '.$conv_data['uri'], Logger::DEBUG);
- DBA::delete('conversation', ['item-uri' => $conv_data['uri']]);
- }
-
Logger::log('Store conversation data for uri '.$conv_data['uri'], Logger::DEBUG);
Conversation::insert($conv_data);
}
$item["protocol"] = Conversation::PARCEL_SALMON;
$item["source"] = $xml;
+ $item["direction"] = Conversation::PULL;
Logger::log('Conversation '.$item['uri'].' is now fetched.', Logger::DEBUG);
}
if (DBA::isResult($conversation)) {
$stored = true;
$xml = $conversation['source'];
- if (self::process($xml, $importer, $contact, $hub, $stored, false)) {
+ if (self::process($xml, $importer, $contact, $hub, $stored, false, Conversation::PULL)) {
Logger::log('Got valid cached XML for URI '.$related_uri, Logger::DEBUG);
return;
}
}
if ($xml != '') {
- self::process($xml, $importer, $contact, $hub, $stored, false);
+ self::process($xml, $importer, $contact, $hub, $stored, false, Conversation::PULL);
} else {
Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, Logger::DEBUG);
}