+ $sent_to = array();
+ # First, get users who this is a direct reply to
+ $reply = new Reply();
+ $reply->notice_id = $notice->id;
+ if ($reply->find()) {
+ while ($reply->fetch()) {
+ $user = User::staticGet($reply->profile_id);
+ if ($user && $user->jabber && $user->jabbernotify && $user->jabberreplies) {
+ common_log(LOG_INFO,
+ 'Sending reply notice ' . $notice->id . ' to ' . $user->jabber,
+ __FILE__);
+ $success = jabber_send_notice($user->jabber, $notice);
+ if ($success) {
+ # Remember so we don't send twice
+ $sent_to[$user->id] = true;
+ } else {
+ # XXX: Not sure, but I think that's the right thing to do
+ return false;
+ }
+ }
+ }
+ }
+ # Now, get users subscribed to this profile
+ # XXX: use a join here rather than looping through results