Changeset 89701bb


Ignore:
Timestamp:
Jan 23, 2012, 3:34:06 PM (10 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
389d487 (diff), 8da4e96 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 8da4e9656e73162249189dccadc5fe0922d88508 into 389d48749c4eb68f218e9fd6faf953ba542bfb75
Files:
3 edited

Legend:

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

    rb8a3e00 r8da4e96  
    171171our $showOffline = 0;
    172172
     173sub blist_getBuddyStatus {
     174    my $jid = shift;
     175    my $buddy = shift;
     176    my $roster = $conn->getRosterFromJID($jid);
     177    my %jq  = $roster->query($buddy);
     178    my $res = $roster->resource($buddy);
     179    if ($res) {
     180        my %rq = $roster->resourceQuery( $buddy, $res );
     181        return $rq{show} ? $rq{show} : 'online';
     182    } else {
     183        return "unknown";
     184    }
     185}
     186
    173187sub blist_listBuddy {
    174188    my $roster = shift;
     
    303317            summary => "Show your Jabber roster.",
    304318            usage   => "jlist"
     319        }
     320    );
     321    BarnOwl::new_command(
     322        jabber_get_buddy_status => \&cmd_jabber_get_buddy_status,
     323        {
     324            summary => "Get the status of a given buddy.",
     325            usage   => "jabber_get_buddy_status [-a account] buddy"
    305326        }
    306327    );
     
    859880}
    860881
     882sub cmd_jabber_get_buddy_status {
     883    my $cmd = shift;
     884    local @ARGV = @_;
     885    my $getopt = Getopt::Long::Parser->new;
     886    my ($jid, $buddy);
     887
     888    $getopt->configure('no_getopt_compat');
     889    $getopt->getoptions(
     890        'account=s' => \$jid,
     891    );
     892    $jid ||= defaultJID();
     893    if ($jid) {
     894        $jid = resolveConnectedJID($jid);
     895        return unless $jid;
     896    }
     897    else {
     898        die("You must specify an account with -a <jid>\n");
     899    }
     900    $buddy = shift @ARGV;
     901    if(!$buddy) {
     902        die("You must specify a JID to get the status of.\n");
     903    }
     904    my $buddy_jid = resolveDestJID($buddy, $jid);
     905    return blist_getBuddyStatus($jid, $buddy_jid);
     906}
     907
    861908
    862909sub jroster_sub {
     
    14821529}
    14831530
     1531sub complete_jabber_get_buddy_status {
     1532    my $ctx = shift;
     1533    return complete_flags($ctx,
     1534                          [qw()],
     1535                          {
     1536                              "-a" => \&complete_account,
     1537                          },
     1538                          \&complete_user_or_muc
     1539        );
     1540}
     1541
    14841542BarnOwl::Completion::register_completer(jwrite => sub { BarnOwl::Module::Jabber::complete_jwrite(@_) });
     1543BarnOwl::Completion::register_completer(jabber_get_buddy_status => sub { BarnOwl::Module::Jabber::complete_jabber_get_buddy_status(@_) });
    14851544
    148615451;
  • owl.c

    r3b17b57 r389d487  
    585585  );
    586586
     587  owl_function_debugmsg("startup: setting context interactive");
     588
     589  owl_global_pop_context(&g);
     590  owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
     591
    587592  /* process the startup file */
    588593  owl_function_debugmsg("startup: processing startup file");
     
    596601      owl_function_error("No such style: %s", owl_global_get_default_style(&g));
    597602
    598   owl_function_debugmsg("startup: setting context interactive");
    599 
    600   owl_global_pop_context(&g);
    601   owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL);
    602 
    603603  source = owl_window_redraw_source_new();
    604604  g_source_attach(source, NULL);
  • zwrite.c

    r6329cd5 ref4074b  
    44{
    55  owl_zwrite *z = g_new(owl_zwrite, 1);
    6   if (owl_zwrite_create_from_line(z, line) < 0) {
    7     owl_zwrite_delete(z);
     6  if (owl_zwrite_create_from_line(z, line) != 0) {
     7    g_free(z);
    88    return NULL;
    99  }
     
    1414{
    1515  owl_zwrite *z = g_new(owl_zwrite, 1);
    16   if (owl_zwrite_create(z, argc, argv) < 0) {
    17     owl_zwrite_delete(z);
     16  if (owl_zwrite_create(z, argc, argv) != 0) {
     17    g_free(z);
    1818    return NULL;
    1919  }
     
    135135
    136136  if (badargs) {
     137    owl_zwrite_cleanup(z);
    137138    return(-1);
    138139  }
     
    142143      z->recips->len == 0) {
    143144    owl_function_error("You must specify a recipient for zwrite");
     145    owl_zwrite_cleanup(z);
    144146    return(-1);
    145147  }
     
    267269  owl_zwrite z;
    268270  int rv;
    269   rv=owl_zwrite_create_from_line(&z, cmd);
    270   if (rv) return(rv);
     271  rv = owl_zwrite_create_from_line(&z, cmd);
     272  if (rv != 0) return rv;
    271273  if (!owl_zwrite_is_message_set(&z)) {
    272274    owl_zwrite_set_message(&z, msg);
Note: See TracChangeset for help on using the changeset viewer.