From 2b3ebb9c3e9286d1374eec5661bc8330d2b133af Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 13 Jul 2015 23:50:33 +0200 Subject: [PATCH] Follow/Unfollow now works from OStatus. --- include/items.php | 9 ++++++--- include/ostatus.php | 12 ++++++++---- mod/wall_upload.php | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/items.php b/include/items.php index 45d25e379f..cba1ae236c 100644 --- a/include/items.php +++ b/include/items.php @@ -4159,9 +4159,12 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) { $name = notags(trim($datarray['author-name'])); $photo = notags(trim($datarray['author-avatar'])); - $rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor'); - if($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) - $nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']; + if (is_object($item)) { + $rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor'); + 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(($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING) diff --git a/include/ostatus.php b/include/ostatus.php index 901ae95f7d..53887d535b 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -205,6 +205,12 @@ function ostatus_import($xml,$importer,&$contact, &$hub) { else $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); // Now get the item @@ -242,14 +248,12 @@ function ostatus_import($xml,$importer,&$contact, &$hub) { } if ($item["verb"] == ACTIVITY_FOLLOW) { - // ignore "Follow" messages - // new_follower($importer,$contact,$datarray,$item); + new_follower($importer, $contact, $item, $nickname); continue; } if ($item["verb"] == NAMESPACE_OSTATUS."/unfollow") { - // ignore "Unfollow" messages - // lose_follower($importer,$contact,$datarray,$item); + lose_follower($importer, $contact, $item, $dummy); continue; } diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 44cfa01567..9abc1dd9f7 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -119,6 +119,7 @@ function wall_upload_post(&$a, $desktopmode = true) { $maximagesize = get_config('system','maximagesize'); if(($maximagesize) && ($filesize > $maximagesize)) { + logger("Image exceeds size limit of ".$maximagesize); echo sprintf( t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL; @unlink($src); killme(); -- 2.39.5