Ignore:
Timestamp:
May 23, 2010, 12:07:41 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
5756999
Parents:
1fd469d4
git-author:
Nelson Elhage <nelhage@mit.edu> (05/23/10 12:06:23)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/23/10 12:07:41)
Message:
Twitter: Insert the "@user" into the editwin on replies.

This wasn't possible (or at least wasn't easy) until recently, when
BarnOwl::start_edit_win actually changed the context, instead of
having to wait for the mainloop to pick it up.
Location:
perl/modules/Twitter/lib/BarnOwl/Module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter.pm

    r47a5e46 ra2640485  
    2626our @twitter_handles = ();
    2727our $default_handle = undef;
    28 
    29 our $prefix;
    3028
    3129my $desc = <<'END_DESC';
     
    298296    usage       => 'twitter-count-chars',
    299297    description => <<END_DESCRIPTION
    300 Displays the number of characters entered in the edit window so far. Correctly
    301 takes into account any \@user prefix that will be added by the Twitter plugin.
     298Displays the number of characters entered in the edit window so far.
    302299END_DESCRIPTION
    303300   });
     
    314311        }
    315312    }
    316     undef $prefix;
    317313    BarnOwl::start_edit_win("What's happening?" . (defined $account ? " ($account)" : ""), sub{twitter($account, shift)});
    318314}
     
    323319    die("Usage: $cmd USER\n") unless $user;
    324320    my $account = find_account_default(shift);
    325     undef $prefix;
    326321    BarnOwl::start_edit_win("$cmd $user " . ($account->nickname||""),
    327322                            sub { $account->twitter_direct($user, shift) });
     
    334329    my $account = find_account_default(shift);
    335330
    336     $prefix = "\@$user ";
    337331    BarnOwl::start_edit_win("Reply to \@" . $user . ($account->nickname ? (" on " . $account->nickname) : ""),
    338332                            sub { $account->twitter_atreply($user, $id, shift) });
     333    BarnOwl::Editwin::insert_text("\@$user ");
    339334}
    340335
     
    378373    };
    379374    my $len = length($text);
    380     $len += length($prefix) if $prefix;
    381375    BarnOwl::message($len);
    382376    return $len;
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm

    r47a5e46 ra2640485  
    372372    my $msg = shift;
    373373    if(defined($id)) {
    374         $self->twitter("@".$to." ".$msg, $id);
    375     } else {
    376         $self->twitter("@".$to." ".$msg);
     374        $self->twitter($msg, $id);
     375    } else {
     376        $self->twitter($msg);
    377377    }
    378378}
Note: See TracChangeset for help on using the changeset viewer.