From bfd3da43ac9226e53188a03ff1414a18422e91b4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 17 Dec 2021 19:48:09 +0100 Subject: access token refactor --- include/connections.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/connections.php') diff --git a/include/connections.php b/include/connections.php index 11264e6d8..fbbf59c72 100644 --- a/include/connections.php +++ b/include/connections.php @@ -376,6 +376,19 @@ function contact_remove($channel_id, $abook_id) { if(intval($abook['abook_self'])) return false; + // if this is an atoken, delete the atoken record + + $xchan = q("select * from xchan where xchan_hash = '%s'", + dbesc($abook['abook_xchan']) + ); + + if (strpos($xchan['xchan_addr'],'guest:') === 0 && strpos($abook['abook_xchan'],'.')){ + $atoken_guid = substr($abook['abook_xchan'],strrpos($abook['abook_xchan'],'.') + 1); + if ($atoken_guid) { + atoken_delete_and_sync($channel_id,$atoken_guid); + } + } + $r = q("select id, parent from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d and item_retained = 0 and item_starred = 0", dbesc($abook['abook_xchan']), dbesc($abook['abook_xchan']), -- cgit v1.2.3