aboutsummaryrefslogtreecommitdiffstats
path: root/include/notifier.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/notifier.php')
-rw-r--r--include/notifier.php77
1 files changed, 60 insertions, 17 deletions
diff --git a/include/notifier.php b/include/notifier.php
index 180a538bc..0a5cf3f4c 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -103,28 +103,33 @@ function notifier_run($argv, $argc){
);
if($r) {
// Get the sender
- $s = q("select * from channel where channel_id = %d limit 1",
+ $s = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
intval($r[0]['abook_channel'])
);
if($s) {
-
- // send a refresh message to each hub they have registered here
- $h = q("select * from hubloc where hubloc_hash = '%s'",
- dbesc($r[0]['hubloc_hash'])
- );
- if($h) {
- foreach($h as $hh) {
- $data = zot_build_packet($s[0],'refresh',array(array(
- 'guid' => $hh['hubloc_guid'],
- 'guid_sig' => $hh['hubloc_guid_sig'],
- 'url' => $hh['hubloc_url'])
- ));
- if($data) {
- $result = zot_zot($hh['hubloc_callback'],$data);
+ if($r[0]['hubloc_network'] === 'diaspora' || $r[0]['hubloc_network'] === 'friendica_over_diaspora') {
+ require_once('include/diaspora.php');
+ diaspora_share($s[0],$r[0]);
+ }
+ else {
+ // send a refresh message to each hub they have registered here
+ $h = q("select * from hubloc where hubloc_hash = '%s'",
+ dbesc($r[0]['hubloc_hash'])
+ );
+ if($h) {
+ foreach($h as $hh) {
+ $data = zot_build_packet($s[0],'refresh',array(array(
+ 'guid' => $hh['hubloc_guid'],
+ 'guid_sig' => $hh['hubloc_guid_sig'],
+ 'url' => $hh['hubloc_url'])
+ ));
+ if($data) {
+ $result = zot_zot($hh['hubloc_callback'],$data);
// zot_queue_item is not yet written
// if(! $result['success'])
// zot_queue_item();
+ }
}
}
}
@@ -366,6 +371,8 @@ function notifier_run($argv, $argc){
}
+ $walltowall = (($top_level_post && $channel['xchan_hash'] === $target_item['author_xchan']) ? true : false);
+
// Generic delivery section, we have an encoded item and recipients
// Now start the delivery process
@@ -438,11 +445,11 @@ function notifier_run($argv, $argc){
// aren't the owner or author.
- $r = q("select hubloc_sitekey, hubloc_flags, hubloc_callback, hubloc_host from hubloc
+ $r = q("select hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc
where hubloc_hash in (" . implode(',',$recipients) . ") group by hubloc_sitekey order by hubloc_connected desc limit 1");
}
else {
- $r = q("select hubloc_sitekey, hubloc_flags, hubloc_callback, hubloc_host from hubloc
+ $r = q("select hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc
where hubloc_hash in (" . implode(',',$recipients) . ") $sql_extra group by hubloc_sitekey");
}
@@ -485,6 +492,42 @@ function notifier_run($argv, $argc){
}
}
+
+ if($hub['network'] === 'diaspora' || $hub['network'] === 'friendica-over-diaspora') {
+ if(! get_config('system','diaspora_enabled'))
+ continue;
+
+ require_once('include/diaspora.php');
+
+ diaspora_process_outbound(array(
+ 'channel' => $channel,
+ 'env_recips' => $env_recips,
+ 'recipients' => $recipients,
+ 'item' => $item,
+ 'target_item' => $target_item,
+ 'hub' => $hub,
+ 'top_level_post' => $top_level_post,
+ 'private' => $private,
+ 'followup' => $followup,
+ 'relay_to_owner' => $relay_to_owner,
+ 'uplink' => $uplink,
+ 'cmd' => $cmd,
+ 'expire' => $expire,
+ 'mail' => $mail,
+ 'fsuggest' => $fsuggest,
+ 'normal_mode' => $normal_mode,
+ 'packet_type' => $packet_type,
+ 'walltowall' => $walltowall
+ ));
+
+ continue;
+
+ }
+
+
+ // default: zot protocol
+
+
$hash = random_string();
if($packet_type === 'refresh' || $packet_type === 'purge') {
$n = zot_build_packet($channel,$packet_type);