1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
- require_once dirname(__DIR__) . '/twitter.php';
- class TweetInQueueHandler extends QueueHandler
- {
- function transport()
- {
- return 'tweetin';
- }
- function handle($data)
- {
-
- $status = $data['status'];
-
- $receiver = $data['for_user'];
- $importer = new TwitterImport();
- $notice = $importer->importStatus($status);
- if ($notice instanceof Notice) {
- $flink = Foreign_link::getByForeignID($receiver, TWITTER_SERVICE);
- if ($flink instanceof Foreign_link) {
- common_log(LOG_DEBUG, "TweetInQueueHandler - Got flink so add notice ".
- $notice->id." to attentions for user ".$flink->user_id);
- try {
- Attention::saveNew($notice, $flink->getProfile());
- } catch (Exception $e) {
-
-
- common_log(LOG_ERR, "Failed adding notice {$notice->id} to attentions for user {$flink->user_id}: " .
- $e->getMessage());
- }
- } else {
- common_log(LOG_DEBUG, "TweetInQueueHandler - No flink found for foreign user ".$receiver);
- }
- }
- return true;
- }
- }
|