Follow/Unfollow now works from OStatus.

This commit is contained in:
Michael Vogel 2015-07-13 23:50:33 +02:00
parent 3457f85833
commit 2b3ebb9c3e
3 changed files with 15 additions and 7 deletions

View file

@ -4159,9 +4159,12 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
$name = notags(trim($datarray['author-name'])); $name = notags(trim($datarray['author-name']));
$photo = notags(trim($datarray['author-avatar'])); $photo = notags(trim($datarray['author-avatar']));
$rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor'); if (is_object($item)) {
if($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) $rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor');
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']; if($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'])
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'];
} else
$nick = $item;
if(is_array($contact)) { if(is_array($contact)) {
if(($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING) if(($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)

View file

@ -205,6 +205,12 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
else else
$author = ostatus_fetchauthor($xpath, $entry, $importer, $contact, false); $author = ostatus_fetchauthor($xpath, $entry, $importer, $contact, false);
$value = $xpath->evaluate('atom:author/poco:preferredUsername/text()', $context)->item(0)->nodeValue;
if ($value != "")
$nickname = $value;
else
$nickname = $author["author-name"];
$item = array_merge($header, $author); $item = array_merge($header, $author);
// Now get the item // Now get the item
@ -242,14 +248,12 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
} }
if ($item["verb"] == ACTIVITY_FOLLOW) { if ($item["verb"] == ACTIVITY_FOLLOW) {
// ignore "Follow" messages new_follower($importer, $contact, $item, $nickname);
// new_follower($importer,$contact,$datarray,$item);
continue; continue;
} }
if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") { if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") {
// ignore "Unfollow" messages lose_follower($importer, $contact, $item, $dummy);
// lose_follower($importer,$contact,$datarray,$item);
continue; continue;
} }

View file

@ -119,6 +119,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
$maximagesize = get_config('system','maximagesize'); $maximagesize = get_config('system','maximagesize');
if(($maximagesize) && ($filesize > $maximagesize)) { if(($maximagesize) && ($filesize > $maximagesize)) {
logger("Image exceeds size limit of ".$maximagesize);
echo sprintf( t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL; echo sprintf( t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL;
@unlink($src); @unlink($src);
killme(); killme();