Bugfix: Bookmarks doesn't federate well.

This commit is contained in:
Michael Vogel 2015-11-24 21:03:06 +01:00
parent 3b101c9d98
commit 034f573374
2 changed files with 18 additions and 8 deletions

View file

@ -1304,8 +1304,19 @@ function ostatus_entry($doc, $item, $owner, $toplevel = false) {
$title = sprintf("New comment by %s", $owner["nick"]); $title = sprintf("New comment by %s", $owner["nick"]);
} }
xml_add_element($doc, $entry, "activity:object-type", $item["object-type"]); // To use the object-type "bookmark" we have to implement these elements:
xml_add_element($doc, $entry, "id", $item["uri"]); //<id>tag:fresh.federati.net,2015-11-22:noticeId=324796:objectType=note</id> //
// <activity:object-type>http://activitystrea.ms/schema/1.0/bookmark</activity:object-type>
// <title>Historic Rocket Landing</title>
// <summary>Nur ein Testbeitrag.</summary>
// <link rel="related" href="https://www.youtube.com/watch?v=9pillaOxGCo"/>
// <link rel="preview" href="https://pirati.cc/file/thumb-4526-450x338-b48c8055f0c2fed0c3f67adc234c4b99484a90c42ed3cac73dc1081a4d0a7bc1.jpg.jpg" media:width="450" media:height="338"/>
//
// 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
xml_add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE);
xml_add_element($doc, $entry, "id", $item["uri"]);
xml_add_element($doc, $entry, "title", $title); xml_add_element($doc, $entry, "title", $title);
if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid'])

View file

@ -18,13 +18,12 @@ function handle_pubsubhubbub() {
$hmac_sig = hash_hmac("sha1", $params, $rr['secret']); $hmac_sig = hash_hmac("sha1", $params, $rr['secret']);
$headers = array("Content-type: application/atom+xml", $headers = array("Content-type: application/atom+xml",
sprintf("Link: <%s>;rel=hub," . sprintf("Link: <%s>;rel=hub,<%s>;rel=self",
"<%s>;rel=self", $a->get_baseurl().'/pubsubhubbub',
$a->get_baseurl() . '/pubsubhubbub', $rr['topic']),
$rr['topic']), "X-Hub-Signature: sha1=".$hmac_sig);
"X-Hub-Signature: sha1=" . $hmac_sig);
logger('POST '. print_r($headers, true)."\n".$params, LOGGER_DEBUG); logger('POST '.print_r($headers, true)."\n".$params, LOGGER_DEBUG);
post_url($rr['callback_url'], $params, $headers); post_url($rr['callback_url'], $params, $headers);
$ret = $a->get_curl_code(); $ret = $a->get_curl_code();