diff options
author | Thomas Willingham <founder@kakste.com> | 2013-03-28 21:16:25 +0000 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2013-03-28 21:16:25 +0000 |
commit | fbb4dc69c6789a04f8464afba4ea625feb880731 (patch) | |
tree | 47c746b9115d30c4ac3e686022fa497238ac68eb /include/follow.php | |
parent | c8852d455e77624baf9e6ac852c1176f45462e70 (diff) | |
parent | d0bf45972135bde9ac39a06c6fa5eb64d075a225 (diff) | |
download | volse-hubzilla-fbb4dc69c6789a04f8464afba4ea625feb880731.tar.gz volse-hubzilla-fbb4dc69c6789a04f8464afba4ea625feb880731.tar.bz2 volse-hubzilla-fbb4dc69c6789a04f8464afba4ea625feb880731.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/follow.php')
-rw-r--r-- | include/follow.php | 61 |
1 files changed, 11 insertions, 50 deletions
diff --git a/include/follow.php b/include/follow.php index 88418926b..eba353c8b 100644 --- a/include/follow.php +++ b/include/follow.php @@ -111,7 +111,10 @@ function new_contact($uid,$url,$channel,$interactive = false) { if((local_user()) && $uid == local_user()) { $aid = get_account_id(); - $hash = $a->observer['xchan_hash']; + $hash = get_observer_hash(); + $ch = $a->get_channel(); + $default_group = $ch['channel_default_group']; + } else { $r = q("select * from channel where channel_id = %d limit 1", @@ -123,6 +126,7 @@ function new_contact($uid,$url,$channel,$interactive = false) { } $aid = $r[0]['channel_account_id']; $hash = $r[0]['channel_hash']; + $default_group = $r[0]['channel_default_group']; } if($hash == $xchan_hash) { @@ -163,59 +167,16 @@ function new_contact($uid,$url,$channel,$interactive = false) { if($r) $result['abook'] = $r[0]; - // Then send a ping/message to the other side - - -/* - - $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, - `writable`, `hidden`, `blocked`, `readonly`, `pending` ) - VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0) ", - intval($uid), - dbesc(datetime_convert()), - dbesc($ret['url']), - dbesc(normalise_link($ret['url'])), - dbesc($ret['addr']), - dbesc($ret['alias']), - dbesc($ret['batch']), - dbesc($ret['notify']), - dbesc($ret['poll']), - dbesc($ret['poco']), - dbesc($ret['name']), - dbesc($ret['nick']), - dbesc($ret['photo']), - dbesc($ret['network']), - dbesc($ret['pubkey']), - intval($new_relation), - intval($ret['priority']), - intval($writeable), - intval($hidden) - ); - } - - $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1", - dbesc($ret['url']), - intval($uid) - ); - - if(! count($r)) { - $result['message'] .= t('Unable to retrieve contact information.') . EOL; - return $result; - } + /** If there is a default group for this channel, add this member to it */ - $contact = $r[0]; - $contact_id = $r[0]['id']; - - - $g = q("select def_gid from user where uid = %d limit 1", - intval($uid) - ); - if($g && intval($g[0]['def_gid'])) { + if($default_group) { require_once('include/group.php'); - group_add_member($uid,'',$contact_id,$g[0]['def_gid']); + $g = group_rec_byhash($uid,$default_group); + if($g) + group_add_member($uid,'',$xchan_hash,$g['id']); } -*/ + // Then send a ping/message to the other side $result['success'] = true; |