Merge pull request #1632 from annando/1505-ostatus2

Send a hubsub notification for every comment
This commit is contained in:
fabrixxm 2015-06-01 09:00:17 +02:00
commit 46052740be
3 changed files with 13 additions and 4 deletions

View File

@ -118,7 +118,8 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0,
// Include answers to status.net posts in pubsub feeds // Include answers to status.net posts in pubsub feeds
if($forpubsub) { if($forpubsub) {
$sql_post_table = "INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent` "; $sql_post_table = "INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent` ";
$visibility = "OR (`item`.`network` = 'dfrn' AND `thread`.`network`='stat')"; $visibility = sprintf("OR (`item`.`network` = '%s' AND `thread`.`network`='%s')",
dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS));
$date_field = "`received`"; $date_field = "`received`";
$sql_order = "`item`.`received` DESC"; $sql_order = "`item`.`received` DESC";
} else { } else {

View File

@ -295,13 +295,18 @@ function notifier_run(&$argv, &$argc){
$conversant_str = dbesc($parent['contact-id']); $conversant_str = dbesc($parent['contact-id']);
$recipients = array($parent['contact-id']); $recipients = array($parent['contact-id']);
if (!$item['private'] AND $item['wall'] AND
(strlen($item['allow_cid'].$item['allow_gid'].
$item['deny_cid'].$item['deny_gid']) == 0))
$push_notify = true;
if ($parent['network'] == NETWORK_OSTATUS) { if ($parent['network'] == NETWORK_OSTATUS) {
logger('Parent is OStatus', LOGGER_DEBUG); logger('Parent is OStatus', LOGGER_DEBUG);
$push_notify = true; $push_notify = true;
// Check if the recipient isn't in your contact list, try to slap it // Check if the recipient isn't in your contact list, try to slap it
// This doesn't seem to work correctly by now // Not sure if it is working or not.
$r = q("SELECT `url` FROM `contact` WHERE `id` = %d", $parent['contact-id']); $r = q("SELECT `url` FROM `contact` WHERE `id` = %d", $parent['contact-id']);
if (count($r)) { if (count($r)) {
$url_recipients = array(); $url_recipients = array();

View File

@ -14,8 +14,11 @@ function follow_content(&$a) {
$uid = local_user(); $uid = local_user();
$url = notags(trim($_REQUEST['url'])); $url = notags(trim($_REQUEST['url']));
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND (`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') LIMIT 1", $r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND
intval(local_user()), dbesc(normalise_link($url)), dbesc(normalise_link($url)), dbesc($url)); (`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') AND
`network` != '%s' LIMIT 1",
intval(local_user()), dbesc(normalise_link($url)),
dbesc(normalise_link($url)), dbesc($url), dbesc(NETWORK_STATUSNET));
if ($r) { if ($r) {
notice(t('You already added this contact.').EOL); notice(t('You already added this contact.').EOL);