Changeset 4cf4067


Ignore:
Timestamp:
Mar 6, 2008, 12:53:45 PM (13 years ago)
Author:
nelhage@mit.edu <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
30f0680
Parents:
d775050
Message:
Add a `twitter' command
File:
1 edited

Legend:

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

    rd775050 r4cf4067  
    2323    my $msg = shift;
    2424    BarnOwl::admin_message('Twitter Error', $msg);
    25     die;
     25    die("Twitter Error: $msg\n");
    2626}
    2727
     
    3232
    3333# Don't redefine variables if they already exist
    34 # This is a workaround for  http://barnowl.mit.edu/trac/ticket/44
     34# This is a workaround for http://barnowl.mit.edu/trac/ticket/44
    3535# Which was fixed in svn r819
    3636if(BarnOwl::getvar('twitter:class') eq '') {
     
    8888}
    8989
     90BarnOwl::new_command(twitter => \&cmd_twitter, {
     91    summary     => 'Update Twitter from BarnOwl',
     92    usage       => 'twitter [message]',
     93    description => 'Update Twitter. If MESSAGE is provided, use it as your status.'
     94    . "\nOtherwise, prompt for a status message to use."
     95   });
     96
     97sub cmd_twitter {
     98    my $cmd = shift;
     99    if(@_) {
     100        my $status = join(" ", @_);
     101        twitter($status);
     102    } else {
     103      BarnOwl::start_edit_win('What are you doing?', \&twitter);
     104    }
     105}
     106
    90107$BarnOwl::Hooks::receiveMessage->add(\&handle_message);
    91108
Note: See TracChangeset for help on using the changeset viewer.