diff options
author | marijus <mario@mariovavti.com> | 2014-10-31 14:35:40 +0100 |
---|---|---|
committer | marijus <mario@mariovavti.com> | 2014-10-31 14:35:40 +0100 |
commit | 6e9552df4a9bb75dce72d8a7a8a0f234a30b6ec5 (patch) | |
tree | 99d905131444a9c52e71fc2fbdff453928290127 /include | |
parent | 2982212797dd64e1be13de20dc158842734ee5f8 (diff) | |
parent | 1cb45c30e9032794b7827738cc28f7728ac28677 (diff) | |
download | volse-hubzilla-6e9552df4a9bb75dce72d8a7a8a0f234a30b6ec5.tar.gz volse-hubzilla-6e9552df4a9bb75dce72d8a7a8a0f234a30b6ec5.tar.bz2 volse-hubzilla-6e9552df4a9bb75dce72d8a7a8a0f234a30b6ec5.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'include')
-rw-r--r-- | include/zot.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/zot.php b/include/zot.php index 3a5139755..c9a17562e 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1081,6 +1081,7 @@ function zot_import($arr, $sender_url) { continue; } + $message_request = ((array_key_exists('message_id',$i['notify'])) ? true : false); $i['notify']['sender']['hash'] = make_xchan_hash($i['notify']['sender']['guid'],$i['notify']['sender']['guid_sig']); $deliveries = null; @@ -1182,7 +1183,7 @@ function zot_import($arr, $sender_url) { logger('Activity recipients: ' . print_r($deliveries,true), LOGGER_DATA); $relay = ((array_key_exists('flags',$i['message']) && in_array('relay',$i['message']['flags'])) ? true : false); - $result = process_delivery($i['notify']['sender'],$arr,$deliveries,$relay); + $result = process_delivery($i['notify']['sender'],$arr,$deliveries,$relay,false,$message_request); } elseif($i['message']['type'] === 'mail') { @@ -1379,7 +1380,7 @@ function allowed_public_recips($msg) { } -function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { +function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$request = false) { $result = array(); @@ -1443,10 +1444,13 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false) { if(! $r) { $result[] = array($d['hash'],'comment parent not found',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); - // we don't seem to have a copy of this conversation or at least the parent - request a copy of the entire conversation to date. + // We don't seem to have a copy of this conversation or at least the parent - so request a copy of the entire conversation to date. // Don't do this if it's a relay post as we're the ones who are supposed to have the copy and we don't want the request to loop. + // Also don't do this if this comment came from a conversation request packet. It's possible that comments are allowed but posting + // isn't and that could cause a conversation fetch loop. We can detect these packets since they are delivered via a 'notify' packet type + // that has a message_id element in the initial zot packet (just like the corresponding 'request' packet type which makes the request). - if(! $relay) + if((! $relay) && (! $request)) proc_run('php', 'include/notifier.php', 'request', $channel['channel_id'], $sender['hash'], $arr['parent_mid']); continue; @@ -2852,7 +2856,7 @@ function zot_process_message_request($data) { foreach($hubs as $hub) { $hash = random_string(); - $n = zot_build_packet($c[0],'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash); + $n = zot_build_packet($c[0],'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash,array('message_id' => $data['message_id'])); q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", |