aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-04 19:09:53 -0700
committerfriendica <info@friendica.com>2013-08-04 19:09:53 -0700
commitad36ccdbc802bbf4d8bcce8754ae3a1ca63bcbfc (patch)
tree367b489b582a4c512194733f83f642b801004f54 /mod
parent159a347c01c00c260a09b11fed76c02177ebe811 (diff)
downloadvolse-hubzilla-ad36ccdbc802bbf4d8bcce8754ae3a1ca63bcbfc.tar.gz
volse-hubzilla-ad36ccdbc802bbf4d8bcce8754ae3a1ca63bcbfc.tar.bz2
volse-hubzilla-ad36ccdbc802bbf4d8bcce8754ae3a1ca63bcbfc.zip
progress on unfriending
Diffstat (limited to 'mod')
-rw-r--r--mod/post.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/mod/post.php b/mod/post.php
index 5c636efa9..07f2cd083 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -309,17 +309,26 @@ function post_post(&$a) {
if(array_key_exists('recipients',$data))
$recipients = $data['recipients'];
-
if($msgtype === 'purge') {
if($recipients) {
// basically this means "unfriend"
foreach($recipients as $recip) {
-
-
-
+ $r = q("select channel.*,xchan.* from channel
+ left join xchan on channel_hash = xchan_hash
+ where channel_guid = '%s' and channel_guid_sig = '%s' limit 1",
+ dbesc($recip['guid']),
+ dbesc($recip['guid_sig'])
+ );
+ if($r) {
+ $r = q("select abook_id from abook where uid = %d and abook_xchan = '%s' limit 1",
+ intval($r[0]['channel_id']),
+ dbesc(base64url_encode(hash('whirlpool',$sender['guid'] . $sender['guid_sig'], true)))
+ );
+ if($r) {
+ contact_remove($r[0]['channel_id'],$r[0]['abook_id']);
+ }
+ }
}
-
-
}
else {
// Unfriend everybody - basically this means the channel has committed suicide