ostatus hub subscription issues

This commit is contained in:
friendica 2012-06-07 19:53:39 -07:00
parent 52d90674ea
commit da7773a259
3 changed files with 13 additions and 4 deletions

View file

@ -94,6 +94,9 @@ function new_contact($uid,$url,$interactive = false) {
} }
$writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0); $writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
$subhub = (($ret['network'] === NETWORK_OSTATUS) ? true : false);
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0); $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
if($ret['network'] === NETWORK_MAIL) { if($ret['network'] === NETWORK_MAIL) {
@ -116,8 +119,9 @@ function new_contact($uid,$url,$interactive = false) {
if(count($r)) { if(count($r)) {
// update contact // update contact
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1", q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_FRIEND),
intval($subhub),
intval($r[0]['id']), intval($r[0]['id']),
intval($uid) intval($uid)
); );
@ -131,8 +135,8 @@ function new_contact($uid,$url,$interactive = false) {
// create contact record // create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, $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` ) `writable`, `hidden`, `blocked`, `readonly`, `pending`, `subhub` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0 ) ", VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0, %d ) ",
intval($uid), intval($uid),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($ret['url']), dbesc($ret['url']),
@ -151,7 +155,8 @@ function new_contact($uid,$url,$interactive = false) {
intval($new_relation), intval($new_relation),
intval($ret['priority']), intval($ret['priority']),
intval($writeable), intval($writeable),
intval($hidden) intval($hidden),
intval($subhub)
); );
} }

View file

@ -1304,6 +1304,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$birthday = ''; $birthday = '';
$hubs = $feed->get_links('hub'); $hubs = $feed->get_links('hub');
logger('consume_feed: hubs: ' . print_r($hubs,true), LOGGER_DATA);
if(count($hubs)) if(count($hubs))
$hub = implode(',', $hubs); $hub = implode(',', $hubs);

View file

@ -477,6 +477,9 @@ function onepoll_run($argv, $argc){
if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly'])
$hubmode = 'unsubscribe'; $hubmode = 'unsubscribe';
if($contact['network'] === NETWORK_OSTATUS && (! $contact['hub-verify']))
$hub_update = true;
if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) { if((strlen($hub)) && ($hub_update) && ($contact['rel'] != CONTACT_IS_FOLLOWER)) {
logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']); logger('poller: hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
$hubs = explode(',', $hub); $hubs = explode(',', $hub);