diff --git a/include/Contact.php b/include/Contact.php
index a7da29b35..ff798ed74 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -3,8 +3,8 @@
function vcard_from_xchan($xchan) {
return replace_macros(get_markup_template('xchan_vcard.tpl'),array(
- $name => $abook['xchan_name'],
- $photo => $abook['xchan_photo_l']
+ '$name' => $xchan['xchan_name'],
+ '$photo' => $xchan['xchan_photo_l']
));
}
@@ -206,26 +206,23 @@ function contact_photo_menu($contact) {
$poke_link="";
$sparkle = false;
- if($contact['network'] === NETWORK_DFRN) {
+ if($contact['xchan_network'] === NETWORK_ZOT) {
$sparkle = true;
- $profile_link = $a->get_baseurl() . '/redir/' . $contact['id'];
+ $profile_link = $a->get_baseurl() . '/magic?f=&id=' . $contact['abook_id'];
}
else
- $profile_link = $contact['url'];
-
- if($profile_link === 'mailbox')
- $profile_link = '';
+ $profile_link = $contact['xchan_url'];
if($sparkle) {
- $status_link = $profile_link . "?url=status";
- $photos_link = $profile_link . "?url=photos";
- $profile_link = $profile_link . "?url=profile";
- $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
+ $status_link = $profile_link . "&url=status";
+ $photos_link = $profile_link . "&url=photos";
+ $profile_link = $profile_link . "&url=profile";
+ $pm_url = $a->get_baseurl() . '/message/new/' . $contact['xchan_hash'];
}
- $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
- $contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
- $posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id'];
+ $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['abook_id'];
+ $contact_url = $a->get_baseurl() . '/connections/' . $contact['abook_id'];
+ $posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['abook_id'];
$menu = Array(
t("Poke") => $poke_link,
@@ -245,10 +242,7 @@ function contact_photo_menu($contact) {
$o = "";
foreach($menu as $k=>$v){
if ($v!="") {
- if(($k !== t("Network Posts")) && ($k !== t("Send PM")) && ($k !== t('Edit Contact')))
- $o .= "
$k\n";
- else
- $o .= "$k\n";
+ $o .= "$k\n";
}
}
return $o;
diff --git a/include/follow.php b/include/follow.php
index b3591b8ba..686282624 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -73,6 +73,8 @@ function new_contact($uid,$url,$channel,$interactive = false) {
if(! $x['success'])
return $x;
+ $xchan_hash = $x['hash'];
+
// Do we already have an abook entry?
// go directly to the abook edit page.
@@ -100,10 +102,20 @@ function new_contact($uid,$url,$channel,$interactive = false) {
}
+ $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_their_perms, abook_created, abook_updated )
+ values( %d, %d, '%s', %d, '%s', '%s' ) ",
+ intval(get_account_id()),
+ intval(local_user()),
+ dbesc($xchan_hash),
+ intval($their_perms),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert())
+ );
+ if(! $r)
+ logger('mod_follow: abook creation failed');
+
- // Else create an entry
-
// Then send a ping/message to the other side
diff --git a/include/zot.php b/include/zot.php
index 46400f597..3d1669c0f 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -294,6 +294,7 @@ function import_xchan_from_json($j) {
if(! x($ret,'message')) {
$ret['success'] = true;
+ $ret['hash'] = $xchan_hash;
}
return $ret;
}
\ No newline at end of file
diff --git a/mod/connections.php b/mod/connections.php
index 152395679..6c63d1b14 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -144,18 +144,36 @@ function connections_content(&$a) {
return;
}
+ $xchan = null;
+
if(argc() == 3) {
+ $cmd = argv(2);
- $cmd = argv(1);
- if($cmd === 'profile') {
+ if(argv(1) === 'profile') {
$xchan_hash = argv(2);
if($xchan_hash) {
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($xchan_hash)
);
- if($r && count($r)) {
+ if($r) {
+ $xchan = $r[0];
+ }
+ }
+ }
+ elseif(intval(argv(1)) && argv(2) === 'profile')
+ $r = q("SELECT abook.*, xchan.*
+ FROM abook left join xchan on abook_xchan = xchan_hash
+ WHERE abook_channel = %d and abook_id = %d LIMIT 1",
+ intval(local_user()),
+ intval(argv(1))
+ );
+ if($r)
+ $xchan = $r[0];
+
+ if($xchan) {
+
$o .= <<< EOT
-