rework bb2diaspora for eradicating the diaspora comment virus

This commit is contained in:
redmatrix 2016-04-19 21:43:12 -07:00
parent 1e8b3fe749
commit d07afb54e4

View File

@ -270,7 +270,14 @@ function bb2dmention_callback($match) {
function bb2diaspora_itemwallwall(&$item) {
// We will provide wallwall (embedded author on the Diaspora side) if
// 1. It is a wall-to-wall post
// 2. A comment arrived which has no Diaspora signature info
$wallwall = false;
$author_exists = true;
if(! array_key_exists('author',$item)) {
$author_exists = false;
logger('bb2diaspora_itemwallwall: no author');
@ -281,11 +288,22 @@ function bb2diaspora_itemwallwall(&$item) {
$item['author'] = $r[0];
}
if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author']))) {
logger('bb2diaspora_itemwallwall: author: ' . print_r($item['author'],true), LOGGER_DATA);
$has_meta = false;
if($item['diaspora_meta'] || get_iconfig($item,'diaspora','fields'))
$has_meta = true;
if($item['author_xchan'] != $item['owner_xchan']) {
if($item['mid'] == $item['parent_mid'])
$wallwall = true;
else {
if(! $has_meta) {
$wallwall = true;
}
}
}
if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
if(($wallwall) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
logger('bb2diaspora_itemwallwall: wall to wall post',LOGGER_DEBUG);
// post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author.
$item['body'] = "\n\n"
@ -303,6 +321,11 @@ function bb2diaspora_itemwallwall(&$item) {
function bb2diaspora_itembody($item, $force_update = false) {
if(! get_iconfig($item,'diaspora','fields')) {
force_update = true;
}
$matches = array();
if(($item['diaspora_meta']) && (! $force_update)) {