From eb8f194419975a6cd3debba145c8769da055b8dc Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 25 Aug 2014 21:42:46 -0700 Subject: sort out some anomalies --- include/diaspora.php | 6 +++--- include/network.php | 5 +++-- include/notifier.php | 4 ++-- include/zot.php | 13 ++++++++++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index d93baaaa0..ebd1906f3 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -215,7 +215,7 @@ function diaspora_process_outbound($arr) { else { // public message - $contact = array('hubloc_callback' => $arr['hub']['hubloc_callback']); + $contact = $arr['hub']; if($target_item['verb'] === ACTIVITY_DISLIKE) { // unsupported @@ -2709,9 +2709,9 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run=false) if($public_batch) $dest_url = $contact['hubloc_callback'] . '/public'; else - $dest_url = $contact['hubloc_callback'] . '/users/' . $contact['guid']; + $dest_url = $contact['hubloc_callback'] . '/users/' . $contact['hubloc_guid']; - + logger('diaspora_transmit: URL: ' . $dest_url, LOGGER_DEBUG); if(intval(get_config('system','diaspora_test'))) return 200; diff --git a/include/network.php b/include/network.php index 83a3ea4d0..ff0502f5a 100644 --- a/include/network.php +++ b/include/network.php @@ -929,7 +929,7 @@ function discover_by_webbie($webbie) { dbesc($webbie) ); if(! $r) { - $r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated ) values ('%s','%s','%s','%s','%s','%s','%s','%s')", + $r = q("insert into hubloc ( hubloc_guid, hubloc_hash, hubloc_addr, hubloc_network, hubloc_url, hubloc_host, hubloc_callback, hubloc_updated, hubloc_flags ) values ('%s','%s','%s','%s','%s','%s','%s','%s', %d)", dbesc($guid), dbesc($addr), dbesc($addr), @@ -937,7 +937,8 @@ function discover_by_webbie($webbie) { dbesc(trim($diaspora_base,'/')), dbesc($hostname), dbesc($notify), - dbesc(datetime_convert()) + dbesc(datetime_convert()), + intval(HUBLOC_FLAGS_PRIMARY) ); } $photos = import_profile_photo($vcard['photo'],$addr); diff --git a/include/notifier.php b/include/notifier.php index 0a5cf3f4c..7c4f64ae0 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -445,11 +445,11 @@ function notifier_run($argv, $argc){ // aren't the owner or author. - $r = q("select hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc + $r = q("select hubloc_guid, hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc where hubloc_hash in (" . implode(',',$recipients) . ") group by hubloc_sitekey order by hubloc_connected desc limit 1"); } else { - $r = q("select hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc + $r = q("select hubloc_guid, hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc where hubloc_hash in (" . implode(',',$recipients) . ") $sql_extra group by hubloc_sitekey"); } diff --git a/include/zot.php b/include/zot.php index a155b2588..65c092b93 100644 --- a/include/zot.php +++ b/include/zot.php @@ -198,11 +198,17 @@ function zot_finger($webbie,$channel,$autofallback = true) { if($r) { $url = $r[0]['hubloc_url']; + + if($r[0]['hubloc_network'] && $r[0]['hubloc_network'] !== 'zot') { + logger('zot_finger: alternate network: ' . $webbie); + return array('success' => false); + } } else { $url = 'https://' . $host; } - + + $rhs = '/.well-known/zot-info'; $https = ((strpos($url,'https://') === 0) ? true : false); @@ -271,6 +277,11 @@ function zot_finger($webbie,$channel,$autofallback = true) { function zot_refresh($them,$channel = null, $force = false) { + if(array_key_exists('xchan_network',$them) && ($them['xchan_network'] !== 'zot')) { + logger('zot_refresh: not got zot. ' . $them['xchan_name']); + return true; + } + logger('zot_refresh: them: ' . print_r($them,true), LOGGER_DATA); if($channel) logger('zot_refresh: channel: ' . print_r($channel,true), LOGGER_DATA); -- cgit v1.2.3