aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/Contact.php2
-rw-r--r--include/contact_widgets.php4
-rw-r--r--include/follow.php17
-rw-r--r--include/identity.php15
-rw-r--r--install/database.sql6
-rw-r--r--mod/abook.php18
-rw-r--r--mod/follow.php6
-rw-r--r--mod/zfinger.php4
-rw-r--r--version.inc2
9 files changed, 44 insertions, 30 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 485afa3ba..a7da29b35 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -1,7 +1,7 @@
<?php
-functino vcard_from_xchan($xchan) {
+function vcard_from_xchan($xchan) {
return replace_macros(get_markup_template('xchan_vcard.tpl'),array(
$name => $abook['xchan_name'],
$photo => $abook['xchan_photo_l']
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index ebefa1c23..9054fc3f4 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -3,8 +3,8 @@
function follow_widget() {
return replace_macros(get_markup_template('follow.tpl'),array(
- '$connect' => t('Add New Contact'),
- '$desc' => t('Enter address or web location'),
+ '$connect' => t('Add New Channel'),
+ '$desc' => t('Enter webbie (channel location)'),
'$hint' => t('Example: bob@example.com, http://example.com/barbara'),
'$follow' => t('Connect')
));
diff --git a/include/follow.php b/include/follow.php
index 55b83820c..4c835c8a7 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -2,13 +2,11 @@
//
-// Takes a $uid and a url/handle and adds a new contact
-// Currently if the contact is DFRN, interactive needs to be true, to redirect to the
-// dfrn_request page.
+// Takes a $uid and a url/handle and adds a new channel
-// Otherwise this can be used to bulk add statusnet contacts, twitter contacts, etc.
// Returns an array
// $return['success'] boolean true if successful
+// $return['abook_id'] Address book ID if successful
// $return['message'] error text if success is false.
@@ -19,10 +17,6 @@ function new_contact($uid,$url,$interactive = false) {
$a = get_app();
- // remove ajax junk, e.g. Twitter
-
- $url = str_replace('/#!/','/',$url);
-
if(! allowed_url($url)) {
$result['message'] = t('Disallowed profile URL.');
return $result;
@@ -33,14 +27,17 @@ function new_contact($uid,$url,$interactive = false) {
return $result;
}
- $arr = array('url' => $url, 'contact' => array());
+ $arr = array('url' => $url, 'channel' => array());
call_hooks('follow', $arr);
if(x($arr['contact'],'name'))
$ret = $arr['contact'];
else
- $ret = probe_url($url);
+ $ret = zot_probe_url($url);
+
+
+
if($ret['network'] === NETWORK_DFRN) {
if($interactive) {
diff --git a/include/identity.php b/include/identity.php
index 7b0b86ee4..e05aaba30 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -89,18 +89,27 @@ function create_identity($arr) {
set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
+ // Ensure that there is a host keypair.
+
+ if((! get_config('system','pubkey')) && (! get_config('system','prvkey'))) {
+ $hostkey = new_keypair(4096);
+ set_config('system','pubkey',$hostkey['pubkey']);
+ set_config('system','prvkey',$hostkey['prvkey']);
+ }
+
// Create a verified hub location pointing to this site.
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_flags,
- hubloc_url, hubloc_url_sig, hubloc_callback, hubloc_sitekey )
- values ( '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
+ hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey )
+ values ( '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )",
dbesc($guid),
dbesc($sig),
dbesc($hash),
intval(($primary) ? HUBLOC_FLAGS_PRIMARY : 0),
dbesc(z_root()),
dbesc(base64url_encode(rsa_sign(z_root(),$ret['channel']['channel_prvkey']))),
+ dbesc(get_app()->get_hostname()),
dbesc(z_root() . '/post'),
dbesc(get_config('system','pubkey'))
);
@@ -118,7 +127,7 @@ function create_identity($arr) {
dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"),
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"),
dbesc($a->get_baseurl() . "/photo/profile/s/{$newuid}"),
- dbesc($ret['channel']['channel_address'] . '@' . $a->get_hostname()),
+ dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()),
dbesc(z_root() . '/channel/' . $ret['channel']['channel_address']),
dbesc($ret['channel']['channel_name']),
dbesc('zot'),
diff --git a/install/database.sql b/install/database.sql
index 92a8df651..667b59bed 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `abook` (
KEY `abook_connnected` (`abook_connnected`),
KEY `abook_flags` (`abook_flags`),
KEY `abook_profile` (`abook_profile`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `account` (
`account_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -472,6 +472,7 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
`hubloc_flags` int(10) unsigned NOT NULL DEFAULT '0',
`hubloc_url` char(255) NOT NULL DEFAULT '',
`hubloc_url_sig` char(255) NOT NULL,
+ `hubloc_host` char(255) NOT NULL DEFAULT '',
`hubloc_callback` char(255) NOT NULL DEFAULT '',
`hubloc_connect` char(255) NOT NULL DEFAULT '',
`hubloc_sitekey` text NOT NULL,
@@ -481,7 +482,8 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
KEY `hubloc_flags` (`hubloc_flags`),
KEY `hubloc_guid_sig` (`hubloc_guid_sig`),
KEY `hubloc_url_sig` (`hubloc_url_sig`),
- KEY `hubloc_connect` (`hubloc_connect`)
+ KEY `hubloc_connect` (`hubloc_connect`),
+ KEY `hubloc_host` (`hubloc_host`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `intro` (
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']
);
diff --git a/version.inc b/version.inc
index a4bc5b083..531cd3d3e 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2012-10-30.123
+2012-10-31.124