diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-05 12:42:55 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-05 12:42:55 -0700 |
commit | 76353ede54edd8e99ddb9c209ff408486282c0c5 (patch) | |
tree | f7f901ca281b186517750e63f2aad418e222a449 /plugins/TwitterBridge/scripts/streamtest.php | |
parent | 5058e8fd14340fc846b224ccff4e3a27dafc3134 (diff) |
Clean up event handling a bit
Diffstat (limited to 'plugins/TwitterBridge/scripts/streamtest.php')
-rw-r--r-- | plugins/TwitterBridge/scripts/streamtest.php | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/plugins/TwitterBridge/scripts/streamtest.php b/plugins/TwitterBridge/scripts/streamtest.php index 04d91ef43..96ff33fa5 100644 --- a/plugins/TwitterBridge/scripts/streamtest.php +++ b/plugins/TwitterBridge/scripts/streamtest.php @@ -81,7 +81,41 @@ function homeStreamForUser(User $user) $user = User::staticGet('nickname', $nickname); $stream = homeStreamForUser($user); $stream->hookEvent('raw', function($data) { - var_dump($data); + common_log(LOG_INFO, json_encode($data)); +}); +$stream->hookEvent('friends', function($data) { + printf("Friend list: %s\n", implode(', ', $data)); +}); +$stream->hookEvent('favorite', function($data) { + printf("%s favorited %s's notice: %s\n", + $data['source']['screen_name'], + $data['target']['screen_name'], + $data['target_object']['text']); +}); +$stream->hookEvent('follow', function($data) { + printf("%s friended %s\n", + $data['source']['screen_name'], + $data['target']['screen_name']); +}); +$stream->hookEvent('delete', function($data) { + printf("Deleted status notification: %s\n", + $data['status']['id']); +}); +$stream->hookEvent('scrub_geo', function($data) { + printf("Req to scrub geo data for user id %s up to status ID %s\n", + $data['user_id'], + $data['up_to_status_id']); +}); +$stream->hookEvent('status', function($data) { + printf("Received status update from %s: %s\n", + $data['user']['screen_name'], + $data['text']); +}); +$stream->hookEvent('direct_message', function($data) { + printf("Direct message from %s to %s: %s\n", + $data['sender']['screen_name'], + $data['recipient']['screen_name'], + $data['text']); }); class TwitterManager extends IoManager |