aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-15 18:17:19 -0700
committerFriendika <info@friendika.com>2011-08-15 18:17:19 -0700
commita6d88fb8f7a1538f0b6af915107582b5189e25a0 (patch)
tree5ec421320220eee141e7aac1385740549bb7cb3f
parent44918e27367d00d3625daaf751a05b166ecd2fc1 (diff)
downloadvolse-hubzilla-a6d88fb8f7a1538f0b6af915107582b5189e25a0.tar.gz
volse-hubzilla-a6d88fb8f7a1538f0b6af915107582b5189e25a0.tar.bz2
volse-hubzilla-a6d88fb8f7a1538f0b6af915107582b5189e25a0.zip
diaspora friend approvals
-rw-r--r--mod/dfrn_confirm.php25
-rw-r--r--mod/notifications.php10
2 files changed, 24 insertions, 11 deletions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index c4feef8ff..6ca6d9c5e 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -123,11 +123,12 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$dfrn_confirm = $contact['confirm'];
$aes_allow = $contact['aes_allow'];
- $network = ((strlen($contact['issued-id'])) ? 'dfrn' : 'stat');
+ $network = ((strlen($contact['issued-id'])) ? NETWORK_DFRN : NETWORK_OSTATUS);
+
if($contact['network'])
$network = $contact['network'];
- if($network === 'dfrn') {
+ if($network === NETWORK_DFRN) {
/**
*
@@ -306,7 +307,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
logger('dfrn_confirm: confirm - imported photos');
- if($network === 'dfrn') {
+ if($network === NETWORK_DFRN) {
$new_relation = CONTACT_IS_FOLLOWER;
if(($relation == CONTACT_IS_SHARING) || ($duplex))
@@ -339,9 +340,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
);
}
else {
- // $network !== 'dfrn'
- $network = (($contact['network']) ? $contact['network'] : 'stat');
+ // $network !== NETWORK_DFRN
+
+ $network = (($contact['network']) ? $contact['network'] : NETWORK_OSTATUS);
$notify = (($contact['notify']) ? $contact['notify'] : '');
$poll = (($contact['poll']) ? $contact['poll'] : '');
@@ -357,6 +359,10 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
}
}
+ $new_relation = $contact['rel'];
+ if($network === NETWORK_DIASPORA && $duplex)
+ $new_relation = CONTACT_IS_FRIEND;
+
$r = q("DELETE FROM `intro` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($intro_id),
intval($uid)
@@ -373,7 +379,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
`poll` = '%s',
`blocked` = 0,
`pending` = 0,
- `network` = '%s'
+ `network` = '%s',
+ `rel` = %d
WHERE `id` = %d LIMIT 1
",
dbesc($photos[0]),
@@ -385,6 +392,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc($notify),
dbesc($poll),
dbesc($network),
+ intval($new_relation),
intval($contact_id)
);
}
@@ -409,6 +417,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
);
if((count($r)) && ($r[0]['hide-friends'] == 0) && (is_array($contact)) && isset($new_relation) && ($new_relation == CONTACT_IS_FRIEND)) {
+ if($r[0]['network'] === NETWORK_DIASPORA) {
+ require_once('include_diaspora.php');
+ diaspora_share($user[0],$r[0]);
+ }
+
require_once('include/items.php');
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
diff --git a/mod/notifications.php b/mod/notifications.php
index 244563adc..07403d4b4 100644
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -122,14 +122,14 @@ function notifications_content(&$a) {
continue;
}
- $friend_selected = (($rr['network'] !== 'stat') ? ' checked="checked" ' : ' disabled ');
- $fan_selected = (($rr['network'] === 'stat') ? ' checked="checked" disabled ' : '');
+ $friend_selected = (($rr['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
+ $fan_selected = (($rr['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
$dfrn_tpl = get_markup_template('netfriend.tpl');
$knowyou = '';
$dfrn_text = '';
- if($rr['network'] !== 'stat') {
+ if($rr['network'] === NETWORK_DFRN) {
$knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
$dfrn_text = replace_macros($dfrn_tpl,array(
@@ -138,7 +138,7 @@ function notifications_content(&$a) {
'$fan_selected' => $fan_selected,
'$approve_as' => t('Approve as: '),
'$as_friend' => t('Friend'),
- '$as_fan' => t('Fan/Admirer')
+ '$as_fan' => (($rr['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
));
}
@@ -146,7 +146,7 @@ function notifications_content(&$a) {
$o .= replace_macros($tpl,array(
'$str_notifytype' => t('Notification type: '),
- '$notify_type' => (($rr['network'] !== 'stat') ? t('Friend/Connect Request') : t('New Follower')),
+ '$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
'$dfrn_text' => $dfrn_text,
'$dfrn_id' => $rr['issued-id'],
'$uid' => $_SESSION['uid'],