diff options
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | include/delivery.php | 8 | ||||
-rw-r--r-- | include/items.php | 4 | ||||
-rw-r--r-- | include/notifier.php | 11 | ||||
-rw-r--r-- | include/text.php | 6 | ||||
-rw-r--r-- | mod/dfrn_notify.php | 10 | ||||
-rw-r--r-- | mod/pubsub.php | 9 |
7 files changed, 41 insertions, 9 deletions
@@ -8,7 +8,7 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1123' ); +define ( 'FRIENDIKA_VERSION', '2.3.1124' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1094 ); diff --git a/include/delivery.php b/include/delivery.php index 46112d78e..1ba1d9c3a 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -123,7 +123,6 @@ function delivery_run($argv, $argc){ if( ! ($icontacts && count($icontacts))) return; - // avoid race condition with deleting entries if($items[0]['deleted']) { @@ -269,7 +268,12 @@ function delivery_run($argv, $argc){ if(! $item_contact) continue; - $atom .= atom_entry($item,'text',$item_contact,$owner,true); + if($normal_mode) { + if($item_id == $item['id'] || $item['id'] == $item['parent']) + $atom .= atom_entry($item,'text',$item_contact,$owner,true); + } + else + $atom .= atom_entry($item,'text',$item_contact,$owner,true); } diff --git a/include/items.php b/include/items.php index dc08fb3db..93a730d22 100644 --- a/include/items.php +++ b/include/items.php @@ -1663,7 +1663,7 @@ function lose_sharer($importer,$contact,$datarray,$item) { } -function subscribe_to_hub($url,$importer,$contact,$submode = 'subscribe') { +function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') { if(is_array($importer)) { $r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1", @@ -1686,7 +1686,7 @@ function subscribe_to_hub($url,$importer,$contact,$submode = 'subscribe') { $params= 'hub.mode=' . $hubmode . '&hub.callback=' . urlencode($push_url) . '&hub.topic=' . urlencode($contact['poll']) . '&hub.verify=async&hub.verify_token=' . $verify_token; - logger('subscribe_to_hub: subscribing ' . $contact['name'] . ' to hub ' . $url . ' with verifier ' . $verify_token); + logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token); if(! strlen($contact['hub-verify'])) { $r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d LIMIT 1", diff --git a/include/notifier.php b/include/notifier.php index d1cd1cc73..c3f7f33ea 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -360,7 +360,16 @@ function notifier_run($argv, $argc){ if(! $contact) continue; - $atom .= atom_entry($item,'text',$contact,$owner,true); + if($normal_mode) { + + // we only need the current item, but include the parent because without it + // older sites without a corresponding dfrn_notify change may do the wrong thing. + + if($item_id == $item['id'] || $item['id'] == $item['parent']) + $atom .= atom_entry($item,'text',$contact,$owner,true); + } + else + $atom .= atom_entry($item,'text',$contact,$owner,true); if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire)) $slaps[] = atom_entry($item,'html',$contact,$owner,true); diff --git a/include/text.php b/include/text.php index 656cd8809..701c1e41b 100644 --- a/include/text.php +++ b/include/text.php @@ -744,7 +744,12 @@ function link_compare($a,$b) { if(! function_exists('prepare_body')) { function prepare_body($item,$attach = false) { + call_hooks('prepare_body_init', $item); + $s = prepare_text($item['body']); + + call_hooks('prepare_body', $s); + if(! $attach) return $s; @@ -776,6 +781,7 @@ function prepare_body($item,$attach = false) { } $s .= '<div class="clear"></div></div>'; } + call_hooks('prepare_body_final', $s); return $s; }} diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 23bdd7388..9e9809950 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -450,7 +450,15 @@ function dfrn_notify_post(&$a) { } if($is_reply) { - if($feed->get_item_quantity() == 1) { + + // was the top-level post for this reply written by somebody on this site? Specifically, the recipient? + + $r = q("select `id` from `item` where `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($parent_uri), + intval($importer['importer_uid']) + ); + if($r && count($r)) { + logger('dfrn_notify: received remote comment'); $is_like = false; // remote reply to our post. Import and then notify everybody else. diff --git a/mod/pubsub.php b/mod/pubsub.php index 0c506db00..93d50ef90 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -69,8 +69,13 @@ function pubsub_init(&$a) { // We must initiate an unsubscribe request with a verify_token. // Don't allow outsiders to unsubscribe us. - if(($hub_mode === 'unsubscribe') && (! strlen($hub_verify))) - hub_return(false, ''); + if($hub_mode === 'unsubscribe') { + if(! strlen($hub_verify)) { + logger('pubsub: bogus unsubscribe'); + hub_return(false, ''); + } + logger('pubsub: unsubscribe success'); + } $r = q("UPDATE `contact` SET `subhub` = %d WHERE `id` = %d LIMIT 1", intval($subscribe), |