Add StartNoticeWhoGets, EndNoticeWhoGets events to allow upcoming TagSub plugin to do extra inbox delivery.

This commit is contained in:
Brion Vibber 2011-03-15 12:49:17 -07:00
parent 9e9cbdf505
commit b66250c6aa
2 changed files with 41 additions and 26 deletions

View File

@ -1131,3 +1131,11 @@ StartActivityObjectOutputJson: Called at start of JSON output generation for Act
EndActivityObjectOutputJson: Called at end of JSON output generation for ActivityObject chunks: the array has not yet been filled out.
- $obj ActivityObject
- &$out: array to be serialized; you're free to modify it
StartNoticeWhoGets: Called at start of inbox delivery prep; plugins can schedule notices to go to particular profiles that would otherwise not have reached them. Canceling will take over the entire addressing operation. Be aware that output can be cached or used several times, so should remain idempotent.
- $notice Notice
- &$ni: in/out array mapping profile IDs to constants: NOTICE_INBOX_SOURCE_SUB etc
EndNoticeWhoGets: Called at end of inbox delivery prep; plugins can filter out profiles from receiving inbox delivery here. Be aware that output can be cached or used several times, so should remain idempotent.
- $notice Notice
- &$ni: in/out array mapping profile IDs to constants: NOTICE_INBOX_SOURCE_SUB etc

View File

@ -812,6 +812,9 @@ class Notice extends Memcached_DataObject
$ni = array();
// Give plugins a chance to add folks in at start...
if (Event::handle('StartNoticeWhoGets', array($this, &$ni))) {
foreach ($users as $id) {
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
}
@ -849,6 +852,10 @@ class Notice extends Memcached_DataObject
}
}
// Give plugins a chance to filter out...
Event::handle('EndNoticeWhoGets', array($this, &$ni));
}
if (!empty($c)) {
// XXX: pack this data better
$c->set(Cache::key('notice:who_gets:'.$this->id), $ni);