- function filterAttention($attn)
- {
- $groups = array();
- $replies = array();
-
- foreach (array_unique($attn) as $recipient) {
-
- // Is the recipient a local user?
-
- $user = User::staticGet('uri', $recipient);
-
- if ($user) {
- // @fixme sender verification, spam etc?
- $replies[] = $recipient;
- continue;
- }
-
- // Is the recipient a remote group?
- $oprofile = Ostatus_profile::ensureProfileURI($recipient);
-
- if ($oprofile) {
- if (!$oprofile->isGroup()) {
- // may be canonicalized or something
- $replies[] = $oprofile->uri;
- }
- continue;
- }
-
- // Is the recipient a local group?
- // @fixme uri on user_group isn't reliable yet
- // $group = User_group::staticGet('uri', $recipient);
- $id = OStatusPlugin::localGroupFromUrl($recipient);
-
- if ($id) {
- $group = User_group::staticGet('id', $id);
- if ($group) {
- // Deliver to all members of this local group if allowed.
- $profile = $sender->localProfile();
- if ($profile->isMember($group)) {
- $groups[] = $group->id;
- } else {
- common_log(LOG_INFO, "Skipping reply to local group {$group->nickname} as sender {$profile->id} is not a member");
- }
- continue;
- } else {
- common_log(LOG_INFO, "Skipping reply to bogus group $recipient");
- }
- }
- }
-
- return array($groups, $replies);
- }
-
- function userFromSubject($subject)