Changeset 11639
- Timestamp:
- 05/15/08 22:37:39 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/XIRCD/trunk/lib/XIRCD/Component/Twitter.pm
r11636 r11639 4 4 with qw(MooseX::POE::Aliased); 5 5 6 use Encode; 6 7 use HTTP::Request::Common; 7 8 use HTTP::Date (); … … 62 63 } 63 64 65 event send_message => sub { 66 my $self = shift; 67 my ($status,) = get_args(@_); 68 69 my $req = HTTP::Request::Common::POST( 70 $self->config->{apiurl} . '/update.json', 71 [ status => encode('utf-8',$status) ], 72 ); 73 $req->authorization_basic($self->config->{twitter}->{username}, $self->config->{twitter}->{password}); 74 75 POE::Kernel->post($self->http_alias => request => 'http_response', $req); 76 }; 77 64 78 event read_twitter_friend_timeline => sub { 65 79 my $self = shift; … … 117 131 }; 118 132 133 event update_success => sub { 134 my $self = shift; 135 136 my ( $response, ) = get_args(@_); 137 138 if ( $response->is_success ) { 139 my $ret = JSON::Any->jsonToObj($response->content); 140 POE::Kernel->post( ircd => publish_notice => $self->config->{channel}, $ret->{text} ); 141 } 142 }; 143 119 144 120 145 1;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)