Fix regressions in XMPP output during inbox refactoring
- NOTICE_INBOX_SOURCE_* constants moved to common.php since Notice_inbox.php not always loaded - fixed typo in User::staticGet() call which caused user #1 to receive messages once for each subscriber instead of for him/herself - 'continue' -> 'continue 2' inside switch() statement to fix loop escape (PHP considers switch() a looping construct for break & continue)
This commit is contained in:
parent
d84c33c328
commit
0e1f2d4b47
|
@ -31,12 +31,6 @@ define('NOTICE_INBOX_GC_MAX', 12800);
|
||||||
define('NOTICE_INBOX_LIMIT', 1000);
|
define('NOTICE_INBOX_LIMIT', 1000);
|
||||||
define('NOTICE_INBOX_SOFT_LIMIT', 1000);
|
define('NOTICE_INBOX_SOFT_LIMIT', 1000);
|
||||||
|
|
||||||
define('NOTICE_INBOX_SOURCE_SUB', 1);
|
|
||||||
define('NOTICE_INBOX_SOURCE_GROUP', 2);
|
|
||||||
define('NOTICE_INBOX_SOURCE_REPLY', 3);
|
|
||||||
define('NOTICE_INBOX_SOURCE_FORWARD', 4);
|
|
||||||
define('NOTICE_INBOX_SOURCE_GATEWAY', -1);
|
|
||||||
|
|
||||||
class Notice_inbox extends Memcached_DataObject
|
class Notice_inbox extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
|
|
|
@ -41,6 +41,12 @@ define('FOREIGN_NOTICE_SEND_REPLY', 4);
|
||||||
define('FOREIGN_FRIEND_SEND', 1);
|
define('FOREIGN_FRIEND_SEND', 1);
|
||||||
define('FOREIGN_FRIEND_RECV', 2);
|
define('FOREIGN_FRIEND_RECV', 2);
|
||||||
|
|
||||||
|
define('NOTICE_INBOX_SOURCE_SUB', 1);
|
||||||
|
define('NOTICE_INBOX_SOURCE_GROUP', 2);
|
||||||
|
define('NOTICE_INBOX_SOURCE_REPLY', 3);
|
||||||
|
define('NOTICE_INBOX_SOURCE_FORWARD', 4);
|
||||||
|
define('NOTICE_INBOX_SOURCE_GATEWAY', -1);
|
||||||
|
|
||||||
# append our extlib dir as the last-resort place to find libs
|
# append our extlib dir as the last-resort place to find libs
|
||||||
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
|
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
|
||||||
|
|
|
@ -359,7 +359,7 @@ function jabber_broadcast_notice($notice)
|
||||||
$ni = $notice->whoGets();
|
$ni = $notice->whoGets();
|
||||||
|
|
||||||
foreach ($ni as $user_id => $reason) {
|
foreach ($ni as $user_id => $reason) {
|
||||||
$user = User::staticGet('user_id', $user_id);
|
$user = User::staticGet($user_id);
|
||||||
if (empty($user) ||
|
if (empty($user) ||
|
||||||
empty($user->jabber) ||
|
empty($user->jabber) ||
|
||||||
!$user->jabbernotify) {
|
!$user->jabbernotify) {
|
||||||
|
@ -369,20 +369,20 @@ function jabber_broadcast_notice($notice)
|
||||||
switch ($reason) {
|
switch ($reason) {
|
||||||
case NOTICE_INBOX_SOURCE_REPLY:
|
case NOTICE_INBOX_SOURCE_REPLY:
|
||||||
if (!$user->jabberreplies) {
|
if (!$user->jabberreplies) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOTICE_INBOX_SOURCE_SUB:
|
case NOTICE_INBOX_SOURCE_SUB:
|
||||||
$sub = Subscription::pkeyGet(array('subscriber' => $user->id,
|
$sub = Subscription::pkeyGet(array('subscriber' => $user->id,
|
||||||
'subscribed' => $notice->profile_id));
|
'subscribed' => $notice->profile_id));
|
||||||
if (empty($sub) || !$sub->jabber) {
|
if (empty($sub) || !$sub->jabber) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOTICE_INBOX_SOURCE_GROUP:
|
case NOTICE_INBOX_SOURCE_GROUP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception(_("Unknown inbox source."));
|
throw new Exception(sprintf(_("Unknown inbox source %d."), $reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
common_log(LOG_INFO,
|
common_log(LOG_INFO,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user