aboutsummaryrefslogtreecommitdiffstats
path: root/include/diaspora.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-07-22 18:57:48 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-07-22 19:02:45 -0700
commitc0e67db070ae562f8e717a12faf5df9ecd7160d6 (patch)
tree59d401819fb12ec5e14257ba3df4851d22aa0b8c /include/diaspora.php
parentc90f14c066d0f289bd2220bb66325db12700aa57 (diff)
downloadvolse-hubzilla-c0e67db070ae562f8e717a12faf5df9ecd7160d6.tar.gz
volse-hubzilla-c0e67db070ae562f8e717a12faf5df9ecd7160d6.tar.bz2
volse-hubzilla-c0e67db070ae562f8e717a12faf5df9ecd7160d6.zip
refresh diaspora xchan every month or so since receiving profile update messages from that network reliably are just as unlikely as receiving any other kind of message from that network reliably. The problem is that if somebody changes their profile name or photo once every few years and you miss it because of their shitty unreliable communications, your data could be stale for a long time.
Diffstat (limited to 'include/diaspora.php')
-rwxr-xr-xinclude/diaspora.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index d59da6fff..187793d2b 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -329,6 +329,7 @@ function diaspora_get_contact_by_handle($uid,$handle) {
function find_diaspora_person_by_handle($handle) {
$person = false;
+ $refresh = false;
if(diaspora_is_blacklisted($handle))
return false;
@@ -339,9 +340,13 @@ function find_diaspora_person_by_handle($handle) {
if($r) {
$person = $r[0];
logger('find_diaspora_person_by handle: in cache ' . print_r($r,true), LOGGER_DATA);
+ if($person['xchan_name_date'] < datetime_convert('UTC','UTC', 'now - 1 month')) {
+ logger('Updating Diaspora cached record for ' . $handle);
+ $refresh = true;
+ }
}
- if(! $person) {
+ if((! $person) || ($refresh)) {
// try webfinger. Make sure to distinguish between diaspora,
// hubzilla w/diaspora protocol and friendica w/diaspora protocol.
@@ -349,7 +354,7 @@ function find_diaspora_person_by_handle($handle) {
$result = discover_by_webbie($handle);
if($result) {
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
- dbesc($handle)
+ dbesc(str_replace('acct:','',$handle))
);
if($r) {
$person = $r[0];
@@ -1003,6 +1008,11 @@ function diaspora_post($importer,$xml,$msg) {
return 202;
}
+ if(! is_importable($datarray,$contact)) {
+ logger('diaspora_post: filtering this author.');
+ return 202;
+ }
+
$result = item_store($datarray);
return;