Changeset f3e44eb for lib/BarnOwl/Module/Twitter.pm
- Timestamp:
- Dec 27, 2009, 3:15:19 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 986c9b1
- Parents:
- c9bdb46
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/BarnOwl/Module/Twitter.pm
r40c9dac rf3e44eb 26 26 our @twitter_handles = (); 27 27 our $default_handle = undef; 28 29 our $prefix; 28 30 29 31 my $desc = <<'END_DESC'; … … 282 284 ); 283 285 286 BarnOwl::new_command('twitter-count-chars' => \&cmd_count_chars, { 287 summary => 'Count the number of characters in the edit window', 288 usage => 'twitter-count-chars', 289 description => <<END_DESCRIPTION 290 Displays the number of characters entered in the edit window so far. Correctly 291 takes into account any \@user prefix that will be added by the Twitter plugin. 292 END_DESCRIPTION 293 }); 294 295 284 296 sub cmd_twitter { 285 297 my $cmd = shift; … … 292 304 } 293 305 } 306 undef $prefix; 294 307 BarnOwl::start_edit_win("What's happening?" . (defined $account ? " ($account)" : ""), sub{twitter($account, shift)}); 295 308 } … … 300 313 die("Usage: $cmd USER\n") unless $user; 301 314 my $account = find_account_default(shift); 315 undef $prefix; 302 316 BarnOwl::start_edit_win("$cmd $user " . ($account->nickname||""), 303 317 sub { $account->twitter_direct($user, shift) }); … … 310 324 my $account = find_account_default(shift); 311 325 326 $prefix = "@\$user "; 312 327 BarnOwl::start_edit_win("Reply to \@" . $user . ($account->nickname ? (" on " . $account->nickname) : ""), 313 328 sub { $account->twitter_atreply($user, $id, shift) }); … … 342 357 } 343 358 359 use BarnOwl::Editwin qw(:all); 360 sub cmd_count_chars { 361 my $cmd = shift; 362 my $text = save_excursion { 363 move_to_buffer_start(); 364 set_mark(); 365 move_to_buffer_end(); 366 get_region(); 367 }; 368 my $len = length($text); 369 $len += length($prefix) if $prefix; 370 BarnOwl::message($len); 371 return $len; 372 } 373 344 374 BarnOwl::filter(qw{twitter type ^twitter$}); 345 375
Note: See TracChangeset
for help on using the changeset viewer.