aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-04-07 02:55:00 -0700
committerfriendica <info@friendica.com>2014-04-07 02:55:00 -0700
commit10167fdf515e69c4645da9b0a020d0594c7a55a3 (patch)
treea07c2394b9aa0ed8fc017a9af4c976ec10e5c70e
parent7d429b28940848cbf0cdf397ed664a594b28d994 (diff)
downloadvolse-hubzilla-10167fdf515e69c4645da9b0a020d0594c7a55a3.tar.gz
volse-hubzilla-10167fdf515e69c4645da9b0a020d0594c7a55a3.tar.bz2
volse-hubzilla-10167fdf515e69c4645da9b0a020d0594c7a55a3.zip
prevent follows of and notifications to deceased channels
-rw-r--r--include/enotify.php5
-rw-r--r--include/follow.php6
-rw-r--r--include/zot.php9
-rw-r--r--mod/zfinger.php6
-rw-r--r--version.inc2
5 files changed, 23 insertions, 5 deletions
diff --git a/include/enotify.php b/include/enotify.php
index 5be21f180..7ab4fe5ed 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -18,8 +18,9 @@ function notification($params) {
}
if($params['to_xchan']) {
$y = q("select channel.*, account.* from channel left join account on channel_account_id = account_id
- where channel_hash = '%s' limit 1",
- dbesc($params['to_xchan'])
+ where channel_hash = '%s' and not (channel_pageflags & %d) limit 1",
+ dbesc($params['to_xchan']),
+ intval(PAGE_REMOVED)
);
}
if($x & $y) {
diff --git a/include/follow.php b/include/follow.php
index 0508a8b37..d98a58198 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -75,11 +75,17 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
return $result;
}
+
// do we have an xchan and hubloc?
// If not, create them.
$x = import_xchan($j);
+ if(array_key_exists('deleted',$j) && intval($j['deleted'])) {
+ $result['message'] = t('Channel was deleted and no longer exists.');
+ return $result;
+ }
+
if(! $x['success'])
return $x;
diff --git a/include/zot.php b/include/zot.php
index 48240d5aa..45df09661 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -632,6 +632,13 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
if($adult_changed)
$new_flags = $new_flags ^ XCHAN_FLAGS_SELFCENSORED;
+ $deleted = (($r[0]['xchan_flags'] & XCHAN_FLAGS_DELETED) ? true : false);
+ $deleted_changed = ((intval($deleted) != intval($arr['deleted'])) ? true : false);
+ if($deleted_changed)
+ $new_flags = $new_flags ^ XCHAN_FLAGS_DELETED;
+
+
+
if(($r[0]['xchan_name_date'] != $arr['name_updated'])
|| ($r[0]['xchan_connurl'] != $arr['connections_url'])
@@ -676,6 +683,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
$new_flags = 0;
if($arr['adult_content'])
$new_flags |= XCHAN_FLAGS_SELFCENSORED;
+ if($arr['deleted'])
+ $new_flags |= XCHAN_FLAGS_DELETED;
$x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype,
xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags)
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 4f59c1973..f2d46bff8 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -97,7 +97,9 @@ function zfinger_init(&$a) {
$special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false);
$adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false);
$searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true);
- if($e['xchan_flags'] & XCHAN_FLAGS_HIDDEN)
+ $deleted = (($e['channel_pageflags'] & PAGE_REMOVED) ? true : false);
+
+ if(($e['xchan_flags'] & XCHAN_FLAGS_HIDDEN) || $deleted)
$searchable = false;
// This is for birthdays and keywords, but must check access permissions
@@ -164,7 +166,7 @@ function zfinger_init(&$a) {
$ret['target_sig'] = $zsig;
$ret['searchable'] = $searchable;
$ret['adult_content'] = $adult_channel;
-
+ $ret['deleted'] = $deleted;
// premium or other channel desiring some contact with potential followers before connecting.
// This is a template - %s will be replaced with the follow_url we discover for the return channel.
diff --git a/version.inc b/version.inc
index e2e021e8b..a56d3029d 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-04-06.639
+2014-04-07.640