]> git.mxchange.org Git - friendica.git/blobdiff - include/delivery.php
don't make -desc so obnoxious looking
[friendica.git] / include / delivery.php
old mode 100755 (executable)
new mode 100644 (file)
index 44a482c..5f84a54
@@ -51,6 +51,17 @@ function delivery_run($argv, $argc){
                return;
        }       
 
+       $maxsysload = intval(get_config('system','maxloadavg'));
+       if($maxsysload < 1)
+               $maxsysload = 50;
+       if(function_exists('sys_getloadavg')) {
+               $load = sys_getloadavg();
+               if(intval($load[0]) > $maxsysload) {
+                       logger('system: load ' . $load . ' too high. Delivery deferred to next queue run.');
+                       return;
+               }
+       }
+
        // It's ours to deliver. Remove it from the queue.
 
        q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",
@@ -256,7 +267,8 @@ function delivery_run($argv, $argc){
                                        '$picdate'      => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
                                        '$uridate'      => xmlify(datetime_convert('UTC','UTC',$owner['uri-date']    . '+00:00' , ATOM_TIME)) ,
                                        '$namdate'      => xmlify(datetime_convert('UTC','UTC',$owner['name-date']   . '+00:00' , ATOM_TIME)) ,
-                                       '$birthday'     => $birthday
+                                       '$birthday'     => $birthday,
+                                       '$community'    => (($owner['page-flags'] == PAGE_COMMUNITY) ? '<dfrn:community>1</dfrn:community>' : '')
                        ));
 
                        foreach($items as $item) {
@@ -320,6 +332,14 @@ function delivery_run($argv, $argc){
                                                $x[0]['writable'] = 1;
                                        }
 
+                                       $ssl_policy = get_config('system','ssl_policy');
+                                       fix_contact_ssl_policy($x[0],$ssl_policy);
+
+                                       // If we are setup as a soapbox we aren't accepting input from this person
+
+                                       if($x[0]['page-flags'] == PAGE_SOAPBOX)
+                                               break;
+
                                        require_once('library/simplepie/simplepie.inc');
                                        logger('mod-delivery: local delivery');
                                        local_delivery($x[0],$atom);
@@ -327,7 +347,10 @@ function delivery_run($argv, $argc){
                                }
                        }
 
-                       $deliver_status = dfrn_deliver($owner,$contact,$atom);
+                       if(! was_recently_delayed($contact['id']))
+                               $deliver_status = dfrn_deliver($owner,$contact,$atom);
+                       else
+                               $deliver_status = (-1);
 
                        logger('notifier: dfrn_delivery returns ' . $deliver_status);
 
@@ -370,7 +393,11 @@ function delivery_run($argv, $argc){
                                logger('notifier: slapdelivery: ' . $contact['name']);
                                foreach($slaps as $slappy) {
                                        if($contact['notify']) {
-                                               $deliver_status = slapper($owner,$contact['notify'],$slappy);
+                                               if(! was_recently_delayed($contact['id']))
+                                                       $deliver_status = slapper($owner,$contact['notify'],$slappy);
+                                               else
+                                                       $deliver_status = (-1);
+
                                                if($deliver_status == (-1)) {
                                                        // queue message for redelivery
                                                        add_to_queue($contact['id'],NETWORK_OSTATUS,$slappy);