forked from GNUsocial/gnu-social
Correctly distribute notices from remote posters through local groups to remote group-members via OStatus.
Allow the OStatus queue-handler to handle all posts, and give it the smarts required to make correct decisions about whether it should or shouldn't relay notices over OStatus. cf. http://status.net/open-source/issues/3540 Conflicts (staticGet => getKV): plugins/OStatus/lib/ostatusqueuehandler.php
This commit is contained in:
parent
8e53eb2b4c
commit
44f7ad612a
@ -125,7 +125,6 @@ class OStatusPlugin extends Plugin
|
||||
*/
|
||||
function onStartEnqueueNotice($notice, &$transports)
|
||||
{
|
||||
if ($notice->isLocal()) {
|
||||
if ($notice->inScope(null)) {
|
||||
// put our transport first, in case there's any conflict (like OMB)
|
||||
array_unshift($transports, 'ostatus');
|
||||
@ -135,9 +134,6 @@ class OStatusPlugin extends Plugin
|
||||
// once that happens, finer grain of control here.
|
||||
$this->log(LOG_NOTICE, "Not queueing notice {$notice->id} for OStatus because of privacy; scope = {$notice->scope}");
|
||||
}
|
||||
} else {
|
||||
$this->log(LOG_NOTICE, "Not queueing notice {$notice->id} for OStatus because it's not local.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -60,17 +60,29 @@ class OStatusQueueHandler extends QueueHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($notice->isLocal()) {
|
||||
// Notices generated on remote sites will have already
|
||||
// been pushed to user's subscribers by their origin sites.
|
||||
$this->pushUser();
|
||||
}
|
||||
|
||||
foreach ($notice->getGroups() as $group) {
|
||||
$oprofile = Ostatus_profile::getKV('group_id', $group->id);
|
||||
if ($oprofile) {
|
||||
// remote group
|
||||
if ($notice->isLocal()) {
|
||||
$this->pingReply($oprofile);
|
||||
}
|
||||
} else {
|
||||
// local group
|
||||
$this->pushGroup($group->id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($notice->isLocal()) {
|
||||
// Notices generated on other sites will have already
|
||||
// pinged their reply-targets.
|
||||
|
||||
foreach ($notice->getReplies() as $profile_id) {
|
||||
$oprofile = Ostatus_profile::getKV('profile_id', $profile_id);
|
||||
if ($oprofile) {
|
||||
@ -96,6 +108,7 @@ class OStatusQueueHandler extends QueueHandler
|
||||
$this->pushPeopletag($ptag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user