* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+defined('GNUSOCIAL') || die();
/**
* Common superclass for all IM sending queue handlers.
* @param Notice $notice
* @return boolean success
*/
- function handle($notice)
+ function handle($notice): bool
{
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not broadcasting");
+ return true;
+ }
+
$this->plugin->broadcastNotice($notice);
if ($notice->isLocal()) {
$this->plugin->publicNotice($notice);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Queue handler for pushing new notices to ping servers.
*/
class PingQueueHandler extends QueueHandler {
- function transport() {
+ function transport()
+ {
return 'ping';
}
- function handle($notice) {
+ function handle($notice): bool
+ {
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not broadcasting");
+ return true;
+ }
+
require_once INSTALLDIR . '/lib/ping.php';
return ping_broadcast_notice($notice);
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('GNUSOCIAL')) { exit(1); }
+defined('GNUSOCIAL') || die();
/**
* Queue handler for letting plugins handle stuff.
return 'plugin';
}
- function handle($notice)
+ function handle($notice): bool
{
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not broadcasting");
+ return true;
+ }
+
try {
Event::handle('HandleQueuedNotice', array(&$notice));
} catch (NoProfileException $unp) {
* @param mixed $object
* @return boolean true on success, false on failure
*/
- function handle($object)
+ function handle($object): bool
{
return true;
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Queue handler for pushing new notices to local subscribers using SMS.
return 'sms';
}
- function handle($notice)
+ function handle($notice): bool
{
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not broadcasting");
+ return true;
+ }
+
require_once(INSTALLDIR.'/lib/mail.php');
return mail_broadcast_notice_sms($notice);
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Prepare WebSub and Salmon distributions for an outgoing message.
return 'ostatus';
}
- function handle($notice)
+ function handle($notice): bool
{
- assert($notice instanceof Notice);
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not distributing");
+ return true;
+ }
$this->notice = $notice;
$this->user = User::getKV('id', $notice->profile_id);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('GNUSOCIAL')) { exit(1); }
+defined('GNUSOCIAL') || die();
/**
* Process a feed distribution POST from a WebSub (previously PuSH) hub.
return 'pushin';
}
- function handle($data)
+ function handle($data): bool
{
- assert(is_array($data));
+ if (!is_array($data)) {
+ common_log(LOG_ERR, "Got bogus data, not processing");
+ return true;
+ }
$feedsub_id = $data['feedsub_id'];
$post = $data['post'];
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+defined('GNUSOCIAL') || die();
class RSSCloudQueueHandler extends QueueHandler
{
return 'rsscloud';
}
- function handle($notice)
+ function handle($notice): bool
{
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not using");
+ return true;
+ }
+
try {
$profile = $notice->getProfile();
} catch (Exception $e) {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+defined('GNUSOCIAL') || die();
+
/**
* Check for subscription mirroring options on each newly seen post!
*
return 'mirror';
}
- function handle($notice)
+ function handle($notice): bool
{
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not mirroring");
+ return true;
+ }
+
$mirror = new SubMirror();
$mirror->subscribed = $notice->profile_id;
if ($mirror->find()) {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+defined('GNUSOCIAL') || die();
require_once dirname(__DIR__) . '/twitter.php';
return 'twitter';
}
- function handle($notice)
+ function handle($notice): bool
{
+ if (!($notice instanceof Notice)) {
+ common_log(LOG_ERR, "Got a bogus notice, not broadcasting");
+ return true;
+ }
+
$ok = broadcast_twitter($notice);
return $ok || common_config('twitter', 'ignore_errors');
}