]> git.mxchange.org Git - friendica.git/blobdiff - include/delivery.php
allow comments on other folks wall-to-wall postings
[friendica.git] / include / delivery.php
index 1cee2d697bf371143f51dea2925a274865237f46..14226e4fba8a97b3473f12e91a68060ee60af307 100644 (file)
@@ -41,7 +41,7 @@ function delivery_run($argv, $argc){
 
        for($x = 3; $x < $argc; $x ++) {
 
-               $contact_id = intval($argv[x]);
+               $contact_id = intval($argv[$x]);
 
                // Some other process may have delivered this item already.
 
@@ -113,6 +113,7 @@ function delivery_run($argv, $argc){
                        $uid = $r[0]['uid'];
                        $updated = $r[0]['edited'];
 
+                       // POSSIBLE CLEANUP --> The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
                        if(! $parent_id)
                                continue;
 
@@ -279,7 +280,7 @@ function delivery_run($argv, $argc){
                                                continue;
 
                                        // private emails may be in included in public conversations. Filter them.
-                                       if(($public_message) && $item['private'])
+                                       if(($public_message) && $item['private'] == 1)
                                                continue;
 
                                        $item_contact = get_item_contact($item,$icontacts);
@@ -288,7 +289,7 @@ function delivery_run($argv, $argc){
 
                                        if($normal_mode) {
                                                if($item_id == $item['id'] || $item['id'] == $item['parent'])
-                                                       $atom .= atom_entry($item,'text',null,$owner,true);
+                                                       $atom .= atom_entry($item,'text',null,$owner,true,(($top_level) ? $contact['id'] : 0));
                                        }
                                        else
                                                $atom .= atom_entry($item,'text',null,$owner,true);
@@ -327,8 +328,9 @@ function delivery_run($argv, $argc){
                                                dbesc($nickname)
                                        );
 
-                                       if(count($x)) {
-                                               if($owner['page-flags'] == PAGE_COMMUNITY && ! $x[0]['writable']) {
+                                       if($x && count($x)) {
+                                               $write_flag = ((($x[0]['rel']) && ($x[0]['rel'] != CONTACT_IS_SHARING)) ? true : false);
+                                               if((($owner['page-flags'] == PAGE_COMMUNITY) || ($write_flag)) && (! $x[0]['writable'])) {
                                                        q("update contact set writable = 1 where id = %d limit 1",
                                                                intval($x[0]['id'])
                                                        );
@@ -382,7 +384,7 @@ function delivery_run($argv, $argc){
                                                        continue;
 
                                                // private emails may be in included in public conversations. Filter them.
-                                               if(($public_message) && $item['private'])
+                                               if(($public_message) && $item['private'] == 1)
                                                        continue;
        
                                                $item_contact = get_item_contact($item,$icontacts);
@@ -508,17 +510,17 @@ function delivery_run($argv, $argc){
                                        // unsupported
                                        break;
                                }
-                               elseif(($target_item['deleted']) && ($target_item['verb'] !== ACTIVITY_LIKE)) {
-                               logger('delivery: diaspora retract: ' . $loc);
-                                       // diaspora delete, 
+                               elseif(($target_item['deleted']) && ($target_item['uri'] === $target_item['parent-uri'])) {
+                                       // top-level retraction
+                                       logger('delivery: diaspora retract: ' . $loc);
+
                                        diaspora_send_retraction($target_item,$owner,$contact,$public_message);
                                        break;
                                }
-                               elseif($target_item['parent'] != $target_item['id']) {
-
-                               logger('delivery: diaspora relay: ' . $loc);
+                               elseif($target_item['uri'] !== $target_item['parent-uri']) {
+                                       // we are the relay - send comments, likes and relayable_retractions to our conversants
+                                       logger('delivery: diaspora relay: ' . $loc);
 
-                                       // we are the relay - send comments, likes and unlikes to our conversants
                                        diaspora_send_relay($target_item,$owner,$contact,$public_message);
                                        break;
                                }