aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinclude/items.php5
-rw-r--r--include/onepoll.php9
-rw-r--r--include/poller.php3
-rw-r--r--include/zot.php14
-rw-r--r--mod/connections.php3
-rw-r--r--mod/follow.php2
-rw-r--r--mod/zotfeed.php4
7 files changed, 34 insertions, 6 deletions
diff --git a/include/items.php b/include/items.php
index 520ea7230..5793a7d66 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3757,6 +3757,7 @@ function fetch_post_tags($items,$link = false) {
function zot_feed($uid,$observer_xchan,$mindate) {
+
$result = array();
$mindate = datetime_convert('UTC','UTC',$mindate);
if(! $mindate)
@@ -3764,10 +3765,14 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$mindate = dbesc($mindate);
+ logger('zot_feed: ' . $uid);
+
if(! perm_is_allowed($uid,$observer_xchan,'view_stream')) {
+ logger('zot_feed: permission denied.');
return $result;
}
+ require_once('include/security.php');
$sql_extra = item_permissions_sql($uid);
if($mindate != '0000-00-00 00:00:00') {
diff --git a/include/onepoll.php b/include/onepoll.php
index 50c2566be..5e5589228 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -98,8 +98,11 @@ function onepoll_run($argv, $argc){
return;
if($contact['xchan_connurl']) {
- $feedurl = str_replace('/poco/','/zotfeed/',$channel['xchan_connurl']);
- $x = z_fetch_url($feedurl . '?f=&mindate=' . $last_update);
+ $feedurl = str_replace('/poco/','/zotfeed/',$contact['xchan_connurl']);
+ $x = z_fetch_url($feedurl . '?f=&mindate=' . urlencode($last_update));
+
+ logger('feed_update: ' . print_r($x,true), LOGGER_DATA);
+
if($x['success']) {
$total = 0;
logger('onepoll: feed update ' . $contact['xchan_name']);
@@ -107,7 +110,7 @@ function onepoll_run($argv, $argc){
$j = json_decode($x['body'],true);
if($j['success'] && $j['messages']) {
foreach($j['messages'] as $message) {
- $results = process_delivery(array('hash' => $contact['xchan_hash']),$message,
+ $results = process_delivery(array('hash' => $contact['xchan_hash']), get_item_elements($message),
array(array('hash' => $importer['xchan_hash'])), false);
$total ++;
}
diff --git a/include/poller.php b/include/poller.php
index 3c4e6402c..0dcec4c0f 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -117,7 +117,10 @@ function poller_run($argv, $argc){
set_config('system','last_expire_day',$d2);
+
// Uncomment when expire protocol component is working
+// Update - this is not going to happen. We are only going to
+// implement per-item expire, not blanket expiration
// proc_run('php','include/expire.php');
proc_run('php','include/cli_suggest.php');
diff --git a/include/zot.php b/include/zot.php
index 09a3c28fa..71f720a6d 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -306,6 +306,11 @@ function zot_refresh($them,$channel = null) {
);
if(! $y)
logger('abook update failed');
+ else {
+ // if we were just granted read stream permission and didn't have it before, try to pull in some posts
+ if((! ($r[0]['abook_their_perms'] & PERMS_R_STREAM)) && ($their_perms & PERMS_R_STREAM))
+ proc_run('php','include/onepoll.php',$r[0]['abook_id']);
+ }
}
else {
$default_perms = 0;
@@ -330,7 +335,6 @@ function zot_refresh($them,$channel = null) {
);
if($y) {
-
logger("New introduction received for {$channel['channel_name']}");
if($default_perms) {
// send back a permissions update for auto-friend/auto-permissions
@@ -342,6 +346,14 @@ function zot_refresh($them,$channel = null) {
if($z)
proc_run('php','include/notifier.php','permission_update',$z[0]['abook_id']);
}
+ $new_connection = q("select abook_id from abook where abook_channel = %d and abook_xchan = '%s' order by abook_created desc limit 1",
+ intval($channel['channel_id']),
+ dbesc($x['hash'])
+ );
+
+ if($new_connection && ($their_perms & PERMS_R_STREAM))
+ proc_run('php','include/onepoll.php',$new_connection[0]['abook_id']);
+
}
}
}
diff --git a/mod/connections.php b/mod/connections.php
index 1ad9fedbc..a40a8fa90 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -133,6 +133,9 @@ function connections_post(&$a) {
// friends in general or this friend in particular aren't hidden)
// and send out a new friend activity
// TODO
+
+ // pull in a bit of content if there is any to pull in
+ proc_run('php','include/onepoll.php',$contact_id);
}
// Refresh the structure in memory with the new data
diff --git a/mod/follow.php b/mod/follow.php
index 9f5a8183b..1d29dab2e 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -15,7 +15,7 @@ function follow_init(&$a) {
$confirm = intval($_REQUEST['confirm']);
$result = new_contact($uid,$url,$a->get_channel(),true,$confirm);
-
+
if($result['success'] == false) {
if($result['message'])
notice($result['message']);
diff --git a/mod/zotfeed.php b/mod/zotfeed.php
index 2ca049563..6d84a5a1e 100644
--- a/mod/zotfeed.php
+++ b/mod/zotfeed.php
@@ -21,7 +21,7 @@ function zotfeed_init(&$a) {
$channel_address = ((argc() > 1) ? argv(1) : '');
if($channel_address) {
- $r = q("select channel_id from channel where channel_address = '%s' limit 1",
+ $r = q("select channel_id, channel_name from channel where channel_address = '%s' limit 1",
dbesc(argv(1))
);
}
@@ -30,6 +30,8 @@ function zotfeed_init(&$a) {
json_return_and_die($result);
}
+ logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
+
$result['messages'] = zot_feed($r[0]['channel_id'],$observer['xchan_hash'],$mindate);
$result['success'] = true;
json_return_and_die($result);