diff options
author | Friendika <info@friendika.com> | 2011-08-24 04:42:28 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-08-24 04:42:28 -0700 |
commit | a775474dff73e0e17e95bcfee42caeecdacf5295 (patch) | |
tree | 026618b3896f1170467114070d3a0c77e7f3856f | |
parent | b6fdd3c76bd6d0f30a7973286ef19c10bf6326a6 (diff) | |
download | volse-hubzilla-a775474dff73e0e17e95bcfee42caeecdacf5295.tar.gz volse-hubzilla-a775474dff73e0e17e95bcfee42caeecdacf5295.tar.bz2 volse-hubzilla-a775474dff73e0e17e95bcfee42caeecdacf5295.zip |
cleaned up the conditions on when to and when not to relay.
-rw-r--r-- | include/diaspora.php | 18 | ||||
-rw-r--r-- | include/items.php | 2 | ||||
-rw-r--r-- | include/notifier.php | 32 |
3 files changed, 43 insertions, 9 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index 563eaa4e2..75d47e05a 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -544,7 +544,6 @@ function diaspora_comment($importer,$xml,$msg) { if($parent_author_signature) { -// $owner_signed_data = $guid . ';' . $parent_guid . ';' . $text . ';' . $msg['author']; $owner_signed_data = $guid . ';' . $parent_guid . ';' . $text . ';' . $diaspora_handle; $parent_author_signature = base64_decode($parent_author_signature); @@ -619,13 +618,14 @@ function diaspora_comment($importer,$xml,$msg) { dbesc(base64_encode($author_signature)), dbesc($diaspora_handle) ); - } - // notify others -// proc_run('php','include/notifier.php','comment',$message_id); + // if the message isn't already being relayed, notify others + // the existence of parent_author_signature means the parent_author or owner + // is already relaying. + proc_run('php','include/notifier.php','comment',$message_id); + } return; - } function diaspora_photo($importer,$xml,$msg) { @@ -845,8 +845,12 @@ EOT; ); } - // notify others -// proc_run('php','include/notifier.php','comment',$message_id); + // if the message isn't already being relayed, notify others + // the existence of parent_author_signature means the parent_author or owner + // is already relaying. + + if(! $parent_author_signature) + proc_run('php','include/notifier.php','comment',$message_id); return; } diff --git a/include/items.php b/include/items.php index 746e3b294..19e56c0b6 100644 --- a/include/items.php +++ b/include/items.php @@ -1556,7 +1556,7 @@ function subscribe_to_hub($url,$importer,$contact) { intval($importer['uid']) ); } - if(! count($r)) + if((! count($r)) || $contact['network'] === NETWORK_DIASPORA) return; $push_url = get_config('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id']; diff --git a/include/notifier.php b/include/notifier.php index 1c8245c7a..7b645844f 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -150,7 +150,37 @@ function notifier_run($argv, $argc){ $parent = $items[0]; - if($parent['wall'] == 0 && (! $expire)) { + // This is IMPORTANT!!!! + + // We will only send a "notify owner to relay" or followup message if the referenced post + // originated on our system by virtue of having our hostname somewhere + // in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere. + // if $parent['wall'] == 1 we will already have the parent message in our array + // and we will relay the whole lot. + + // expire sends an entire group of expire messages and cannot be forwarded. + // However the conversation owner will be a part of the conversation and will + // be notified during this run. + // Other DFRN conversation members will be alerted during polled updates. + + // Diaspora members currently are not notified of expirations, and other networks have + // either limited or no ability to process deletions. We should at least fix Diaspora + // by stringing togther an array of retractions and sending them onward. + + + $localhost = $a->get_hostname(); + if(strpos($localhost,':')) + $localhost = substr($localhost,0,strpos($localhost,':')); + + /** + * + * Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes + * have been known to cause runaway conditions which affected several servers, along with + * permissions issues. + * + */ + + if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) { // local followup to remote post $followup = true; $public_message = false; // not public |