aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/Contact.php3
-rw-r--r--include/settings.php2
-rw-r--r--mod/connections.php37
-rw-r--r--version.inc2
4 files changed, 36 insertions, 8 deletions
diff --git a/include/Contact.php b/include/Contact.php
index b2d459ca4..245682454 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -76,6 +76,9 @@ function abook_toggle_flag($abook,$flag) {
intval($abook['abook_id']),
intval($abook['abook_channel'])
);
+ $a = get_app();
+ if($a->data['abook'])
+ $a->data['abook']['abook_flags'] = $a->data['abook']['abook_flags'] ^ $flag;
return $r;
}
diff --git a/include/settings.php b/include/settings.php
index 9266932f2..94cb6f65b 100644
--- a/include/settings.php
+++ b/include/settings.php
@@ -65,7 +65,7 @@ function build_sync_packet($packet = null) {
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($n),
- dbesc($info)
+ dbesc(json_encode($info))
);
proc_run('php','include/deliver.php',$hash);
diff --git a/mod/connections.php b/mod/connections.php
index ff3edfeaa..226c1678f 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -126,13 +126,27 @@ function connections_post(&$a) {
intval(local_user()),
intval($contact_id)
);
- if($r)
+ if($r) {
$a->data['abook'] = $r[0];
+ }
+
return;
}
+function connections_clone(&$a) {
+
+ if(! array_key_exists('abook',$a->data))
+ return;
+ $clone = $a->data['abook'];
+
+ unset($clone['abook_id']);
+ unset($clone['abook_account']);
+ unset($clone['abook_channel']);
+ require_once('include/settings.php');
+ build_sync_packet(array('abook' => array($clone)));
+}
function connections_content(&$a) {
@@ -183,40 +197,48 @@ function connections_content(&$a) {
}
if($cmd === 'block') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED))
+ if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED)) {
info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_BLOCKED)
? t('Channel has been unblocked')
: t('Channel has been blocked')) . EOL );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
}
if($cmd === 'ignore') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED))
+ if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED)) {
info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_IGNORED)
? t('Channel has been unignored')
: t('Channel has been ignored')) . EOL );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
}
if($cmd === 'archive') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED))
+ if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED)) {
info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_ARCHIVED)
? t('Channel has been unarchived')
: t('Channel has been archived')) . EOL );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
}
if($cmd === 'hide') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN))
+ if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN)) {
info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_HIDDEN)
? t('Channel has been unhidden')
: t('Channel has been hidden')) . EOL );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
@@ -226,10 +248,12 @@ function connections_content(&$a) {
if($cmd === 'approve') {
if($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING))
+ if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING)) {
info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING)
? t('Channel has been approved')
: t('Channel has been unapproved')) . EOL );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
}
@@ -244,6 +268,7 @@ function connections_content(&$a) {
// terminate_friendship($a->get_channel(),$orig_record[0]);
contact_remove(local_user(), $orig_record[0]['abook_id']);
+// FIXME - send to clones
info( t('Contact has been removed.') . EOL );
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
diff --git a/version.inc b/version.inc
index 8cf348b02..bf1f22e95 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-06-25.355
+2013-06-26.356