aboutsummaryrefslogtreecommitdiffstats
path: root/doc/hook/collect_public_recipients.bb
blob: de3f4049e05b6c8ef4c38b4869e54258ef3c8e87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[h2]collect_public_recipients[/h2]

Replace the default list of public recipients (i.e., all contacts).

Allow plugins to create a list of recipients for public messages instead of the default
of all channel connections.

Called with the following array:
                       [
                                'recipients' => [], 
                                'item' => $item, 
                                'private_envelope' => $private_envelope, 
                                'include_groups' => $include_groups
                        ];

[code]
                if(array_key_exists('public_policy',$item) && $item['public_policy'] !== 'self') {

                        $hookinfo = [
                                'recipients' => [], 
                                'item' => $item, 
                                'private_envelope' => $private_envelope, 
                                'include_groups' => $include_groups
                        ];

                        call_hooks('collect_public_recipients',$hookinfo);

                        if ($hookinfo['recipients']) {
                                $r = $hookinfo['recipients'];
                        } else {
                                $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ",
                                intval($item['uid'])
                                );
                        }

                        if($r) {

			. . .

[/code]

see: include/item.php