more zot6 work
This commit is contained in:
parent
3b9aedec5f
commit
e7f1d350c9
@ -215,14 +215,19 @@ class HTTPSig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function get_activitystreams_key($id) {
|
function get_activitystreams_key($id) {
|
||||||
|
$x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
||||||
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
|
||||||
dbesc(str_replace('acct:','',$id)),
|
dbesc(str_replace('acct:','',$id)),
|
||||||
dbesc($id)
|
dbesc($id)
|
||||||
);
|
);
|
||||||
|
if(! $x) {
|
||||||
|
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
||||||
|
dbesc(str_replace('acct:','',$id)),
|
||||||
|
dbesc($id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if($x && $x[0]['xchan_pubkey']) {
|
if($x && $x[0]['xchan_pubkey']) {
|
||||||
return [ 'portable_id' => $x[0]['xchan_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
|
return [ 'portable_id' => $x[0]['hubloc_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = ActivityStreams::fetch_property($id);
|
$r = ActivityStreams::fetch_property($id);
|
||||||
@ -235,19 +240,25 @@ class HTTPSig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_webfinger_key($id) {
|
function get_webfinger_key($id) {
|
||||||
|
|
||||||
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
$x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
||||||
dbesc(str_replace('acct:','',$id)),
|
dbesc(str_replace('acct:','',$id)),
|
||||||
dbesc($id)
|
dbesc($id)
|
||||||
);
|
);
|
||||||
|
if(! $x) {
|
||||||
|
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
||||||
|
dbesc(str_replace('acct:','',$id)),
|
||||||
|
dbesc($id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if($x && $x[0]['xchan_pubkey']) {
|
if($x && $x[0]['xchan_pubkey']) {
|
||||||
return [ 'portable_id' => $x[0]['xchan_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
|
return [ 'portable_id' => $x[0]['hubloc_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
$wf = Webfinger::exec($id);
|
$wf = Webfinger::exec($id);
|
||||||
@ -269,18 +280,26 @@ class HTTPSig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (($key['public_key']) ? $key : false);
|
return (($key['public_key']) ? $key : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_zotfinger_key($id) {
|
function get_zotfinger_key($id) {
|
||||||
|
|
||||||
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
$x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
||||||
dbesc(str_replace('acct:','',$id)),
|
dbesc(str_replace('acct:','',$id)),
|
||||||
dbesc($id)
|
dbesc($id)
|
||||||
);
|
);
|
||||||
|
if(! $x) {
|
||||||
|
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
|
||||||
|
dbesc(str_replace('acct:','',$id)),
|
||||||
|
dbesc($id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if($x && $x[0]['xchan_pubkey']) {
|
if($x && $x[0]['xchan_pubkey']) {
|
||||||
return [ 'portable_id' => $x[0]['xchan_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
|
return [ 'portable_id' => $x[0]['hubloc_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
$wf = Webfinger::exec($id);
|
$wf = Webfinger::exec($id);
|
||||||
@ -302,9 +321,14 @@ class HTTPSig {
|
|||||||
if($i['success']) {
|
if($i['success']) {
|
||||||
$key['portable_id'] = $i['hash'];
|
$key['portable_id'] = $i['hash'];
|
||||||
|
|
||||||
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' limit 1",
|
$x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_id_url = '%s' limit 1",
|
||||||
dbesc($l['href'])
|
dbesc($l['href'])
|
||||||
);
|
);
|
||||||
|
if(! $x) {
|
||||||
|
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' limit 1",
|
||||||
|
dbesc($l['href'])
|
||||||
|
);
|
||||||
|
}
|
||||||
if($x) {
|
if($x) {
|
||||||
$key['hubloc'] = $x[0];
|
$key['hubloc'] = $x[0];
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,8 @@ class Zot6Handler implements IHandler {
|
|||||||
foreach ($recipients as $recip) {
|
foreach ($recipients as $recip) {
|
||||||
|
|
||||||
$r = q("select channel.*,xchan.* from channel
|
$r = q("select channel.*,xchan.* from channel
|
||||||
left join xchan on channel_hash = xchan_hash
|
left join xchan on channel_portable_id = xchan_portable_id
|
||||||
where xchan_hash ='%s' limit 1",
|
where xchan_portable_id ='%s' limit 1",
|
||||||
dbesc($recip)
|
dbesc($recip)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class Zot6Handler implements IHandler {
|
|||||||
|
|
||||||
$arr = $data['recipients'][0];
|
$arr = $data['recipients'][0];
|
||||||
|
|
||||||
$c = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_hash = '%s' limit 1",
|
$c = q("select * from channel left join xchan on channel_portable_id = xchan_portable_id where channel_portable_id = '%s' limit 1",
|
||||||
dbesc($arr['portable_id'])
|
dbesc($arr['portable_id'])
|
||||||
);
|
);
|
||||||
if (! $c) {
|
if (! $c) {
|
||||||
@ -197,7 +197,7 @@ class Zot6Handler implements IHandler {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
|
$r = q("select * from xchan where xchan_hash = '%s' or xchan_portable_id = '%s' limit 1",
|
||||||
dbesc($sender)
|
dbesc($sender)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -231,14 +231,15 @@ class Zot6Handler implements IHandler {
|
|||||||
// basically this means "unfriend"
|
// basically this means "unfriend"
|
||||||
foreach ($recipients as $recip) {
|
foreach ($recipients as $recip) {
|
||||||
$r = q("select channel.*,xchan.* from channel
|
$r = q("select channel.*,xchan.* from channel
|
||||||
left join xchan on channel_hash = xchan_hash
|
left join xchan on channel_portable_id = xchan_portable_id
|
||||||
where channel_hash = '%s' and channel_guid_sig = '%s' limit 1",
|
where channel_portable_id = '%s' limit 1",
|
||||||
dbesc($recip)
|
dbesc($recip)
|
||||||
);
|
);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$r = q("select abook_id from abook where uid = %d and abook_xchan = '%s' limit 1",
|
$r = q("select abook_id from abook where uid = %d and (abook_xchan = '%s' or abook_xchan = '%s') limit 1",
|
||||||
intval($r[0]['channel_id']),
|
intval($r[0]['channel_id']),
|
||||||
dbesc($sender)
|
dbesc($sender),
|
||||||
|
dbesc($r[0]['xchan_portable_id'])
|
||||||
);
|
);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
contact_remove($r[0]['channel_id'],$r[0]['abook_id']);
|
contact_remove($r[0]['channel_id'],$r[0]['abook_id']);
|
||||||
|
Reference in New Issue
Block a user