X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fjabber.php;h=f41d984d6261a46698f11cf27de238d8698e3ce1;hb=09bab904091316fe669619ec90a26a86fc1927d5;hp=c33722ea51176cf0ada53c34d8c1d0ede74850b1;hpb=eb156741f83cb2beab1d02007ad4a3b440a5189a;p=quix0rs-gnu-social.git diff --git a/lib/jabber.php b/lib/jabber.php index c33722ea51..f41d984d62 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -178,7 +178,7 @@ function jabber_format_entry($profile, $notice) $entry .= "\n"; $entry .= "\n"; $entry .= "" . $profile->nickname . "\n"; - $entry .= "" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "\n"; + $entry .= "" . $profile->avatarUrl(AVATAR_PROFILE_SIZE) . "\n"; $entry .= "\n"; $entry .= "" . htmlspecialchars($msg) . "\n"; $entry .= "" . htmlspecialchars($msg) . "\n"; @@ -354,12 +354,13 @@ function jabber_broadcast_notice($notice) // First, get users to whom this is a direct reply $user = new User(); - $user->query('SELECT user.id, user.jabber ' . - 'FROM user JOIN reply ON user.id = reply.profile_id ' . + $UT = common_config('db','type')=='pgsql'?'"user"':'user'; + $user->query("SELECT $UT.id, $UT.jabber " . + "FROM $UT JOIN reply ON $UT.id = reply.profile_id " . 'WHERE reply.notice_id = ' . $notice->id . ' ' . - 'AND user.jabber is not null ' . - 'AND user.jabbernotify = 1 ' . - 'AND user.jabberreplies = 1 '); + "AND $UT.jabber is not null " . + "AND $UT.jabbernotify = 1 " . + "AND $UT.jabberreplies = 1 "); while ($user->fetch()) { common_log(LOG_INFO, @@ -375,12 +376,12 @@ function jabber_broadcast_notice($notice) // Now, get users subscribed to this profile $user = new User(); - $user->query('SELECT user.id, user.jabber ' . - 'FROM user JOIN subscription ' . - 'ON user.id = subscription.subscriber ' . + $user->query("SELECT $UT.id, $UT.jabber " . + "FROM $UT JOIN subscription " . + "ON $UT.id = subscription.subscriber " . 'WHERE subscription.subscribed = ' . $notice->profile_id . ' ' . - 'AND user.jabber is not null ' . - 'AND user.jabbernotify = 1 ' . + "AND $UT.jabber is not null " . + "AND $UT.jabbernotify = 1 " . 'AND subscription.jabber = 1 '); while ($user->fetch()) { @@ -392,17 +393,20 @@ function jabber_broadcast_notice($notice) // To keep the incoming queue from filling up, // we service it after each send. $conn->processTime(0); + $sent_to[$user->id] = 1; } } // Now, get users who have it in their inbox because of groups $user = new User(); - $user->query('SELECT user.id, user.jabber ' . - 'FROM user JOIN notice_inbox ' . - 'ON user.id = notice_inbox.user_id ' . + $user->query("SELECT $UT.id, $UT.jabber " . + "FROM $UT JOIN notice_inbox " . + "ON $UT.id = notice_inbox.user_id " . 'WHERE notice_inbox.notice_id = ' . $notice->id . ' ' . - 'AND notice_inbox.source = 2 '); + 'AND notice_inbox.source = 2 ' . + 'AND user.jabber is not null ' . + 'AND user.jabbernotify = 1 '); while ($user->fetch()) { if (!array_key_exists($user->id, $sent_to)) { @@ -413,6 +417,7 @@ function jabber_broadcast_notice($notice) // To keep the incoming queue from filling up, // we service it after each send. $conn->processTime(0); + $sent_to[$user->id] = 1; } }