]> git.mxchange.org Git - friendica.git/blobdiff - include/notifier.php
rework autocomplete: some cleanup and docu
[friendica.git] / include / notifier.php
index 0f4e35e4fe621f10c9f9f264807b0e9afa8327e2..92e48c355404a0f4bc1fb97451ea097d47f3f8b8 100644 (file)
@@ -223,6 +223,8 @@ function notifier_run(&$argv, &$argc){
 
        if(! ($mail || $fsuggest || $relocate)) {
 
+               $slap = ostatus_salmon($target_item,$owner);
+
                require_once('include/group.php');
 
                $parent = $items[0];
@@ -267,12 +269,12 @@ function notifier_run(&$argv, &$argc){
 
                $relay_to_owner = false;
 
-               if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
+               if(!$top_level && ($parent['wall'] == 0) && !$expire && (stristr($target_item['uri'],$localhost))) {
                        $relay_to_owner = true;
                }
 
 
-               if(($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && (! $top_level)) {
+               if(($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && !$top_level) {
                        $relay_to_owner = true;
                }
 
@@ -308,7 +310,7 @@ function notifier_run(&$argv, &$argc){
                                if ($parent["network"] == NETWORK_OSTATUS) {
                                        // Distribute the message to the DFRN contacts as if this wasn't a followup since OStatus can't relay comments
                                        // Currently it is work at progress
-                                       $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND NOT `blocked` AND NOT `pending`",
+                                       $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND NOT `blocked` AND NOT `pending` AND NOT `archive`",
                                                intval($uid),
                                                dbesc(NETWORK_DFRN)
                                        );
@@ -407,16 +409,13 @@ function notifier_run(&$argv, &$argc){
                } else
                        $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."', '".NETWORK_MAIL2."')";
 
-               $r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0".$sql_extra);
+               $r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra);
 
                if(count($r))
                        $contacts = $r;
-       }
 
-       if (!$normal_mode)
+       } else
                $public_message = false;
-       else
-               $slap = ostatus_salmon($target_item,$owner);
 
        // If this is a public message and pubmail is set on the parent, include all your email contacts
 
@@ -445,7 +444,7 @@ function notifier_run(&$argv, &$argc){
        if ($relocate)
                $r = $recipients_relocate;
        else
-               $r = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND NOT `blocked` AND NOT `pending`",
+               $r = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND NOT `blocked` AND NOT `pending` AND NOT `archive`",
                        dbesc($recip_str)
                );
 
@@ -521,13 +520,13 @@ function notifier_run(&$argv, &$argc){
        // send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
        // They are especially used for notifications to OStatus users that don't follow us.
 
-       if($slap && count($url_recipients) && ($public_message || $push_notify) && (!$expire)) {
-               if(! get_config('system','dfrn_only')) {
+       if($slap && count($url_recipients) && ($public_message || $push_notify) && $normal_mode) {
+               if(!get_config('system','dfrn_only')) {
                        foreach($url_recipients as $url) {
                                if($url) {
                                        logger('notifier: urldelivery: ' . $url);
                                        $deliver_status = slapper($owner,$url,$slap);
-                                       // TODO: redeliver/queue these items on failure, though there is no contact record
+                                       /// @TODO Redeliver/queue these items on failure, though there is no contact record
                                }
                        }
                }
@@ -549,7 +548,7 @@ function notifier_run(&$argv, &$argc){
                );
 
                $r2 = q("SELECT `id`, `name`,`network` FROM `contact`
-                       WHERE `network` in ( '%s', '%s')  AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
+                       WHERE `network` in ( '%s', '%s')  AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive`
                        AND `rel` != %d order by rand() ",
                        dbesc(NETWORK_DFRN),
                        dbesc(NETWORK_MAIL2),
@@ -560,7 +559,7 @@ function notifier_run(&$argv, &$argc){
                $r = array_merge($r2,$r1,$r0);
 
                if(count($r)) {
-                       logger('pubdeliver: ' . print_r($r,true), LOGGER_DEBUG);
+                       logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
 
                        // throw everything into the queue in case we get killed
 
@@ -585,7 +584,7 @@ function notifier_run(&$argv, &$argc){
                                }
 
                                if((! $mail) && (! $fsuggest) && (! $followup)) {
-                                       logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']);
+                                       logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
                                        proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
                                        if($interval)
                                                @time_sleep_until(microtime(true) + (float) $interval);