function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) {
if ($contact['network'] === NETWORK_OSTATUS) {
if ($pass < 2) {
+ // Test - remove before flight
+ //$tempfile = tempnam(get_temppath(), "ostatus");
+ //file_put_contents($tempfile, $xml);
+
logger("Consume OStatus messages ", LOGGER_DEBUG);
ostatus_import($xml,$importer,$contact, $hub);
}
return;
}
- // Test - remove before flight
-// if ($contact['network'] === NETWORK_OSTATUS) {
-// $tempfile = tempnam(get_temppath(), "ostatus");
-// file_put_contents($tempfile, $xml);
-// }
-
$feed = new SimplePie();
$feed->set_raw_data($xml);
if($datedir)
$o .= "<$tag>\r\n";
- $o .= "<name>$name</name>\r\n";
- $o .= "<uri>$uri</uri>\r\n";
- $o .= '<link rel="photo" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
- $o .= '<link rel="avatar" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
+ $o .= "\t<name>$name</name>\r\n";
+ $o .= "\t<uri>$uri</uri>\r\n";
+ $o .= "\t".'<link rel="photo" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
+ $o .= "\t".'<link rel="avatar" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
+
+ if ($tag == "author") {
+ $r = q("SELECT `profile`.`locality`, `profile`.`region`, `profile`.`country-name`,
+ `profile`.`name`, `profile`.`pub_keywords`, `profile`.`about`,
+ `profile`.`homepage`,`contact`.`nick` FROM `profile`
+ INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid`
+ INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
+ WHERE `profile`.`is-default` AND `contact`.`self` AND
+ NOT `user`.`hidewall` AND `contact`.`nurl`='%s'",
+ dbesc(normalise_link($uri)));
+ if ($r) {
+ $location = '';
+ if($r[0]['locality'])
+ $location .= $r[0]['locality'];
+ if($r[0]['region']) {
+ if($location)
+ $location .= ', ';
+ $location .= $r[0]['region'];
+ }
+ if($r[0]['country-name']) {
+ if($location)
+ $location .= ', ';
+ $location .= $r[0]['country-name'];
+ }
+
+ $o .= "\t<poco:preferredUsername>".xmlify($r[0]["nick"])."</poco:preferredUsername>\r\n";
+ $o .= "\t<poco:displayName>".xmlify($r[0]["name"])."</poco:displayName>\r\n";
+ $o .= "\t<poco:note>".xmlify($r[0]["about"])."</poco:note>\r\n";
+ $o .= "\t<poco:address>\r\n";
+ $o .= "\t\t<poco:formatted>".xmlify($location)."</poco:formatted>\r\n";
+ $o .= "\t</poco:address>\r\n";
+ $o .= "\t<poco:urls>\r\n";
+ $o .= "\t<poco:type>homepage</poco:type>\r\n";
+ $o .= "\t\t<poco:value>".xmlify($r[0]["homepage"])."</poco:value>\r\n";
+ $o .= "\t\t<poco:primary>true</poco:primary>\r\n";
+ $o .= "\t</poco:urls>\r\n";
+ }
+ }
call_hooks('atom_author', $o);
$o .= '<link rel="alternate" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
+ $o .= '<status_net notice_id="'.$item['id'].'"></status_net>'."\r\n";
+
if($comment)
$o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n";
$o .= '<category scheme="X-DFRN:' . xmlify($t[0]) . ':' . xmlify($t[1]) . '" term="' . xmlify($t[2]) . '" />' . "\r\n";
}
+ // To-Do:
+ // To support these elements, the API needs to be enhanced
//$o .= '<link rel="ostatus:conversation" href="'.xmlify($a->get_baseurl().'/display/'.$owner['nickname'].'/'.$item['parent']).'"/>'."\r\n";
- //$o .= '<link rel="self" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
- //$o .= '<link rel="edit" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
+ //$o .= "\t".'<link rel="self" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
+ //$o .= "\t".'<link rel="edit" type="application/atom+xml" href="'.xmlify($a->get_baseurl().'/api/statuses/show/'.$item['id'].'.atom').'"/>'."\r\n";
$o .= item_get_attachment($item);