aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-03-18 17:55:04 -0700
committerfriendica <info@friendica.com>2013-03-18 17:55:04 -0700
commit9d6a4093baf805891d03eca871c6e3b5ff66eec3 (patch)
treee251b1995d68d143179f5ea14e4c297bbb2eaac7 /include
parent11534ae91e535012f84a53a4026f5288d3a3e79f (diff)
downloadvolse-hubzilla-9d6a4093baf805891d03eca871c6e3b5ff66eec3.tar.gz
volse-hubzilla-9d6a4093baf805891d03eca871c6e3b5ff66eec3.tar.bz2
volse-hubzilla-9d6a4093baf805891d03eca871c6e3b5ff66eec3.zip
we'll need a special system channel (not attached to any account) for directory synchronisation
Diffstat (limited to 'include')
-rw-r--r--include/identity.php36
1 files changed, 27 insertions, 9 deletions
diff --git a/include/identity.php b/include/identity.php
index ae3aab972..2b7085e85 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -44,6 +44,21 @@ function validate_channelname($name) {
}
+// Create the system channel for directory synchronisation - this has no account attached
+
+
+function create_dir_account() {
+ create_account(array(
+ 'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
+ 'nickname' => 'dir',
+ 'name' => 'Directory',
+ 'pageflags' => PAGE_DIRECTORY_CHANNEL|PAGE_HIDDEN,
+ 'publish' => 0
+ ));
+}
+
+
+
// Required: name, nickname, account_id
// optional: pageflags
@@ -107,7 +122,7 @@ function create_identity($arr) {
dbesc($hash),
dbesc($key['prvkey']),
dbesc($key['pubkey']),
- intval(PAGE_NORMAL)
+ intval($pageflags)
);
$r = q("select * from channel where channel_account_id = %d
@@ -123,7 +138,8 @@ function create_identity($arr) {
$ret['channel'] = $r[0];
- set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
+ if(intval($arr['account_id']))
+ set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
// Ensure that there is a host keypair.
@@ -200,16 +216,18 @@ function create_identity($arr) {
intval(ABOOK_FLAG_SELF)
);
+ if(intval($ret['channel']['channel_account_id'])) {
- // Create a group with no members. This allows somebody to use it
- // right away as a default group for new contacts.
-
- require_once('include/group.php');
- group_add($newuid, t('Friends'));
+ // Create a group with no members. This allows somebody to use it
+ // right away as a default group for new contacts.
- call_hooks('register_account', $newuid);
+ require_once('include/group.php');
+ group_add($newuid, t('Friends'));
- proc_run('php','include/directory.php', $ret['channel']['channel_id']);
+ call_hooks('register_account', $newuid);
+
+ proc_run('php','include/directory.php', $ret['channel']['channel_id']);
+ }
$ret['success'] = true;
return $ret;