Changeset 29398
- Timestamp:
- 02/02/09 00:08:40 (4 years ago)
- Location:
- lang/perl/Net-Twissr/trunk
- Files:
-
- 4 modified
-
Changes (modified) (1 diff)
-
README (modified) (1 diff)
-
example/terminal.pl (modified) (4 diffs)
-
lib/Net/Twissr.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Net-Twissr/trunk/Changes
r28762 r29398 11 11 12 12 0.1.0 Wed Jan 20 00:18:52 2009 13 14 0.1.1 Wed Jan 21 22:06:26 2009 15 add method "update_twitter" and "update_wassr". 16 17 0.1.2 18 add reply properties. -
lang/perl/Net-Twissr/trunk/README
r28808 r29398 1 Net-Twissr version 0.1. 11 Net-Twissr version 0.1.2 2 2 3 3 [ REPLACE THIS... -
lang/perl/Net-Twissr/trunk/example/terminal.pl
r29099 r29398 32 32 # l: list 33 33 # r: refresh 34 # t: post to twitter only 35 # w: post to wassr only 36 # p: post to twitter and wassr 37 # P: post as reply to current selected message 34 38 # q: quit 35 # p: post36 39 37 40 my $mode = 0; … … 65 68 &refresh_friends_timeline(\@friends_timeline); 66 69 } 67 if ($ch eq 'p') { 68 $screen->clrscr()->at(0, 0)->puts('Message:')->at(1, 0); 70 if ($ch eq 'p' or $ch eq 'P' or 71 $ch eq 't' or $ch eq 'w') { 72 my $message = 'Message'; 73 my $option = { 74 twitter => 1, 75 wassr => 1, 76 }; 77 # reply 78 if ($ch eq 'P') { 79 my $status = $friends_timeline[$index]; 80 $message .= " for $status->{user_id}"; 81 $message .= " in $status->{service}"; 82 if ($status->{service} eq 'twitter') { 83 $option->{wassr} = 0; 84 } 85 if ($status->{service} eq 'wassr') { 86 $option->{twitter} = 0; 87 } 88 $option->{reply} = $status->{id}; 89 } 90 # twitter only 91 if ($ch eq 't') { 92 $message .= ' in twitter'; 93 $option->{wassr} = 0; 94 } 95 # wassr only 96 if ($ch eq 'w') { 97 $message .= ' in wassr'; 98 $option->{twitter} = 0; 99 } 100 $message .= ':'; 101 $screen->clrscr()->at(0, 0)->puts($message)->at(1, 0); 102 69 103 my $status = <>; 70 104 if (defined $status) { 71 105 chomp($status); 72 &update($status );106 &update($status, $option); 73 107 } 74 108 } … … 96 130 my $row = 0; 97 131 my $status = $timeline->[$index]; 132 # Twissr / Wassr 98 133 $screen->at($row++, 0)->puts($status->{service})->clreol(); 99 return if ($row > $rows - 1);134 # date and time 100 135 $screen->at($row++, 0)->puts(scalar(localtime($status->{time})))->clreol(); 101 return if ($row > $rows - 1);136 # user name 102 137 my $user = (Jcode->new($status->{user_id} . ' / ' . $status->{user_name})->jfold($cols))[0]; 103 138 $screen->at($row++, 0)->puts($user)->clreol(); 104 return if ($row > $rows - 1);139 # message 105 140 my @text = Jcode->new($status->{text})->jfold($cols - 1); 106 141 for (0..$#text) { 107 142 $screen->at($row++, 0)->puts($text[$_])->clreol(); 108 return if ($row > $rows - 1); 143 } 144 # reply 145 if ($status->{reply_id}) { 146 $row++; 147 # reply to 148 my $reply_to = $status->{reply_to}; 149 $screen->at($row++, 0)->puts('reply to : ' . $reply_to)->clreol(); 150 # reply message 151 if ($status->{reply_text}) { 152 my @reply_text = Jcode->new($status->{reply_text})->jfold($cols - 1); 153 for (0..$#reply_text) { 154 $screen->at($row++, 0)->puts($reply_text[$_])->clreol(); 155 } 156 } 109 157 } 110 158 }; … … 137 185 # statusの更新 138 186 sub update { 139 my $status = shift; 140 $twissr->update($status); 141 } 187 my ($status, $option) = @_; 188 # multi post 189 if ($option->{twitter} && $option->{wassr}) { 190 $twissr->update($status); 191 } 192 # single post 193 else { 194 # twitter 195 if ($option->{twitter}) { 196 $twissr->update_twitter({ 197 status => $status, 198 reply => $option->{reply}, 199 }); 200 } 201 # wassr 202 if ($option->{wassr}) { 203 $twissr->update_wassr({ 204 status => $status, 205 reply => $option->{reply}, 206 }); 207 } 208 } 209 } -
lang/perl/Net-Twissr/trunk/lib/Net/Twissr.pm
r28810 r29398 5 5 use Carp; 6 6 7 use version; our $VERSION = qv('0.1. 1');7 use version; our $VERSION = qv('0.1.2'); 8 8 9 9 use HTTP::Date; … … 202 202 $time =~ s/\+0000/GMT/; 203 203 $status{time} = str2time($time); 204 $status{reply_id} = $data->{in_reply_to_status_id}; 205 $status{reply_to} = $data->{in_reply_to_screen_name}; 204 206 push @statuses, \%status; 205 207 } … … 213 215 $status{user_name} = $data->{user}->{screen_name}; 214 216 $status{time} = $data->{epoch}; 217 $status{reply_id} = $1 if ($data->{reply_status_url} =~ m|^.*/(.*?)$|); 218 $status{reply_to} = $data->{reply_user_login_id}; 219 $status{reply_text} = $data->{reply_message}; 215 220 push @statuses, \%status; 216 221 } … … 229 234 =head1 VERSION 230 235 231 This document describes Net::Twissr version 0.1. 1236 This document describes Net::Twissr version 0.1.2 232 237 233 238
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)