Пример #1
0
 function handle_notice($notice)
 {
     try {
         return jabber_broadcast_notice($notice);
     } catch (XMPPHP_Exception $e) {
         $this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
         exit(1);
     }
 }
Пример #2
0
 function handle($notice)
 {
     require_once INSTALLDIR . '/lib/jabber.php';
     try {
         return jabber_broadcast_notice($notice);
     } catch (XMPPHP_Exception $e) {
         common_log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());
         return false;
     }
 }
Пример #3
0
 function enqueue($object, $queue)
 {
     $notice = $object;
     switch ($queue) {
         case 'omb':
             if ($this->_isLocal($notice)) {
                 require_once INSTALLDIR . '/lib/omb.php';
                 omb_broadcast_remote_subscribers($notice);
             }
             break;
         case 'public':
             if ($this->_isLocal($notice)) {
                 require_once INSTALLDIR . '/lib/jabber.php';
                 jabber_public_notice($notice);
             }
             break;
         case 'twitter':
             if ($this->_isLocal($notice)) {
                 broadcast_twitter($notice);
             }
             break;
         case 'facebook':
             if ($this->_isLocal($notice)) {
                 require_once INSTALLDIR . '/lib/facebookutil.php';
                 return facebookBroadcastNotice($notice);
             }
             break;
         case 'ping':
             if ($this->_isLocal($notice)) {
                 require_once INSTALLDIR . '/lib/ping.php';
                 return ping_broadcast_notice($notice);
             }
         case 'sms':
             require_once INSTALLDIR . '/lib/mail.php';
             mail_broadcast_notice_sms($notice);
             break;
         case 'jabber':
             require_once INSTALLDIR . '/lib/jabber.php';
             jabber_broadcast_notice($notice);
             break;
         default:
             throw ServerException("UnQueueManager: Unknown queue: {$type}");
     }
 }
Пример #4
0
function common_real_broadcast($notice, $remote = false)
{
    $success = true;
    if (!$remote) {
        // Make sure we have the OMB stuff
        require_once INSTALLDIR . '/lib/omb.php';
        $success = omb_broadcast_remote_subscribers($notice);
        if (!$success) {
            common_log(LOG_ERR, 'Error in OMB broadcast for notice ' . $notice->id);
        }
    }
    if ($success) {
        require_once INSTALLDIR . '/lib/jabber.php';
        $success = jabber_broadcast_notice($notice);
        if (!$success) {
            common_log(LOG_ERR, 'Error in jabber broadcast for notice ' . $notice->id);
        }
    }
    if ($success) {
        require_once INSTALLDIR . '/lib/mail.php';
        $success = mail_broadcast_notice_sms($notice);
        if (!$success) {
            common_log(LOG_ERR, 'Error in sms broadcast for notice ' . $notice->id);
        }
    }
    if ($success) {
        $success = jabber_public_notice($notice);
        if (!$success) {
            common_log(LOG_ERR, 'Error in public broadcast for notice ' . $notice->id);
        }
    }
    if ($success) {
        $success = broadcast_twitter($notice);
        if (!$success) {
            common_log(LOG_ERR, 'Error in Twitter broadcast for notice ' . $notice->id);
        }
    }
    // XXX: Do a real-time FB broadcast here?
    // XXX: broadcast notices to other IM
    return $success;
}