Changes in / [19cc7b00:d4ecc78]


Ignore:
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl/Complete/Zephyr.pm

    r84db778 r8f16dcd  
    3030}
    3131
     32sub complete_sub {
     33    my $ctx = shift;
     34    return complete_flags($ctx,
     35        [],
     36        {
     37            "-r" => \&complete_realm,
     38        });
     39}
     40
    3241sub on_message {
    3342    my $m = shift;
     
    4150BarnOwl::Completion::register_completer(zcrypt    => \&complete_zwrite);
    4251
     52# TODO: Handle aliases transparently in the core completion code?
     53BarnOwl::Completion::register_completer(sub       => \&complete_sub);
     54BarnOwl::Completion::register_completer(subscribe => \&complete_sub);
     55
    4356$BarnOwl::Hooks::newMessage->add("BarnOwl::Complete::Zephyr::on_message");
    4457
  • perl/lib/BarnOwl/Completion.pm

    rc4efb46 rf987504  
    1818                        point_move replace_region);
    1919
    20 use List::Util qw(min first);
     20use List::Util qw(max first);
    2121
    2222our %completers = ();
     
    7676sub common_prefix {
    7777    my @words = @_;
    78     my $len   = min(map {length($_)} @words);
     78    my $len   = max(map {length($_)} @words);
    7979    my $pfx = '';
    8080    for my $i (1..$len) {
  • perl/modules/IRC/lib/BarnOwl/Module/IRC.pm

    rab9cd8f r96f7b07  
    1818use BarnOwl::Message::IRC;
    1919use BarnOwl::Module::IRC::Connection qw(is_private);
    20 use BarnOwl::Module::IRC::Completion;
    2120
    2221use Net::IRC;
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r57ba9f1 r004d683  
    1919use BarnOwl::Module::Jabber::Connection;
    2020use BarnOwl::Module::Jabber::ConnectionManager;
    21 use BarnOwl::Completion::Util qw(complete_flags);
    2221
    2322use Authen::SASL qw(Perl);
     
    6362$conn ||= BarnOwl::Module::Jabber::ConnectionManager->new;
    6463our %vars;
    65 our %completion_jids;
    6664
    6765sub onStart {
     
    166164
    167165    $blistStr .= sprintf '%-15s %s', $name, $buddy->GetJID();
    168     $completion_jids{$name} = 1;
    169     $completion_jids{$buddy->GetJID()} = 1;
    170166
    171167    if ($res) {
     
    431427                BarnOwl::error( "Error in connect: " . join( " ", @result ) );
    432428            } else {
    433                 my $roster = $conn->getRosterFromJID($jidStr);
    434                 $roster->fetch();
     429                $conn->getRosterFromJID($jidStr)->fetch();
    435430                $client->PresenceSend( priority => 1 );
    436431                my $fullJid = $client->{SESSION}->{FULLJID} || $jidStr;
     
    442437                #queue_admin_msg("Connected to jabber as $fullJid ($client->{fileno})");
    443438                BarnOwl::add_dispatch($client->{fileno}, sub { $client->OwlProcess() });
    444 
    445                 # populate completion from roster.
    446                 for my $buddy ( $roster->jids('all') ) {
    447                     my %jq  = $roster->query($buddy);
    448                     my $name = $jq{name} || $buddy->GetUserID();
    449                     $completion_jids{$name} = 1;
    450                     $completion_jids{$buddy->GetJID()} = 1;
    451                 }
    452439            }
    453440        }
     
    660647                                                   MaxChars => 0
    661648                                                  });
    662     $completion_jids{$muc} = 1;
    663649    return;
    664650}
     
    715701
    716702    my $presence = "JIDs present in " . $m->BaseJID;
    717     $completion_jids{$m->BaseJID} = 1;
    718703    if($m->Anonymous) {
    719704        $presence .= " [anonymous MUC]";
     
    890875    $name = "" unless (1 == scalar(@ARGV));
    891876
    892     $completion_jids{$baseJID} = 1;
    893     $completion_jids{$name} = 1 if $name;
    894 
    895877    foreach my $to (@ARGV) {
    896878        my %jq  = $roster->query($to);
     
    10751057
    10761058sub process_presence_available {
     1059    return unless (BarnOwl::getvar('jabber:show_logins') eq 'on');
    10771060    my ( $sid, $p ) = @_;
    10781061    my $from = $p->GetFrom('jid')->GetJID('base');
    1079     $completion_jids{$from} = 1;
    1080     return unless (BarnOwl::getvar('jabber:show_logins') eq 'on');
    10811062    my $to = $p->GetTo();
    10821063    my $type = $p->GetType();
     
    12281209              if ($connection->FindMUC(jid => $to));
    12291210        }
    1230 
    1231         # Populate completion.
    1232         if ($dir eq 'in') {
    1233             $completion_jids{ $props{sender} }= 1;
    1234         }
    1235         else {
    1236             $completion_jids{ $props{recipient} } = 1;
    1237         }
    12381211    }
    12391212    elsif ( $jtype eq 'groupchat' ) {
    12401213        my $nick = $props{nick} = $from->GetResource();
    12411214        my $room = $props{room} = $from->GetJID('base');
    1242         $completion_jids{$room} = 1;
    12431215
    12441216        $props{sender} = $nick || $room;
     
    14121384}
    14131385
    1414 ################################################################################
    1415 ### Completion
    1416 
    1417 sub complete_user_or_muc { return keys %completion_jids; }
    1418 sub complete_account { return $conn->getJIDs(); }
    1419 
    1420 sub complete_jwrite {
    1421     my $ctx = shift;
    1422     return complete_flags($ctx,
    1423                           [qw(-t -i -s)],
    1424                           {
    1425                               "-a" => \&complete_account,
    1426                           },
    1427                           \&complete_user_or_muc
    1428         );
    1429 }
    1430 
    1431 BarnOwl::Completion::register_completer(jwrite => sub { BarnOwl::Module::Jabber::complete_jwrite(@_) });
    1432 
    143313861;
  • perlglue.xs

    rd77e909 r6dc2d6b  
    332332        CODE:
    333333        owl_select_remove_perl_dispatch(fd);
    334 
    335 
    336 AV*
    337 all_filters()
    338         PREINIT:
    339                 AV *filters;
    340                 owl_list *fl;
    341                 owl_filter *f;
    342                 int i;
    343         CODE:
    344         {
    345                 fl = owl_global_get_filterlist(&g);
    346                 filters = newAV();
    347                 for(i=0;i<owl_list_get_size(fl);i++) {
    348                         f = owl_list_get_element(fl, i);
    349                         av_push(filters, newSVpv(owl_filter_get_name(f), 0));
    350                 }
    351                 RETVAL = filters;
    352                 sv_2mortal((SV*)RETVAL);
    353         }
    354         OUTPUT:
    355                 RETVAL
    356334
    357335MODULE = BarnOwl                PACKAGE = BarnOwl::Internal
  • t/completion.t

    rc4efb46 r7be5d8b  
    122122is(BarnOwl::Completion::common_prefix(qw(abc abc)), 'abc');
    123123
    124 is(BarnOwl::Completion::common_prefix('a', ''), '');
    125 
    126124## Test complete_flags
    127125
Note: See TracChangeset for help on using the changeset viewer.