Merge pull request #1764 from annando/1507-ostatus-verb

OStatus: Incoming favorites
pull/1765/head^2
Tobias Diekershoff 2015-07-15 19:06:19 +02:00
commit 207b6f36bb
2 zmienionych plików z 18 dodań i 1 usunięć

Wyświetl plik

@ -274,6 +274,7 @@ define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' );
define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' );
define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
define ( 'ACTIVITY_SHARE', NAMESPACE_ACTIVITY_SCHEMA . 'share' );
define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' );
define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' );

Wyświetl plik

@ -239,11 +239,13 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
// Delete a message
if ($item["verb"] == "qvitter-delete-notice") {
// ignore "Delete" messages (by now)
logger("Ignore delete message ".print_r($item, true));
continue;
}
if ($item["verb"] == ACTIVITY_JOIN) {
// ignore "Join" messages
logger("Ignore join message ".print_r($item, true));
continue;
}
@ -258,10 +260,24 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
}
if ($item["verb"] == ACTIVITY_FAVORITE) {
// ignore "Favorite" messages
$orig_uri = $xpath->query("activity:object/atom:id", $entry)->item(0)->nodeValue;
logger("Favorite ".$orig_uri." ".print_r($item, true));
$item["verb"] = ACTIVITY_LIKE;
$item["parent-uri"] = $orig_uri;
$item["gravity"] = GRAVITY_LIKE;
}
if ($item["verb"] == NAMESPACE_OSTATUS."/unfavorite") {
// Ignore "Unfavorite" message
logger("Ignore unfavorite message ".print_r($item, true));
continue;
}
// http://activitystrea.ms/schema/1.0/rsvp-yes
if (!in_array($item["verb"], array(ACTIVITY_POST, ACTIVITY_LIKE, ACTIVITY_SHARE)))
logger("Unhandled verb ".$item["verb"]." ".print_r($item, true));
$item["created"] = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
$item["edited"] = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue;
$conversation = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue;