]> git.mxchange.org Git - friendica.git/commitdiff
notify hub only on public updates
authorMike Macgirvin <mike@macgirvin.com>
Sat, 2 Oct 2010 10:38:53 +0000 (03:38 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Sat, 2 Oct 2010 10:38:53 +0000 (03:38 -0700)
include/items.php
include/notifier.php

index 221a8a65c24e646122e4c9b5e95c533d18a114f9..ce354de9b3c7ed8cfa7de6fe683e0f7cedd8f597 100644 (file)
@@ -129,17 +129,17 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
 
 
        $atom .= replace_macros($feed_template, array(
-                       '$feed_id'      => xmlify($a->get_baseurl() . '/profile/' . $owner_nick),
-                       '$feed_title'   => xmlify($owner['name']),
-                       '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
-                       '$hub'          => $hubxml,
-                       '$name'         => xmlify($owner['name']),
-                       '$profile_page' => xmlify($owner['url']),
-                       '$photo'        => xmlify($owner['photo']),
-                       '$thumb'        => xmlify($owner['thumb']),
-                       '$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)) 
+               '$feed_id'      => xmlify($a->get_baseurl() . '/profile/' . $owner_nick),
+               '$feed_title'   => xmlify($owner['name']),
+               '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
+               '$hub'          => $hubxml,
+               '$name'         => xmlify($owner['name']),
+               '$profile_page' => xmlify($owner['url']),
+               '$photo'        => xmlify($owner['photo']),
+               '$thumb'        => xmlify($owner['thumb']),
+               '$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)) 
        ));
 
 
index 0166d0b372a38b22a2d859ded7a86128ccd2b1f9..f7d2844c376b2087e5f821b2a3779ffbf0021e69 100644 (file)
                if(! count($r))
                        killme();
 
-               $parent = $r[0]['parent'];
+               $parent_id = $r[0]['parent'];
                $uid = $r[0]['uid'];
                $updated = $r[0]['edited'];
 
                $items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id` ASC",
-                       intval($parent)
+                       intval($parent_id)
                );
 
                if(! count($items))
@@ -84,6 +84,8 @@
                killme();
 
        $hub = get_config('system','huburl');
+       // If this is a public conversation, notify the feed hub
+       $notify_hub = true;
 
        if($cmd != 'mail') {
 
                if($parent['type'] === 'remote') {
                        // local followup to remote post
                        $followup = true;
+                       $notify_hub = false; // not public
                        $conversant_str = dbesc($parent['contact-id']);
                }
                else {
                        $followup = false;
 
+                       if((strlen($parent['allow_cid'])) 
+                               || (strlen($parent['allow_gid'])) 
+                               || (strlen($parent['deny_cid'])) 
+                               || (strlen($parent['deny_gid'])))
+                               $notify_hub = false; // private recipients, not public
+
                        $allow_people = expand_acl($parent['allow_cid']);
                        $allow_groups = expand_groups(expand_acl($parent['allow_gid']));
                        $deny_people = expand_acl($parent['deny_cid']);
        ));
 
        if($cmd === 'mail') {
+               $notify_hub = false;  // mail is  not public
                $atom .= replace_macros($mail_template, array(
                        '$name'         => xmlify($owner['name']),
                        '$profile_page' => xmlify($owner['url']),
                }
        }
 
-       if((strlen($hub)) && ($cmd !== 'mail') && ($followup == false)) {
+       if((strlen($hub)) && ($notify_hub)) {
                $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
                post_url($hub,$params);
        }