From 8a57b845ae936230c83a6f3afb0ee3d23ee4dcda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Apr 2016 17:03:14 -0700 Subject: second phase of diaspora comment virus eradication begins --- Zotlabs/Module/Item.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 58660a839..02e3c48b4 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -748,10 +748,7 @@ class Item extends \Zotlabs\Web\Controller { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; } - - - - + $datarray['aid'] = $channel['channel_account_id']; $datarray['uid'] = $profile_uid; @@ -971,6 +968,20 @@ class Item extends \Zotlabs\Web\Controller { intval($parent_item['id']) ); } + + // send a sync packet to any channel clones + + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($post_id) + ); + build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } } else { logger('mod_item: unable to retrieve post that was just stored.'); @@ -988,19 +999,6 @@ class Item extends \Zotlabs\Web\Controller { $ditem['author'] = $observer; store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id, (($walltowall_comment) ? 1 : 0)); } - else { - $r = q("select * from item where id = %d", - intval($post_id) - ); - if($r) { - xchan_query($r); - $sync_item = fetch_post_tags($r); - $rid = q("select * from item_id where iid = %d", - intval($post_id) - ); - build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); - } - } $datarray['id'] = $post_id; $datarray['llink'] = z_root() . '/display/' . $channel['channel_address'] . '/' . $post_id; -- cgit v1.2.3 From 1e8b3fe74917861309eb48674ce95f91ccaf9d1d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Apr 2016 20:02:55 -0700 Subject: Revert the last edit on this file. Need to work this through a bit more before changing this bit. --- Zotlabs/Module/Item.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 02e3c48b4..58660a839 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -748,7 +748,10 @@ class Item extends \Zotlabs\Web\Controller { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; } - + + + + $datarray['aid'] = $channel['channel_account_id']; $datarray['uid'] = $profile_uid; @@ -968,20 +971,6 @@ class Item extends \Zotlabs\Web\Controller { intval($parent_item['id']) ); } - - // send a sync packet to any channel clones - - $r = q("select * from item where id = %d", - intval($post_id) - ); - if($r) { - xchan_query($r); - $sync_item = fetch_post_tags($r); - $rid = q("select * from item_id where iid = %d", - intval($post_id) - ); - build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); - } } else { logger('mod_item: unable to retrieve post that was just stored.'); @@ -999,6 +988,19 @@ class Item extends \Zotlabs\Web\Controller { $ditem['author'] = $observer; store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id, (($walltowall_comment) ? 1 : 0)); } + else { + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($post_id) + ); + build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } + } $datarray['id'] = $post_id; $datarray['llink'] = z_root() . '/display/' . $channel['channel_address'] . '/' . $post_id; -- cgit v1.2.3 From d07afb54e4a2820017402fa195727828c8769349 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Apr 2016 21:43:12 -0700 Subject: rework bb2diaspora for eradicating the diaspora comment virus --- include/bb2diaspora.php | 29 ++++++++++++++++++++++++++--- 1 file 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)) { -- cgit v1.2.3 From 21b0128e9ea53365b5e77955fb0e177b2b513c64 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Apr 2016 23:06:43 -0700 Subject: testing dmeta --- include/bb2diaspora.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 6f746513c..98e421670 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -268,7 +268,7 @@ function bb2dmention_callback($match) { } -function bb2diaspora_itemwallwall(&$item) { +function bb2diaspora_itemwallwall(&$item, $newpost = false) { // We will provide wallwall (embedded author on the Diaspora side) if // 1. It is a wall-to-wall post @@ -289,10 +289,9 @@ function bb2diaspora_itemwallwall(&$item) { } $has_meta = false; - if($item['diaspora_meta'] || get_iconfig($item,'diaspora','fields')) + if((! $newpost) && ($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; @@ -319,11 +318,11 @@ function bb2diaspora_itemwallwall(&$item) { } -function bb2diaspora_itembody($item, $force_update = false) { +function bb2diaspora_itembody($item, $force_update = false, $newpost = false) { if(! get_iconfig($item,'diaspora','fields')) { - force_update = true; + $force_update = true; } $matches = array(); @@ -363,7 +362,7 @@ function bb2diaspora_itembody($item, $force_update = false) { } - bb2diaspora_itemwallwall($newitem); + bb2diaspora_itemwallwall($newitem, $newpost); $title = $newitem['title']; $body = preg_replace('/\#\^http/i', 'http', $newitem['body']); -- cgit v1.2.3 From 2641980ac2876bfe66bb24795dbea4d25483616d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 20 Apr 2016 01:40:09 -0700 Subject: bb2d updates from testing signature changes --- include/bb2diaspora.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 98e421670..add580636 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -268,7 +268,7 @@ function bb2dmention_callback($match) { } -function bb2diaspora_itemwallwall(&$item, $newpost = false) { +function bb2diaspora_itemwallwall(&$item) { // We will provide wallwall (embedded author on the Diaspora side) if // 1. It is a wall-to-wall post @@ -289,7 +289,7 @@ function bb2diaspora_itemwallwall(&$item, $newpost = false) { } $has_meta = false; - if((! $newpost) && ($item['diaspora_meta'] || get_iconfig($item,'diaspora','fields'))) + if($item['diaspora_meta'] || get_iconfig($item,'diaspora','fields')) $has_meta = true; if($item['author_xchan'] != $item['owner_xchan']) { @@ -318,7 +318,7 @@ function bb2diaspora_itemwallwall(&$item, $newpost = false) { } -function bb2diaspora_itembody($item, $force_update = false, $newpost = false) { +function bb2diaspora_itembody($item, $force_update = false, $have_channel = false) { if(! get_iconfig($item,'diaspora','fields')) { @@ -361,8 +361,8 @@ function bb2diaspora_itembody($item, $force_update = false, $newpost = false) { } } - - bb2diaspora_itemwallwall($newitem, $newpost); + if(! $have_channel) + bb2diaspora_itemwallwall($newitem, $newpost); $title = $newitem['title']; $body = preg_replace('/\#\^http/i', 'http', $newitem['body']); -- cgit v1.2.3 From 0d91f363ccda100ccf6b35f7fb46a4352d00326a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 20 Apr 2016 19:03:56 -0700 Subject: There is no longer a followup flag in the notifier. Remove all traces of it. --- include/notifier.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index 628847d54..4435c7497 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -450,7 +450,6 @@ function notifier_run($argv, $argc){ 'target_item' => $target_item, 'top_level_post' => $top_level_post, 'private' => $private, - 'followup' => $followup, 'relay_to_owner' => $relay_to_owner, 'uplink' => $uplink, 'cmd' => $cmd, @@ -547,7 +546,6 @@ function notifier_run($argv, $argc){ 'hub' => $hub, 'top_level_post' => $top_level_post, 'private' => $private, - 'followup' => $followup, 'relay_to_owner' => $relay_to_owner, 'uplink' => $uplink, 'cmd' => $cmd, -- cgit v1.2.3