aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-25 05:00:18 -0800
committerfriendica <info@friendica.com>2013-01-25 05:00:18 -0800
commitd8fe7e011513855d9bd0178638bfebd70145b8a5 (patch)
tree6d8895007332ccadb58768a4130c169eb5078b35 /include
parent7521493b3774c7ee3fb22fe4e22948d8ab119144 (diff)
downloadvolse-hubzilla-d8fe7e011513855d9bd0178638bfebd70145b8a5.tar.gz
volse-hubzilla-d8fe7e011513855d9bd0178638bfebd70145b8a5.tar.bz2
volse-hubzilla-d8fe7e011513855d9bd0178638bfebd70145b8a5.zip
more api functions to help pull business logic out of controller code, in this case the often used functions to fetch all contacts or fetch the self contact
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/Contact.php b/include/Contact.php
index a2303803c..972911c0f 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -1,6 +1,24 @@
<?php
+function abook_connections($channel_id, $flags = 0) {
+ $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d
+ and not ( abook_flags & %d )",
+ intval($channel_id),
+ intval(ABOOK_FLAG_SELF)
+ );
+ return(($r) ? $r : array());
+}
+
+function abook_self($channel_id) {
+ $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d
+ and ( abook_flags & %d ) limit 1",
+ intval($channel_id),
+ intval(ABOOK_FLAG_SELF)
+ );
+ return(($r) ? $r[0] : array());
+}
+
function vcard_from_xchan($xchan, $observer = null, $mode = '') {
$connect = false;