diff options
author | friendica <info@friendica.com> | 2012-11-29 18:15:13 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-11-29 18:15:13 -0800 |
commit | 7082d198c299debf633436c3fea0c0873de73199 (patch) | |
tree | df7096f672e28186303b6c032f9ff76a6a300ef0 | |
parent | e1380525841509ae9bf05c11bf27f655567e63ae (diff) | |
download | volse-hubzilla-7082d198c299debf633436c3fea0c0873de73199.tar.gz volse-hubzilla-7082d198c299debf633436c3fea0c0873de73199.tar.bz2 volse-hubzilla-7082d198c299debf633436c3fea0c0873de73199.zip |
Now if you follow somebody it will create an abook entry on the other site with blocked,ignored, and pending set. No "friend notifications" yet.
-rw-r--r-- | boot.php | 1 | ||||
-rw-r--r-- | include/notifier.php | 4 | ||||
-rw-r--r-- | include/zot.php | 36 | ||||
-rw-r--r-- | mod/connections.php | 19 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/tpl/abook_edit.tpl | 7 |
6 files changed, 51 insertions, 18 deletions
@@ -190,6 +190,7 @@ define ( 'ABOOK_FLAG_BLOCKED' , 0x0001); define ( 'ABOOK_FLAG_IGNORED' , 0x0002); define ( 'ABOOK_FLAG_HIDDEN' , 0x0004); define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008); +define ( 'ABOOK_FLAG_PENDING' , 0x0010); define ( 'ABOOK_FLAG_SELF' , 0x0080); diff --git a/include/notifier.php b/include/notifier.php index 21f587708..da3cf35a6 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -42,7 +42,7 @@ require_once('include/html2plain.php'); * and ITEM_ID is the id of the item in the database that needs to be sent to others. * * ZOT - * permission_updated abook_id + * permission_update abook_id * relay item_id (item was relayed to owner, we will deliver it as owner) * */ @@ -114,6 +114,8 @@ function notifier_run($argv, $argc){ } } } + + return; } diff --git a/include/zot.php b/include/zot.php index 318948ccc..88568f09f 100644 --- a/include/zot.php +++ b/include/zot.php @@ -248,18 +248,38 @@ function zot_refresh($them,$channel = null) { $their_perms = $their_perms | intval($global_perms[$k][1]); } } - - $r = q("update abook set abook_their_perms = %d - where abook_xchan = '%s' and abook_channel = %d - and not (abook_flags & %d) limit 1", - intval($their_perms), +dbg(1); + $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) limit 1", dbesc($x['hash']), intval($channel['channel_id']), intval(ABOOK_FLAG_SELF) ); - - if(! $r) - logger('abook update failed'); + if($r) { + $y = q("update abook set abook_their_perms = %d + where abook_xchan = '%s' and abook_channel = %d + and not (abook_flags & %d) limit 1", + intval($their_perms), + dbesc($x['hash']), + intval($channel['channel_id']), + intval(ABOOK_FLAG_SELF) + ); + if(! $y) + logger('abook update failed'); + } + else { + $y = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_their_perms, abook_created, abook_updated, abook_flags ) values ( %d, %d, '%s', %d, '%s', '%s', %d )", + intval($channel['channel_account_id']), + intval($channel['channel_id']), + dbesc($x['hash']), + intval($their_perms), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_IGNORED|ABOOK_FLAG_PENDING) + ); + if($y) + logger("New introduction received for {$channel['channel_name']}"); + } +dbg(0); } return true; diff --git a/mod/connections.php b/mod/connections.php index 877d5d5c3..6a2076773 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -386,6 +386,7 @@ EOT; '$header' => t('Contact Settings') . ' for ' . $contact['xchan_name'], '$viewprof' => t('View Profile'), + '$lbl_slider' => t('Slide to adjust your degree of friendship'), '$slide' => $slide, '$tabs' => $t, '$tab_str' => $tab_str, @@ -449,7 +450,7 @@ EOT; $hidden = false; $ignored = false; $archived = false; - + $unblocked = false; $all = false; $_SESSION['return_url'] = $a->query_string; @@ -479,10 +480,18 @@ EOT; $search_flags = 0; $all = true; break; + } + + $sql_extra = (($search_flags) ? " and ( abook_flags & " . $search_flags . " ) " : ""); + + + } + else { + $sql_extra = " and not ( abook_flags & " . ABOOK_FLAG_BLOCKED . " ) "; + $unblocked = true; } - $sql_extra = (($search_flags) ? "and ( abook_flags & " . $search_flags . " ) " : ""); $search = ((x($_REQUEST,'search')) ? notags(trim($_REQUEST['search'])) : ''); @@ -504,7 +513,7 @@ EOT; array( 'label' => t('Unblocked'), 'url' => $a->get_baseurl(true) . '/connections', - 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '', + 'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '', 'title' => t('Only show unblocked connections'), ), @@ -561,7 +570,7 @@ EOT; $a->set_pager_total($r[0]['total']); $total = $r[0]['total']; } - +dbg(1); $r = q("SELECT abook.*, xchan.* 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 ORDER BY xchan_name LIMIT %d , %d ", intval(local_user()), @@ -569,7 +578,7 @@ EOT; intval($a->pager['start']), intval($a->pager['itemspage']) ); - +dbg(0); $contacts = array(); if(count($r)) { diff --git a/version.inc b/version.inc index 25a373fac..c87b91cdc 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-11-28.153 +2012-11-29.154 diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl index 353abd6ef..b9664835f 100644 --- a/view/tpl/abook_edit.tpl +++ b/view/tpl/abook_edit.tpl @@ -7,12 +7,13 @@ $tabs </div> <div id="contact-edit-wrapper"> -<br /> -<h3>Slide to adjust your degree of friendship</h3> -$slide +{{ if $slide }} +<h3>$lbl_slider</h3> +$slide +{{ endif }} <h3>Permissions</h3> |