aboutsummaryrefslogtreecommitdiffstats
path: root/include/notifier.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2013-06-16 14:59:17 +0100
committerThomas Willingham <founder@kakste.com>2013-06-16 14:59:17 +0100
commit33696cc8392daeb08d011aa3b1209f3b121898ea (patch)
tree466d48f5abc1a4ec1dbf83543471a8ac89428516 /include/notifier.php
parent466a6d5227fbaf0a36cd76b5603cb42bb1b7462b (diff)
parentc4c80a2e472173dfed9b982c6705ccfbb6e6cdab (diff)
downloadvolse-hubzilla-33696cc8392daeb08d011aa3b1209f3b121898ea.tar.gz
volse-hubzilla-33696cc8392daeb08d011aa3b1209f3b121898ea.tar.bz2
volse-hubzilla-33696cc8392daeb08d011aa3b1209f3b121898ea.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/notifier.php')
-rw-r--r--include/notifier.php69
1 files changed, 57 insertions, 12 deletions
diff --git a/include/notifier.php b/include/notifier.php
index 159931124..7d107e4d4 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -53,6 +53,7 @@ require_once('include/html2plain.php');
*
* ZOT
* permission_update abook_id
+ * refresh_all channel_id
* relay item_id (item was relayed to owner, we will deliver it as owner)
*
*/
@@ -136,6 +137,7 @@ function notifier_run($argv, $argc){
$recipients = array();
$url_recipients = array();
$normal_mode = true;
+ $packet_type = 'undefined';
if($cmd === 'mail') {
$normal_mode = false;
@@ -186,6 +188,27 @@ function notifier_run($argv, $argc){
$recipients[] = $suggest[0]['cid'];
$item = $suggest[0];
}
+ elseif($cmd === 'refresh_all') {
+ $s = q("select * from channel where channel_id = %d limit 1",
+ intval($item_id)
+ );
+ if($s)
+ $channel = $s[0];
+ $uid = $item_id;
+ $recipients = array();
+ $r = q("select * from abook where abook_channel = %d and not (abook_flags & %d) and not (abook_flags & %d)",
+ intval($item_id),
+ intval(ABOOK_FLAG_SELF),
+ intval(ABOOK_FLAG_PENDING)
+ );
+ if($r) {
+ foreach($r as $rr) {
+ $recipients[] = $rr['abook_xchan'];
+ }
+ }
+ $private = false;
+ $packet_type = 'refresh';
+ }
else {
// Normal items
@@ -213,6 +236,12 @@ function notifier_run($argv, $argc){
return;
}
+ if($target_item['item_restrict'] & ITEM_WEBPAGE) {
+ logger('notifier: target item ITEM_WEBPAGE', LOGGER_DEBUG);
+ return;
+ }
+
+
$s = q("select * from channel where channel_id = %d limit 1",
intval($target_item['uid'])
);
@@ -346,18 +375,34 @@ function notifier_run($argv, $argc){
foreach($hubs as $hub) {
$hash = random_string();
- $n = zot_build_packet($channel,'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash);
- q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
- dbesc($hash),
- intval($target_item['aid']),
- intval($target_item['uid']),
- dbesc($hub['hubloc_callback']),
- intval(1),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($n),
- dbesc(json_encode($encoded_item))
- );
+ if($packet_type === 'refresh') {
+ $n = zot_build_packet($channel,'refresh');
+ q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
+ dbesc($hash),
+ intval($channel['channel_account']),
+ intval($channel['channel_id']),
+ dbesc($hub['hubloc_callback']),
+ intval(1),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc($n),
+ dbesc('')
+ );
+ }
+ else {
+ $n = zot_build_packet($channel,'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash);
+ q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
+ dbesc($hash),
+ intval($target_item['aid']),
+ intval($target_item['uid']),
+ dbesc($hub['hubloc_callback']),
+ intval(1),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc($n),
+ dbesc(json_encode($encoded_item))
+ );
+ }
$deliver[] = $hash;
if(count($deliver) >= $deliveries_per_process) {