+ function saveAttentions(array $uris)
+ {
+ foreach ($uris as $uri=>$type) {
+ try {
+ $target = Profile::fromUri($uri);
+ } catch (UnknownUriException $e) {
+ common_log(LOG_WARNING, "Unable to determine profile for URI '$uri'");
+ continue;
+ }
+
+ $this->saveAttention($target);
+ }
+ }
+
+ function saveAttention(Profile $target, $reason=null)
+ {
+ if ($target->isGroup()) {
+ // FIXME: Make sure we check that users are in the groups they send to!
+ } else {
+ if ($target->hasBlocked($this->getProfile())) {
+ common_log(LOG_INFO, "Not saving reply to profile {$target->id} ($uri) from sender {$sender->id} because of a block.");
+ return false;
+ }
+ }
+
+ if ($target->isLocal()) {
+ // is local user
+ $this->saveReply($target->getID()); // since we still have the Reply table which some apparently use!
+ }
+
+ try {
+ $att = Attention::saveNew($this, $target, $reason);
+ } catch (AlreadyFulfilledException $e) {
+ common_debug('Could not save Attention: '.$e->getMessage());
+ } catch (Exception $e) {
+ common_log(LOG_ERR, 'Could not save Attention: '.$e->getMessage());
+ }
+
+ self::blow('reply:stream:%d', $target->getID());
+ return true;
+ }
+