From 465ba71b584ad596729c23717226a9bdeb896553 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Thu, 30 Sep 2010 20:24:03 -0700 Subject: [PATCH] pubsubhubbub - discovery and notifier --- include/items.php | 5 +++++ include/notifier.php | 10 ++++++++++ mod/pubsub.php | 2 +- view/atom_feed.tpl | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/items.php b/include/items.php index 839baf4b6e..688ef244ab 100644 --- a/include/items.php +++ b/include/items.php @@ -123,11 +123,16 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { $atom = ''; + $hub = get_config('system','huburl'); + + $hubxml = ((strlen($hub)) ? '' . "\n" : ''); + $atom .= replace_macros($feed_template, array( '$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner_nick), '$feed_title' => xmlify($owner['name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) , + '$hub' => $hubxml, '$name' => xmlify($owner['name']), '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), diff --git a/include/notifier.php b/include/notifier.php index 967f4ff55b..c339d2fb38 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -83,6 +83,8 @@ else killme(); + $hub = get_config('system','huburl'); + if($cmd != 'mail') { require_once('include/group.php'); @@ -138,11 +140,14 @@ $atom = ''; + $hubxml = ((strlen($hub)) ? '' . "\n" : ''); + $atom .= replace_macros($feed_template, array( '$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname'] ), '$feed_title' => xmlify($owner['name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) , + '$hub' => $hubxml, '$name' => xmlify($owner['name']), '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), @@ -297,5 +302,10 @@ } } + if((strlen($hub)) && ($cmd !== 'mail') && (followup == false)) { + $params = array('hub.mode' => 'publish', 'hub.url' => $a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] ); + post_url($hub,$params); + } + killme(); diff --git a/mod/pubsub.php b/mod/pubsub.php index 3a3122d72a..65705069af 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -104,7 +104,7 @@ function pubsub_post(&$a) { consume_feed($xml,$importer,$contact); - hub_post_return();; + hub_post_return(); } diff --git a/view/atom_feed.tpl b/view/atom_feed.tpl index 56bd278ea8..893d42036f 100644 --- a/view/atom_feed.tpl +++ b/view/atom_feed.tpl @@ -10,6 +10,7 @@ $feed_title Mistpark + $hub $feed_updated