]> git.mxchange.org Git - friendica.git/commitdiff
trialing pubsubhubbub - operational tweaks
authorMike Macgirvin <mike@macgirvin.com>
Fri, 1 Oct 2010 09:28:06 +0000 (02:28 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Fri, 1 Oct 2010 09:28:06 +0000 (02:28 -0700)
include/items.php
include/notifier.php
mod/contacts.php
mod/pubsub.php
view/contact_edit.tpl

index 2c4b7701476a47155ab88f99a96e66fb1f64527c..221a8a65c24e646122e4c9b5e95c533d18a114f9 100644 (file)
@@ -153,10 +153,12 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
                // public feeds get html, our own nodes use bbcode
 
                if($dfrn_id === '*') {
+                       $allow = (($item['last-child']) ? 1 : 0);
                        $item['body'] = bbcode($item['body']);
                        $type = 'html';
                }
                else {
+                       $allow = ((($item['last-child']) && ($contact['rel']) && ($contact['rel'] != REL_FAN)) ? 1 : 0);
                        $type = 'text';
                }
 
@@ -188,7 +190,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
                                        '$content'            => xmlify($item['body']),
                                        '$verb'               => xmlify($verb),
                                        '$actobj'             => $actobj,  // do not xmlify
-                                       '$comment_allow'      => ((($item['last-child']) && ($contact['rel']) && ($contact['rel'] != REL_FAN)) ? 1 : 0)
+                                       '$comment_allow'      => $allow
                                ));
                        }
                        else {
@@ -206,7 +208,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
                                        '$verb'          => xmlify($verb),
                                        '$actobj'        => $actobj, // do not xmlify
                                        '$parent_id'     => xmlify($item['parent-uri']),
-                                       '$comment_allow' => (($item['last-child']) ? 1 : 0)
+                                       '$comment_allow' => $allow
                                ));
                        }
                }
index ee2b22ca3978455372f2eba0734885ff92fd015c..0166d0b372a38b22a2d859ded7a86128ccd2b1f9 100644 (file)
                }
        }
 
-       if((strlen($hub)) && ($cmd !== 'mail') && (followup == false)) {
+       if((strlen($hub)) && ($cmd !== 'mail') && ($followup == false)) {
                $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
                post_url($hub,$params);
        }
index 438b37aaf3714aca340e01cc37ee001bbec80c14..8c244697916c54c0413c978259c72429d9c77cf6 100644 (file)
@@ -41,7 +41,15 @@ function contacts_post(&$a) {
                        return;
                }
        }
+
+       $usehub = ((intval($_POST['usehub'])) ? 1 : 0);
+       if($orig_record[0]['usehub'] && (! $usehub)) {
+               // remove hub subscription
+       }
+
        $priority = intval($_POST['priority']);
+       if($priority == (-1))
+               
        if($priority > 5 || $priority < 0)
                $priority = 0;
 
@@ -51,9 +59,10 @@ function contacts_post(&$a) {
 
        $reason = notags(trim($_POST['reason']));
 
-       $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s'
+       $r = q("UPDATE `contact` SET `profile-id` = %d, `usehub` = %d, `priority` = %d , `rating` = %d, `reason` = '%s'
                WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($profile_id),
+               intval($usehub),
                intval($priority),
                intval($rating),
                dbesc($reason),
@@ -176,8 +185,19 @@ function contacts_content(&$a) {
                        $url = $r[0]['url'];
                        $sparkle = '';
                }
+
+               $huburl = get_config('system','huburl');
+               if($huburl) {
+                       // finish selector
+                       $hubenable = '';
+               }
+               else
+                       $hubenable = '';
+
+
                $o .= replace_macros($tpl,array(
                        '$poll_interval' => contact_poll_interval($r[0]['priority']),
+                       '$hubenable' => $hubenable,
                        '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00') 
                                ? t('Never') 
                                : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')),
index fa092049f41295511c69055d644297158fce25de..1feb80031028ba37a91a6d1b6ff53d73c564bb55 100644 (file)
@@ -33,11 +33,13 @@ function pubsub_init(&$a) {
 
        if($_SERVER['REQUEST_METHOD'] === 'GET') {
 
-               $hub_mode = notags(trim($_GET['hub.mode']));
-               $hub_topic = notags(trim($_GET['hub.topic']));
-               $hub_challenge = notags(trim($_GET['hub.challenge']));
-               $hub_lease = notags(trim($_GET['hub.lease_seconds']));
-               $hub_verify = notags(trim($_GET['hub.verify_token']));
+               $hub_mode = notags(trim($_GET['hub_mode']));
+               $hub_topic = notags(trim($_GET['hub_topic']));
+               $hub_challenge = notags(trim($_GET['hub_challenge']));
+               $hub_lease = notags(trim($_GET['hub_lease_seconds']));
+               $hub_verify = notags(trim($_GET['hub_verify_token']));
+
+
 
                $subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
 
@@ -47,6 +49,7 @@ function pubsub_init(&$a) {
                if(! count($r))
                        hub_return(false, '');
 
+
                $owner = $r[0];
 
                $sql_extra = ((strlen($hub_verify)) ? sprintf(" AND `hub-verify` = '%s' ", dbesc($hub_verify)) : '');
@@ -82,6 +85,10 @@ function pubsub_post(&$a) {
 
        $xml = file_get_contents('php://input');
 
+       $debugging = get_config('system','debugging');
+       if($debugging)
+               file_put_contents('pubsub.out',$xml);
+
        $nick       = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
        $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
 
@@ -103,6 +110,9 @@ function pubsub_post(&$a) {
        $contact = $r[0];
 
        $feedhub = '';
+
+       require_once('include/items.php');
+
        consume_feed($xml,$importer,$contact,$feedhub);
 
        hub_post_return();
index acea1da4e93d4e361fa4f20e54248dfed5907578..0771849de6a51fcd06b90aa381ac2604491e8a5a 100644 (file)
@@ -27,6 +27,7 @@
                        <div id="contact-edit-last-update-text">Last updated: <span id="contact-edit-last-updated">$last_update</span</div>
                        <div id="contact-edit-poll-text">Update public posts: </div>
                        $poll_interval
+                       $hubenable
                </div>
        </div>
        <div id="contact-edit-end" ></div>