aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-19 21:43:12 -0700
committerredmatrix <git@macgirvin.com>2016-04-19 21:43:12 -0700
commitd07afb54e4a2820017402fa195727828c8769349 (patch)
treeb9520eda03579508c0c7ea03f92d52456bed75ba /include/bb2diaspora.php
parent1e8b3fe74917861309eb48674ce95f91ccaf9d1d (diff)
downloadvolse-hubzilla-d07afb54e4a2820017402fa195727828c8769349.tar.gz
volse-hubzilla-d07afb54e4a2820017402fa195727828c8769349.tar.bz2
volse-hubzilla-d07afb54e4a2820017402fa195727828c8769349.zip
rework bb2diaspora for eradicating the diaspora comment virus
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php29
1 files changed, 26 insertions, 3 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 1ed57bfd4..6f746513c 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -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)) {