notify hub only on public updates

This commit is contained in:
Mike Macgirvin 2010-10-02 03:38:53 -07:00
parent 6ad1a22a05
commit 336aea26dc
2 changed files with 24 additions and 14 deletions

View file

@ -129,17 +129,17 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
$atom .= replace_macros($feed_template, array( $atom .= replace_macros($feed_template, array(
'$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner_nick), '$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner_nick),
'$feed_title' => xmlify($owner['name']), '$feed_title' => xmlify($owner['name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) , '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
'$hub' => $hubxml, '$hub' => $hubxml,
'$name' => xmlify($owner['name']), '$name' => xmlify($owner['name']),
'$profile_page' => xmlify($owner['url']), '$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo']), '$photo' => xmlify($owner['photo']),
'$thumb' => xmlify($owner['thumb']), '$thumb' => xmlify($owner['thumb']),
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) , '$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)) , '$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)) '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME))
)); ));

View file

@ -60,12 +60,12 @@
if(! count($r)) if(! count($r))
killme(); killme();
$parent = $r[0]['parent']; $parent_id = $r[0]['parent'];
$uid = $r[0]['uid']; $uid = $r[0]['uid'];
$updated = $r[0]['edited']; $updated = $r[0]['edited'];
$items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id` ASC", $items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id` ASC",
intval($parent) intval($parent_id)
); );
if(! count($items)) if(! count($items))
@ -84,6 +84,8 @@
killme(); killme();
$hub = get_config('system','huburl'); $hub = get_config('system','huburl');
// If this is a public conversation, notify the feed hub
$notify_hub = true;
if($cmd != 'mail') { if($cmd != 'mail') {
@ -94,11 +96,18 @@
if($parent['type'] === 'remote') { if($parent['type'] === 'remote') {
// local followup to remote post // local followup to remote post
$followup = true; $followup = true;
$notify_hub = false; // not public
$conversant_str = dbesc($parent['contact-id']); $conversant_str = dbesc($parent['contact-id']);
} }
else { else {
$followup = false; $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_people = expand_acl($parent['allow_cid']);
$allow_groups = expand_groups(expand_acl($parent['allow_gid'])); $allow_groups = expand_groups(expand_acl($parent['allow_gid']));
$deny_people = expand_acl($parent['deny_cid']); $deny_people = expand_acl($parent['deny_cid']);
@ -158,6 +167,7 @@
)); ));
if($cmd === 'mail') { if($cmd === 'mail') {
$notify_hub = false; // mail is not public
$atom .= replace_macros($mail_template, array( $atom .= replace_macros($mail_template, array(
'$name' => xmlify($owner['name']), '$name' => xmlify($owner['name']),
'$profile_page' => xmlify($owner['url']), '$profile_page' => xmlify($owner['url']),
@ -302,7 +312,7 @@
} }
} }
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'] ); $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
post_url($hub,$params); post_url($hub,$params);
} }