invoke notifier
This commit is contained in:
parent
eb2ef6dec4
commit
b0211499c1
1 changed files with 41 additions and 47 deletions
|
@ -3,6 +3,43 @@
|
|||
require_once('include/crypto.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
function diaspora_get_contact_by_handle($uid,$handle) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `addr` = '%s' LIMIT 1",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval($uid),
|
||||
dbesc($handle)
|
||||
);
|
||||
if($r && count($r))
|
||||
return $r[0];
|
||||
return false;
|
||||
}
|
||||
|
||||
function find_diaspora_person_by_handle($handle) {
|
||||
$r = q("select * from fcontact where network = '%s' and addr = '%s' limit 1",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc($handle)
|
||||
);
|
||||
if(count($r)) {
|
||||
// update record occasionally so it doesn't get stale
|
||||
$d = strtotime($r[0]['updated'] . ' +00:00');
|
||||
if($d < strtotime('now - 14 days')) {
|
||||
q("delete from fcontact where id = %d limit 1",
|
||||
intval($r[0]['id'])
|
||||
);
|
||||
}
|
||||
else
|
||||
return $r[0];
|
||||
}
|
||||
require_once('include/Scrape.php');
|
||||
$r = probe_url($handle, PROBE_DIASPORA);
|
||||
if((count($r)) && ($r['network'] === NETWORK_DIASPORA)) {
|
||||
add_fcontact($r);
|
||||
return ($r);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function get_diaspora_key($uri) {
|
||||
logger('Fetching diaspora key for: ' . $uri);
|
||||
|
||||
|
@ -13,16 +50,6 @@ function get_diaspora_key($uri) {
|
|||
}
|
||||
|
||||
|
||||
function diaspora_base_message($type,$data) {
|
||||
|
||||
$tpl = get_markup_template('diaspora_' . $type . '.tpl');
|
||||
if(! $tpl)
|
||||
return '';
|
||||
return replace_macros($tpl,$data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function diaspora_msg_build($msg,$user,$contact,$prvkey,$pubkey) {
|
||||
$a = get_app();
|
||||
|
||||
|
@ -262,42 +289,6 @@ function diaspora_decode($importer,$xml) {
|
|||
|
||||
}
|
||||
|
||||
function diaspora_get_contact_by_handle($uid,$handle) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `addr` = '%s' LIMIT 1",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval($uid),
|
||||
dbesc($handle)
|
||||
);
|
||||
if($r && count($r))
|
||||
return $r[0];
|
||||
return false;
|
||||
}
|
||||
|
||||
function find_diaspora_person_by_handle($handle) {
|
||||
$r = q("select * from fcontact where network = '%s' and addr = '%s' limit 1",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc($handle)
|
||||
);
|
||||
if(count($r)) {
|
||||
// update record occasionally so it doesn't get stale
|
||||
$d = strtotime($r[0]['updated'] . ' +00:00');
|
||||
if($d < strtotime('now - 14 days')) {
|
||||
q("delete from fcontact where id = %d limit 1",
|
||||
intval($r[0]['id'])
|
||||
);
|
||||
}
|
||||
else
|
||||
return $r[0];
|
||||
}
|
||||
require_once('include/Scrape.php');
|
||||
$r = probe_url($handle, PROBE_DIASPORA);
|
||||
if((count($r)) && ($r['network'] === NETWORK_DIASPORA)) {
|
||||
add_fcontact($r);
|
||||
return ($r);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function diaspora_request($importer,$xml) {
|
||||
|
@ -599,6 +590,8 @@ function diaspora_comment($importer,$xml,$msg) {
|
|||
}
|
||||
|
||||
// notify others
|
||||
proc_run('php','include/notifier.php','comment',$message_id);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -768,7 +761,8 @@ EOT;
|
|||
);
|
||||
}
|
||||
|
||||
// FIXME send notification
|
||||
// notify others
|
||||
proc_run('php','include/notifier.php','comment',$message_id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue