Ignore:
Timestamp:
Jul 28, 2008, 10:07:48 AM (16 years ago)
Author:
Geoffrey Thomas <geofft@mit.edu>
Branches:
master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
601733d
Parents:
a1a2036
Message:
Another angry commit -- add :jaway.
File:
1 edited

Legend:

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

    ra1a2036 rbfc127b  
    235235    );
    236236    BarnOwl::new_command(
     237        jaway => \&cmd_jaway,
     238        {
     239            summary => "Set Jabber away / presence information",
     240            usage   => "jaway [-s online|dnd|...] [<message>]"
     241        }
     242    );
     243    BarnOwl::new_command(
    237244        jlist => \&cmd_jlist,
    238245        {
     
    757764}
    758765
     766sub cmd_jaway {
     767    my $cmd = shift;
     768    local @ARGV = @_;
     769    my $getopt = Getopt::Long::Parser->new;
     770    my ($jid, $show);
     771    my $p = new Net::Jabber::Presence;
     772
     773    $getopt->configure('pass_through', 'no_getopt_compat');
     774    $getopt->getoptions(
     775        'account=s' => \$jid,
     776        'show=s'    => \$show
     777    );
     778    $jid ||= defaultJID();
     779    if ($jid) {
     780        $jid = resolveConnectedJID($jid);
     781        return unless $jid;
     782    }
     783    else {
     784        BarnOwl::error('You must specify an account with -a {jid}');
     785    }
     786
     787    $p->SetShow($show eq "online" ? "" : $show) if $show;
     788    $p->SetStatus(join(' ', @ARGV)) if @ARGV;
     789    $conn->getConnectionFromJID($jid)->Send($p);
     790}
     791
     792
    759793sub jroster_sub {
    760794    my $jid = shift;
Note: See TracChangeset for help on using the changeset viewer.