From 62a8298b549c8985a7817be046d7e25cbaf17cb5 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 31 Oct 2012 16:55:19 -0700 Subject: starting on pinging the basic elements of federation and communication --- mod/abook.php | 18 +++++++++++------- mod/follow.php | 6 +++--- mod/zfinger.php | 4 +++- 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/abook.php b/mod/abook.php index fe0be80aa..51cebd160 100644 --- a/mod/abook.php +++ b/mod/abook.php @@ -24,6 +24,7 @@ function abook_init(&$a) { } else { $abook_id = 0; + } } if($abook_id) { @@ -426,8 +427,7 @@ EOT; $search = ((x($_REQUEST,'search')) ? notags(trim($_REQUEST['search'])) : ''); - -// $nets = ((x($_GET,'nets')) ? notags(trim($_GET['nets'])) : ''); + $nets = ((x($_GET,'nets')) ? notags(trim($_GET['nets'])) : ''); $tabs = array( array( @@ -498,17 +498,21 @@ EOT; // $sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : ''); - $r = q("SELECT COUNT(*) AS `total` FROM `contact` - WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", - intval($_SESSION['uid'])); + $r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash + where abook_channel = %d and not (abook_flags & %d) $sql_extra $sql_extra2 ", + intval(local_user()), + intval(ABOOK_FLAG_SELF) + ); if(count($r)) { $a->set_pager_total($r[0]['total']); $total = $r[0]['total']; } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ", - intval($_SESSION['uid']), + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_chan = xchan.xchan_hash + WHERE abook_channel = %d and not (abook_flags & %d) $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d , %d ", + intval(local_user()), + intval(ABOOK_FLAG_SELF), intval($a->pager['start']), intval($a->pager['itemspage']) ); diff --git a/mod/follow.php b/mod/follow.php index 5e48174c9..0b222e505 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -24,10 +24,10 @@ function follow_init(&$a) { goaway($return_url); } - info( t('Contact added') . EOL); + info( t('Channel added') . EOL); - if(strstr($return_url,'contacts')) - goaway($a->get_baseurl() . '/contacts/' . $contact_id); + if(strstr($return_url,'channel')) + goaway($a->get_baseurl() . '/channel/' . $result['channel_id']); goaway($return_url); // NOTREACHED diff --git a/mod/zfinger.php b/mod/zfinger.php index e76255032..2ae265df7 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -67,8 +67,10 @@ function zfinger_init(&$a) { $ret['hubs'][] = array( 'primary' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false), 'url' => $hub['hubloc_url'], + 'url_sig' => $hub['hubloc_url_sig'], /// hmmm we probably shouldn't sign somebody else's hub. FIXME - 'url_sig' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['channel_prvkey'])), + 'url_sig2' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['channel_prvkey'])), + 'host' => $hub['hubloc_host'], 'callback' => $hub['hubloc_callback'], 'sitekey' => $hub['hubloc_sitekey'] ); -- cgit v1.2.3