Changeset 8830f79f


Ignore:
Timestamp:
Oct 3, 2009, 10:15:11 AM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
9f5e847
Parents:
340c3e7 (diff), 1167bf1 (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 branch 'davidben/context-slice'

Conflicts:
	perlglue.xs
Files:
7 added
39 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rb9c8d28 r42ad917  
    2828owl_prototypes.h
    2929owl_prototypes.h.new
     30perl_tester
    3031perlglue.c
    3132perlwrap.c
  • Makefile.am

    reddee7e r8830f79f  
    22
    33bin_PROGRAMS = barnowl.bin
    4 check_PROGRAMS = tester
     4check_PROGRAMS = tester perl_tester
    55
    66barnowl_bin_SOURCES = $(BASE_SRCS) \
     
    1717
    1818tester_LDADD = libfaim/libfaim.a
     19
     20perl_tester_SOURCES = $(BASE_SRCS) \
     21     owl.h owl_perl.h config.h \
     22     libzcrypt.a \
     23     $(GEN_C) $(GEN_H) \
     24     perl_tester.c
     25
     26perl_tester_LDADD = libfaim/libfaim.a libzcrypt.a
    1927
    2028TESTS=runtests.sh
  • perl/lib/BarnOwl/Complete/Client.pm

    rd5ccf4e8 ra3a9eb7  
    77
    88use BarnOwl::Completion::Util qw(complete_flags);
     9use BarnOwl::Complete::Filter qw(complete_filter_name complete_filter_expr);
    910
    1011my @all_colors = qw(default
     
    4243sub complete_command { return sort @BarnOwl::all_commands; }
    4344sub complete_color { return @all_colors; }
    44 sub complete_filter_name { return @{BarnOwl::all_filters()}; }
    4545sub complete_variable    { return @{BarnOwl::all_variables()}; }
    4646sub complete_style       { return @{BarnOwl::all_styles()}; }
    47 
    48 my %filter_cmds = (
    49     sender    => \&BarnOwl::Complete::Zephyr::complete_user,
    50     recipient => \&BarnOwl::Complete::Zephyr::complete_user,
    51     class     => \&BarnOwl::Complete::Zephyr::complete_class,
    52     instance  => \&BarnOwl::Complete::Zephyr::complete_instance,
    53     opcode    => \&BarnOwl::Complete::Zephyr::complete_opcode,
    54     realm     => \&BarnOwl::Complete::Zephyr::complete_realm,
    55     body      => undef,
    56     hostname  => undef,
    57     type      => sub { qw(zephyr aim admin); },
    58     direction => sub { qw(in out none); },
    59     login     => sub { qw(login logout none); },
    60     filter    => \&complete_filter_name,
    61     perl      => undef,
    62 );
    63 
    64 # Returns:
    65 # - where to look next after pulling out an expression
    66 # - $INCOMPLETE if this cannot form a complete expression (or w/e)
    67 # - pushes to completion list as it finds valid completions
    68 
    69 my $INCOMPLETE = -1;
    70 sub _complete_filter_expr {
    71     # Takes as arguments context and the index into $ctx->words where the
    72     # filter expression starts
    73     my $ctx = shift;
    74     my $start = shift;
    75     my $o_comp = shift;
    76     my $end = $ctx->word;
    77 
    78     # Grab an expression; we don't allow empty
    79     my $i = $start;
    80     $i = _complete_filter_primitive_expr($ctx, $start, $o_comp);
    81     return $INCOMPLETE if $start == $INCOMPLETE;
    82 
    83     while ($i <= $end) {
    84         if ($i == $end) {
    85             # We could and/or another clause
    86             push @$o_comp, qw(and or);
    87             return $end; # Or we could let the parent do his thing
    88         }
    89 
    90         if ($ctx->words->[$i] ne 'and' && $ctx->words->[$i] ne 'or') {
    91             return $i; # We're done. Let the parent do his thing
    92         }
    93 
    94         # Eat the and/or
    95         $i++;
    96 
    97         # Grab an expression
    98         $i = _complete_filter_primitive_expr($ctx, $i, $o_comp);
    99         return $INCOMPLETE if $i == $INCOMPLETE;
    100     }
    101    
    102     return $i; # Well, it looks like we're happy
    103     # (Actually, I'm pretty sure this never happens...)
    104 }
    105 
    106 sub _complete_filter_primitive_expr {
    107     my $ctx = shift;
    108     my $start = shift;
    109     my $o_comp = shift;
    110     my $end = $ctx->word;
    111 
    112     if ($start >= $end) {
    113         push @$o_comp, "(";
    114         push @$o_comp, qw(true false not);
    115         push @$o_comp, keys %filter_cmds;
    116         return $INCOMPLETE;
    117     }
    118 
    119     my $word = $ctx->words->[$start];
    120     if ($word eq "(") {
    121         $start = _complete_filter_expr($ctx, $start+1, $o_comp);
    122         return $INCOMPLETE if $start == $INCOMPLETE;
    123 
    124         # Now, we expect a ")"
    125         if ($start >= $end) {
    126             push @$o_comp, ")";
    127             return $INCOMPLETE;
    128         }
    129         if ($ctx->words->[$start] ne ')') {
    130             # User is being confusing. Give up.
    131             return $INCOMPLETE;
    132         }
    133         return $start+1; # Eat the )
    134     } elsif ($word eq "not") {
    135         # We just want another primitive expression
    136         return _complete_filter_primitive_expr($ctx, $start+1, $o_comp);
    137     } elsif ($word eq "true" || $word eq "false") {
    138         # No arguments
    139         return $start+1; # Eat the boolean. Mmmm, tasty.
    140     } else {
    141         # It's of the form 'CMD ARG'
    142         return $start+2 if ($start+1 < $end); # The user supplied the argument
    143 
    144         # complete the argument
    145         my $arg_func = $filter_cmds{$word};
    146         push @$o_comp, ($arg_func ? ($arg_func->()) : ());
    147         return $INCOMPLETE;
    148     }
    149 }
    150 
    151 sub complete_filter_expr {
    152     my $ctx = shift;
    153     my $start = shift;
    154     my @completions = ();
    155     _complete_filter_expr($ctx, $start, \@completions);
    156     # Get rid of duplicates and sort
    157     my %hash = ();
    158     @hash{@completions} = ();
    159     @completions = sort keys %hash;
    160     return @completions;
    161 }
    162 
    163 sub complete_filter_args {
    164     my $ctx = shift;
    165     my $arg = shift;
    166     return complete_filter_name() unless $arg;
    167     my $idx = 2; # skip the filter name
    168     while ($idx < $ctx->word) {
    169         last unless ($ctx->words->[$idx] =~ m{^-});
    170         $idx += 2; # skip the flag and the argument
    171     }
    172     return complete_filter_expr($ctx, $idx);
    173 }
    17447
    17548sub complete_help {
     
    19467sub complete_filter {
    19568    my $ctx = shift;
     69    # Syntax: filter FILTERNAME FLAGS EXPR
     70
     71    # FILTERNAME
     72    return complete_filter_name() if $ctx->word == 1;
     73
     74    # FLAGS
     75    $ctx = $ctx->shift_words(1); # complete_flags starts at the second word
    19676    return complete_flags($ctx,
    19777        [qw()],
     
    20080           "-b" => \&complete_color,
    20181        },
    202          \&complete_filter_args
     82        # EXPR
     83        sub {
     84            my $ctx = shift;
     85            my $arg = shift;
     86
     87            # We pass stop_at_nonflag, so we can rewind to the start
     88            my $idx = $ctx->word - $arg;
     89            $ctx = $ctx->shift_words($idx);
     90            return complete_filter_expr($ctx);
     91        },
     92        stop_at_nonflag => 1
    20393        );
    20494}
     
    213103    }
    214104    if ($ctx->words->[1] eq "-d") {
    215         return complete_filter_expr($ctx, 2);
     105        $ctx = $ctx->shift_words(2);
     106        return complete_filter_expr($ctx);
    216107    }
    217108    if ($ctx->words->[1] eq "-s") {
     
    243134}
    244135
     136sub complete_startup {
     137    my $ctx = shift;
     138    my $new_ctx = $ctx->shift_words(1);
     139    return BarnOwl::Completion::get_completions($new_ctx);
     140}
     141
    245142BarnOwl::Completion::register_completer(help    => \&complete_help);
    246143BarnOwl::Completion::register_completer(filter  => \&complete_filter);
     
    250147BarnOwl::Completion::register_completer(set     => \&complete_set);
    251148BarnOwl::Completion::register_completer(unset   => \&complete_set);
     149BarnOwl::Completion::register_completer(startup => \&complete_startup);
    252150
    2531511;
  • perl/lib/BarnOwl/Completion/Context.pm

    r7be5d8b re97c5d05  
    4040
    4141use base qw(Class::Accessor::Fast);
     42use Carp qw(croak);
    4243
    4344__PACKAGE__->mk_ro_accessors(qw(line point words word word_point
     
    6465       };
    6566    return bless($self, $class);
     67}
     68
     69=head2 shift_words N
     70
     71Returns a new C<Context> object, with the leading C<N> words
     72stripped. All fields are updated as appopriate. If C<N> > C<<
     73$self->word >>, C<croak>s with an error message.
     74
     75=cut
     76
     77sub shift_words {
     78    my $self = shift;
     79    my $n    = shift;
     80
     81    if($n > $self->word) {
     82        croak "Context::shift: Unable to shift $n words";
     83    }
     84
     85    my $before = substr($self->line, 0, $self->point);
     86    my $after  = substr($self->line, $self->point);
     87
     88    return BarnOwl::Completion::Context->new(BarnOwl::skiptokens($before, $n),
     89                                             $after);
    6690}
    6791
  • perl/lib/BarnOwl/Completion/Util.pm

    r94ef58c r69c27e6  
    2424    my $optsdone = 0;
    2525
     26    my %flags_seen;
     27
    2628    while($idx < $ctx->word) {
    2729        my $word = $ctx->words->[$idx];
     
    3739        } elsif ($word =~ m{^-}) {
    3840            $word = "-" . substr($word, -1);
     41            $flags_seen{$word} = 1; # record flag
    3942            $flag = $word if(exists $args->{$word});
    4043        } else {
     
    5861        return;
    5962    } else {
    60         return ($optsdone ? () : (@$no_args, keys %$args),
    61                 $default ? ($default->($ctx, $argct)) : ());
     63        my @opts = $optsdone ? () : (@$no_args, keys %$args);
     64        # filter out flags we've seen if needbe
     65        @opts = grep {!$flags_seen{$_}} @opts unless $options{repeat_flags};
     66        return (@opts, $default ? ($default->($ctx, $argct)) : ());
    6267    }
    6368}
  • perlglue.xs

    r1a5db78 r8830f79f  
    424424                RETVAL
    425425
     426const char *
     427skiptokens(str, n)
     428        const char *str;
     429        int n;
     430        CODE:
     431                RETVAL = skiptokens(str, n);
     432        OUTPUT:
     433                RETVAL
     434
     435
     436
    426437MODULE = BarnOwl                PACKAGE = BarnOwl::Internal
    427438
  • runtests.sh

    r2fa9a1a0 r42ad917  
    11#!/bin/sh
    2 prove t/
     2prove t/ --perl ./perl_tester
  • t/completion.t

    rb017b03 r1167bf1  
    88BEGIN {require (dirname($0) . "/mock.pl");};
    99
     10use BarnOwl::Complete::Filter qw(complete_filter_expr);
     11
    1012=head1 DESCRIPTION
    1113
     
    2022    my $after_point = shift;
    2123   
     24    my $ctx = BarnOwl::Completion::Context->new($before_point,
     25                                                $after_point);
     26    is($ctx->line, $before_point . $after_point);
     27    is($ctx->point, length $before_point);
     28
     29    test_ctx($ctx, @_);
     30}
     31
     32sub test_ctx {
     33    local $Test::Builder::Level = $Test::Builder::Level + 1;
     34
     35    my $ctx = shift;
     36
    2237    my $words = shift;
    2338    my $word = shift;
     
    2742    my $word_end   = shift;
    2843
    29     my $ctx = BarnOwl::Completion::Context->new($before_point,
    30                                                 $after_point);
    31 
    32     is($ctx->line, $before_point . $after_point);
    33     is($ctx->point, length $before_point);
    3444    is_deeply($ctx->words, $words);
    3545    if (defined($word)) {
     
    4151}
    4252
     53sub test_shift {
     54    local $Test::Builder::Level = $Test::Builder::Level + 1;
     55
     56    my $before_point = shift;
     57    my $after_point = shift;
     58    my $shift = shift;
     59   
     60    my $ctx = BarnOwl::Completion::Context->new($before_point,
     61                                                $after_point);
     62    $ctx = $ctx->shift_words($shift);
     63
     64    test_ctx($ctx, @_);
     65}
     66
    4367
    4468isa_ok(BarnOwl::Completion::Context->new('Hello, W', 'orld'), 'BarnOwl::Completion::Context');
     
    108132              1, -1, 7, 12);
    109133
     134## Test Context::shift
     135test_shift('lorem ipsum dolor ', 'sit amet', 0,
     136           [qw(lorem ipsum dolor sit amet)],
     137           3, 0, 18, 21);
     138
     139test_shift('lorem ipsum dolor ', 'sit amet', 1,
     140           [qw(ipsum dolor sit amet)],
     141           2, 0, 12, 15);
     142
     143test_shift('lorem ipsum dolor ', 'sit amet', 2,
     144           [qw(dolor sit amet)],
     145           1, 0, 6, 9);
     146
     147test_shift('lorem ipsum dolor ', 'sit amet', 3,
     148           [qw(sit amet)],
     149           0, 0, 0, 3);
     150
     151eval {
     152    my $before_point = 'lorem ipsum dolor';
     153    my $after_point = 'sit amet';
     154    my $shift = 4;
     155
     156    my $ctx = BarnOwl::Completion::Context->new($before_point,
     157                                                $after_point);
     158    $ctx = $ctx->shift_words($shift);
     159};
     160like($@, qr/^Context::shift: Unable to shift /, "Correctly die when shifting away the point");
    110161
    111162## Test common_prefix
     
    163214
    164215test_complete('zwrite -c nelhage ', '',
    165               [qw(-n -C -m -c -i -r -O nelhage asedeno geofft)]);
     216              [qw(-n -C -m -i -r -O nelhage asedeno geofft)]);
    166217
    167218test_complete('zwrite -c nelhage ', '-',
    168               [qw(-n -C -m -c -i -r -O nelhage asedeno geofft)]);
     219              [qw(-n -C -m -i -r -O nelhage asedeno geofft)]);
    169220
    170221test_complete('zwrite -c nelhage -- ', '',
     
    178229                              "-d" => sub {qw(some words for completing)},
    179230                          },
    180                           sub {$_[1]});
     231                          sub {$_[1]},
     232                          repeat_flags => 1);
    181233}
    182234
     
    203255              [qw(2)], \&complete_word);
    204256
     257
     258# Test the filter expression completer
     259test_complete('', '',
     260              [qw[( body class direction false filter hostname instance login not opcode perl realm recipient sender true type]],
     261              \&complete_filter_expr);
     262
     263test_complete('not ', '',
     264              [qw[( body class direction false filter hostname instance login not opcode perl realm recipient sender true type]],
     265              \&complete_filter_expr);
     266
     267test_complete('true ', '',
     268              [qw[and or]],
     269              \&complete_filter_expr);
     270
     271test_complete('( true ', '',
     272              [qw[and or )]],
     273              \&complete_filter_expr);
     274
     275test_complete('( body static and body analysis and not false and class davidben and ( instance python or instance hotd ', '',
     276              [qw[and or )]],
     277              \&complete_filter_expr);
     278
     279test_complete('type ', '',
     280              [qw[admin aim zephyr]],
     281              \&complete_filter_expr);
     282
     283test_complete('direction ', '',
     284              [qw[in out none]],
     285              \&complete_filter_expr);
     286
     287test_complete('login ', '',
     288              [qw[login logout none]],
     289              \&complete_filter_expr);
     290
    2052911;
    206292
  • t/mock.pl

    r776c4bb r42ad917  
    77use Carp;
    88
    9 sub bootstrap {}
    109sub get_data_dir {"."}
    1110sub get_config_dir {"."}
  • aim.c

    r36486be rc79a047  
    230230}
    231231
    232 void owl_aim_logged_out()
     232void owl_aim_logged_out(void)
    233233{
    234234  if (owl_global_is_aimloggedin(&g)) owl_function_adminmsg("", "Logged out of AIM");
     
    408408}
    409409
    410 int owl_aim_process_events()
     410int owl_aim_process_events(void)
    411411{
    412412  aim_session_t *aimsess;
     
    19951995}
    19961996
    1997 void owl_process_aim()
     1997void owl_process_aim(void)
    19981998{
    19991999  if (owl_global_is_doaimevents(&g)) {
  • commands.c

    r3e96ff0 r61de085  
    297297              "Print a znol-style listing of users logged in"),
    298298
    299   OWLCMD_ARGS("alist", owl_command_alist, OWL_CTX_INTERACTIVE,
     299  OWLCMD_VOID("alist", owl_command_alist, OWL_CTX_INTERACTIVE,
    300300              "List AIM users logged in",
    301301              "alist",
    302302              "Print a listing of AIM users logged in"),
    303303
    304   OWLCMD_ARGS("blist", owl_command_blist, OWL_CTX_INTERACTIVE,
     304  OWLCMD_VOID("blist", owl_command_blist, OWL_CTX_INTERACTIVE,
    305305              "List all buddies logged in",
    306306              "blist",
    307307              "Print a listing of buddies logged in, regardless of protocol."),
    308308
    309   OWLCMD_ARGS("toggle-oneline", owl_command_toggleoneline, OWL_CTX_INTERACTIVE,
     309  OWLCMD_VOID("toggle-oneline", owl_command_toggleoneline, OWL_CTX_INTERACTIVE,
    310310              "Toggle the style between oneline and the default style",
    311311              "toggle-oneline",
     
    995995};
    996996
    997 void owl_command_info()
     997void owl_command_info(void)
    998998{
    999999  owl_function_info();
    10001000}
    10011001
    1002 void owl_command_nop()
     1002void owl_command_nop(void)
    10031003{
    10041004}
     
    10171017char *owl_command_zlist(int argc, const char *const *argv, const char *buff)
    10181018{
    1019   int elapsed=0, timesort=0;
    10201019  const char *file=NULL;
    10211020
     
    10231022  argv++;
    10241023  while (argc) {
    1025     if (!strcmp(argv[0], "-e")) {
    1026       elapsed=1;
    1027       argc--;
    1028       argv++;
    1029     } else if (!strcmp(argv[0], "-t")) {
    1030       timesort=1;
    1031       argc--;
    1032       argv++;
    1033     } else if (!strcmp(argv[0], "-f")) {
     1024    if (!strcmp(argv[0], "-f")) {
    10341025      if (argc==1) {
    10351026        owl_function_makemsg("zlist: -f needs an argument");
     
    10481039}
    10491040
    1050 char *owl_command_alist()
     1041void owl_command_alist(void)
    10511042{
    10521043  owl_function_buddylist(1, 0, NULL);
    1053   return(NULL);
    1054 }
    1055 
    1056 char *owl_command_blist()
     1044}
     1045
     1046void owl_command_blist(void)
    10571047{
    10581048  owl_function_buddylist(1, 1, NULL);
    1059   return(NULL);
    1060 }
    1061 
    1062 char *owl_command_toggleoneline()
     1049}
     1050
     1051void owl_command_toggleoneline(void)
    10631052{
    10641053  owl_function_toggleoneline();
    1065   return(NULL);
    1066 }
    1067 
    1068 void owl_command_about()
     1054}
     1055
     1056void owl_command_about(void)
    10691057{
    10701058  owl_function_about();
    10711059}
    10721060
    1073 void owl_command_version()
     1061void owl_command_version(void)
    10741062{
    10751063  owl_function_makemsg("BarnOwl version %s", OWL_VERSION_STRING);
     
    13221310}
    13231311
    1324 void owl_command_expunge()
     1312void owl_command_expunge(void)
    13251313{
    13261314  owl_function_expunge();
    13271315}
    13281316
    1329 void owl_command_first()
     1317void owl_command_first(void)
    13301318{
    13311319  owl_global_set_rightshift(&g, 0);
     
    13331321}
    13341322
    1335 void owl_command_last()
     1323void owl_command_last(void)
    13361324{
    13371325  owl_function_lastmsg();
    13381326}
    13391327
    1340 void owl_command_resize()
     1328void owl_command_resize(void)
    13411329{
    13421330  owl_function_resize();
    13431331}
    13441332
    1345 void owl_command_redisplay()
     1333void owl_command_redisplay(void)
    13461334{
    13471335  owl_function_full_redisplay();
     
    13491337}
    13501338
    1351 void owl_command_shift_right()
     1339void owl_command_shift_right(void)
    13521340{
    13531341  owl_function_shift_right();
    13541342}
    13551343
    1356 void owl_command_shift_left()
     1344void owl_command_shift_left(void)
    13571345{
    13581346  owl_function_shift_left();
    13591347}
    13601348
    1361 void owl_command_unsuball()
     1349void owl_command_unsuball(void)
    13621350{
    13631351  owl_function_unsuball();
     
    13911379}
    13921380
    1393 void owl_command_suspend()
     1381void owl_command_suspend(void)
    13941382{
    13951383  owl_function_suspend();
     
    16751663}
    16761664
    1677 void owl_command_quit()
     1665void owl_command_quit(void)
    16781666{
    16791667  owl_function_quit();
     
    19871975#else
    19881976  owl_function_makemsg("This Owl does not support zcrypt");
     1977  return NULL;
    19891978#endif
    19901979}
     
    23132302}
    23142303
    2315 void owl_command_beep()
     2304void owl_command_beep(void)
    23162305{
    23172306  owl_function_beep();
  • configure.ac

    rd7cc50b rde8945b  
    44m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
    55
     6AC_CONFIG_MACRO_DIR([m4])
    67AC_CONFIG_HEADER([config.h])
    78
    89AC_PROG_CC
    9 
    10 dnl Check for Athena
    11 AC_MSG_CHECKING(for /usr/athena/include)
    12 if test -d /usr/athena/include; then
    13         CFLAGS=${CFLAGS}\ -I/usr/athena/include
    14         CPPFLAGS=${CPPFLAGS}\ -I/usr/athena/include
    15         AC_MSG_RESULT(yes)
    16 else
    17         AC_MSG_RESULT(no)
    18 fi
    19 AC_MSG_CHECKING(for /usr/athena/lib)
    20 if test -d /usr/athena/lib; then
    21         LDFLAGS=${LDFLAGS}\ -L/usr/athena/lib
    22         AC_MSG_RESULT(yes)
    23 else
    24         AC_MSG_RESULT(no)
    25 fi
    26 
    27 dnl Check for kerberosIV include
    28 AC_MSG_CHECKING(for kerberosIV)
    29 if test -d /usr/include/kerberosIV; then
    30         CFLAGS=${CFLAGS}\ -I/usr/include/kerberosIV
    31         CPPFLAGS=${CPPFLAGS}\ -I/usr/include/kerberosIV
    32         AC_MSG_RESULT(yes)
    33 elif test -d /usr/local/include/kerberosIV; then
    34         CFLAGS=${CFLAGS}\ -I/usr/local/include/kerberosIV
    35         CPPFLAGS=${CPPFLAGS}\ -I/usr/local/include/kerberosIV
    36         AC_MSG_RESULT(yes)
    37 elif test -d /usr/include/openssl; then
    38         CFLAGS=${CFLAGS}\ -I/usr/include/openssl
    39         CPPFLAGS=${CPPFLAGS}\ -I/usr/include/openssl
    40         AC_MSG_RESULT(OpenSSL DES found instead)
    41 else
    42         AC_MSG_RESULT(no)
    43 fi
    4410
    4511AC_ARG_WITH([stack-protector],
     
    5016
    5117AS_IF([test "x$with_stack_protector" != xno],
    52   [
    53     SAVE_CFLAGS=$CFLAGS
    54     CFLAGS="$CFLAGS -fstack-protector"
    55     AC_MSG_CHECKING(whether protection cflags work)
    56     AC_COMPILE_IFELSE(int i;,
    57         [AC_MSG_RESULT(yes)],
    58         [AC_MSG_RESULT(no)
    59         CFLAGS=$SAVE_CFLAGS
    60         if test "x$with_stack_protector" != xcheck; then
    61           AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.])
    62         fi])
    63     AC_CHECK_LIB(ssp, __stack_chk_guard)
    64   ])
     18  [AX_C_CHECK_FLAG([-fstack-protector],[],[],
     19    [CFLAGS="$CFLAGS -fstack-protector"],
     20    [if test "x$with_stack_protector" != xcheck; then
     21       AC_MSG_FAILURE([--with-stack-protector selected, but gcc does support it.])
     22     fi
     23    ])])
    6524
    6625AC_CHECK_LIB(ncursesw, initscr,, AC_MSG_ERROR(No libncursesw found.))
    67 AC_CHECK_LIB(com_err, com_err)
    68 AC_CHECK_LIB(nsl, gethostbyname)
    69 AC_CHECK_LIB(socket, socket)
    70 dnl AC_CHECK_LIB(des425, req_act_vno)
    71 AC_CHECK_LIB(des425, des_cbc_encrypt,,AC_CHECK_LIB(crypto,DES_cbc_encrypt))
    72 AC_CHECK_LIB(resolv, res_search)
     26AC_SEARCH_LIBS([gethostbyname], [nsl])
     27AC_SEARCH_LIBS([socket], [socket])
     28AC_SEARCH_LIBS([res_search], [resolv])
    7329
    7430AC_ARG_WITH([zephyr],
     
    7935
    8036AS_IF([test "x$with_zephyr" != xno],
    81   [AC_CHECK_LIB([zephyr], [ZGetSender],
     37  [AC_MSG_CHECKING([for Kerberos IV])
     38   AS_IF([krb5-config krb4 --libs >/dev/null 2>&1],
     39     [AC_MSG_RESULT([yes])
     40      AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV])
     41      CFLAGS="${CFLAGS} `krb5-config krb4 --cflags`"
     42      LIBS="${LIBS} `krb5-config krb4 --libs`"
     43     ],
     44     [AC_MSG_RESULT([no])
     45      PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
     46      CFLAGS="${CFLAGS} ${LIBCRYPTO_CFLAGS}"
     47      LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
     48     ])
     49   AC_CHECK_LIB([zephyr], [ZGetSender],
    8250   [LIBS="$LIBS -lzephyr"
    8351    AC_DEFINE([HAVE_LIBZEPHYR], [1],
     
    8654      AC_DEFINE([HAVE_LIBZEPHYR_ZINITLOCATIONINFO], [1],
    8755                [Have ZInitLocationInfo]),)
     56    AC_CHECK_LIB([com_err], [com_err])
     57    AC_CHECK_HEADERS([com_err.h])
    8858   ],
    8959   [if test "x$with_zephyr" != xcheck; then
     
    9363   ])])
    9464
    95 AC_CHECK_FUNCS(use_default_colors resizeterm des_string_to_key des_key_sched des_ecb_encrypt)
    96 AC_CHECK_FUNCS(                            DES_string_to_key  DES_ecb_encrypt DES_key_sched)
    97 
    98 AC_MSG_CHECKING(for des_ecb_encrypt prototype)
    99 AC_TRY_COMPILE([#include <des.h>
    100 int des_ecb_encrypt(char foo[], char bar[], des_key_schedule baz, int qux);],
    101 [int foo = des_ecb_encrypt(0,0,0,0);],
    102 ac_cv_des_ecb_encrypt_proto=no,
    103 ac_cv_des_ecb_encrypt_proto=yes)
    104 AC_MSG_RESULT($ac_cv_des_ecb_encrypt_proto)
    105 if test "$ac_cv_des_ecb_encrypt_proto" = yes; then
    106         AC_DEFINE([HAVE_DES_ECB_ENCRYPT_PROTO], [], [have proto for des_ecb_encrypt])
    107 fi
     65AC_CHECK_FUNCS([use_default_colors resizeterm])
     66AC_CHECK_FUNCS([des_string_to_key des_key_sched des_ecb_encrypt])
     67AC_CHECK_FUNCS([DES_string_to_key DES_ecb_encrypt DES_key_sched])
    10868
    10969dnl Checks for header files.
    11070AC_HEADER_STDC
    11171AC_HEADER_SYS_WAIT
    112 AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h com_err.h)
     72AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h)
    11373
    11474dnl Add CFLAGS for embeded perl
    115 FOO=`perl -MExtUtils::Embed -e ccopts`
    116 AC_MSG_NOTICE([Adding perl CFLAGS ${FOO}])
    117 CFLAGS=${CFLAGS}\ ${FOO}
     75PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
     76AC_MSG_NOTICE([Adding perl CFLAGS ${PERL_CFLAGS}])
     77CFLAGS="${CFLAGS} ${PERL_CFLAGS}"
    11878
    11979dnl Find the location of perl XSUBPP
     
    154114dnl Checks for typedefs, structures, and compiler characteristics.
    155115
     116AX_CFLAGS_WARN_ALL
     117AX_CFLAGS_STRICT_PROTOTYPES
     118
     119AX_C_CHECK_FLAG([-Wno-pointer-sign],[],[],
     120  [LIBFAIM_CFLAGS="$LIBFAIM_CFLAGS -Wno-pointer-sign"])
     121
     122AC_SUBST([LIBFAIM_CFLAGS])
     123
    156124AC_SUBST(XSUBPPDIR)
    157125AC_SUBST(XSUBPPFLAGS)
  • editwin.c

    r8459609 r2184001  
    466466  int index;
    467467  int count = 0;
    468   int point;
    469468  int n, i;
    470469  int last;
     
    475474  e->lock = 0; /* we can (must) tread on the locktext */
    476475
    477   point = e->index;
    478476  last = -1;
    479477  while (count < goal) {
     
    10731071    owl_editwin_exchange_point_and_mark(e);
    10741072
    1075   owl_editwin_replace(e, oe_copy_region(e), "");
     1073  owl_editwin_replace_internal(e, oe_copy_region(e), "");
    10761074}
    10771075
  • fmtext.c

    r89b2daf rf119757  
    272272  if (owl_global_get_hascolors(&g)) {
    273273      wcolor_set(w,pair,NULL);
     274      wbkgdset(w, COLOR_PAIR(pair));
    274275  }
    275276}
     
    344345      fg = f->default_fgcolor;
    345346      bg = f->default_bgcolor;
    346       while (p && owl_fmtext_is_format_char(g_utf8_get_char(p))) {
     347      while (owl_fmtext_is_format_char(g_utf8_get_char(p))) {
    347348        _owl_fmtext_update_attributes(g_utf8_get_char(p), &attr, &fg, &bg);
    348349        p = g_utf8_next_char(p);
     
    365366    waddstr(w, s);
    366367  }
     368  wbkgdset(w, 0);
    367369}
    368370
     
    418420/* Truncate the message so that each line begins at column 'acol' and
    419421 * ends at 'bcol' or sooner.  The first column is number 0.  The new
    420  * message is placed in 'out'.  The message is * expected to end in a
    421  * new line for now. NOTE: This needs to be modified to deal with
    422  * backing up if we find a SPACING COMBINING MARK at the end of a
    423  * line. If that happens, we should back up to the last non-mark
    424  * character and stop there.
     422 * message is placed in 'out'.  The message is expected to end in a
     423 * new line for now.
     424 *
     425 * NOTE: This needs to be modified to deal with backing up if we find
     426 * a SPACING COMBINING MARK at the end of a line. If that happens, we
     427 * should back up to the last non-mark character and stop there.
     428 *
     429 * NOTE: If a line ends at bcol, we omit the newline. This is so printing
     430 * to ncurses works.
    425431 */
    426432void owl_fmtext_truncate_cols(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out)
     
    826832
    827833/* Reset used list */
    828 void owl_fmtext_reset_colorpairs()
     834void owl_fmtext_reset_colorpairs(void)
    829835{
    830836  if (owl_global_get_hascolors(&g)) {
  • functions.c

    r27964fe r340c3e7  
    4444}
    4545
    46 void owl_function_show_commands()
     46void owl_function_show_commands(void)
    4747{
    4848  owl_list l;
     
    7878}
    7979
    80 void owl_function_show_styles() {
     80void owl_function_show_styles(void) {
    8181  owl_list l;
    8282  owl_fmtext fm;
     
    120120}
    121121
    122 void owl_function_show_license()
     122void owl_function_show_license(void)
    123123{
    124124  const char *text;
     
    166166}
    167167
    168 void owl_function_show_quickstart()
     168void owl_function_show_quickstart(void)
    169169{
    170170    const char *message =
     
    357357}
    358358
    359 void owl_function_loopwrite_setup()
     359void owl_function_loopwrite_setup(void)
    360360{
    361361  owl_editwin *e;
     
    472472  owl_zwrite_set_message(&z, cryptmsg);
    473473  owl_zwrite_set_opcode(&z, "crypt");
    474   mymsg=cryptmsg;
    475474   
    476475  owl_zwrite_send_message(&z);
     
    646645void owl_function_prevmsg_full(const char *filter, int skip_deleted, int first_if_none)
    647646{
    648   int curmsg, i, viewsize, found;
     647  int curmsg, i, found;
    649648  const owl_view *v;
    650649  const owl_filter *f = NULL;
     
    662661
    663662  curmsg=owl_global_get_curmsg(&g);
    664   viewsize=owl_view_get_size(v);
    665663  found=0;
    666664
     
    693691}
    694692
    695 void owl_function_nextmsg()
     693void owl_function_nextmsg(void)
    696694{
    697695  owl_function_nextmsg_full(NULL, 0, 1);
    698696}
    699697
    700 void owl_function_prevmsg()
     698void owl_function_prevmsg(void)
    701699{
    702700  owl_function_prevmsg_full(NULL, 0, 1);
    703701}
    704702
    705 void owl_function_nextmsg_notdeleted()
     703void owl_function_nextmsg_notdeleted(void)
    706704{
    707705  owl_function_nextmsg_full(NULL, 1, 1);
    708706}
    709707
    710 void owl_function_prevmsg_notdeleted()
     708void owl_function_prevmsg_notdeleted(void)
    711709{
    712710  owl_function_prevmsg_full(NULL, 1, 1);
     
    772770}
    773771
    774 void owl_function_expunge()
     772void owl_function_expunge(void)
    775773{
    776774  int curmsg;
     
    808806}
    809807
    810 void owl_function_firstmsg()
     808void owl_function_firstmsg(void)
    811809{
    812810  owl_global_set_curmsg(&g, 0);
     
    816814}
    817815
    818 void owl_function_lastmsg_noredisplay()
     816void owl_function_lastmsg_noredisplay(void)
    819817{
    820818  int oldcurmsg, curmsg;
     
    838836}
    839837
    840 void owl_function_lastmsg()
     838void owl_function_lastmsg(void)
    841839{
    842840  owl_function_lastmsg_noredisplay();
     
    844842}
    845843
    846 void owl_function_shift_right()
     844void owl_function_shift_right(void)
    847845{
    848846  owl_global_set_rightshift(&g, owl_global_get_rightshift(&g)+10);
     
    851849}
    852850
    853 void owl_function_shift_left()
     851void owl_function_shift_left(void)
    854852{
    855853  int shift;
     
    866864}
    867865
    868 void owl_function_unsuball()
     866void owl_function_unsuball(void)
    869867{
    870868  unsuball();
     
    946944}
    947945
    948 void owl_function_suspend()
     946void owl_function_suspend(void)
    949947{
    950948  endwin();
     
    956954}
    957955
    958 void owl_function_zaway_toggle()
     956void owl_function_zaway_toggle(void)
    959957{
    960958  if (!owl_global_is_zaway(&g)) {
     
    966964}
    967965
    968 void owl_function_zaway_on()
     966void owl_function_zaway_on(void)
    969967{
    970968  owl_global_set_zaway_on(&g);
     
    972970}
    973971
    974 void owl_function_zaway_off()
     972void owl_function_zaway_off(void)
    975973{
    976974  owl_global_set_zaway_off(&g);
     
    978976}
    979977
    980 void owl_function_aaway_toggle()
     978void owl_function_aaway_toggle(void)
    981979{
    982980  if (!owl_global_is_aaway(&g)) {
     
    988986}
    989987
    990 void owl_function_aaway_on()
     988void owl_function_aaway_on(void)
    991989{
    992990  owl_global_set_aaway_on(&g);
     
    995993}
    996994
    997 void owl_function_aaway_off()
     995void owl_function_aaway_off(void)
    998996{
    999997  owl_global_set_aaway_off(&g);
     
    10021000}
    10031001
    1004 void owl_function_quit()
     1002void owl_function_quit(void)
    10051003{
    10061004  char *ret;
     
    12271225}
    12281226
    1229 void owl_function_resize()
     1227void owl_function_resize(void)
    12301228{
    12311229  owl_global_set_resize_pending(&g);
    12321230}
    12331231
    1234 void owl_function_run_buffercommand()
     1232void owl_function_run_buffercommand(void)
    12351233{
    12361234  owl_editwin_do_callback(owl_global_get_typwin(&g));
     
    12641262}
    12651263
    1266 void owl_function_beep()
     1264void owl_function_beep(void)
    12671265{
    12681266  if (owl_global_is_bell(&g)) {
     
    13021300}
    13031301
    1304 void owl_function_full_redisplay()
     1302void owl_function_full_redisplay(void)
    13051303{
    13061304  redrawwin(owl_global_get_curs_recwin(&g));
     
    13841382}
    13851383
    1386 void owl_function_about()
     1384void owl_function_about(void)
    13871385{
    13881386  owl_function_popless_text(
     
    14101408}
    14111409
    1412 void owl_function_info()
     1410void owl_function_info(void)
    14131411{
    14141412  const owl_message *m;
     
    15451543 * style the user may be using
    15461544 */
    1547 void owl_function_curmsg_to_popwin()
     1545void owl_function_curmsg_to_popwin(void)
    15481546{
    15491547  const owl_view *v;
     
    16281626}
    16291627
    1630 void owl_function_mainwin_pagedown()
     1628void owl_function_mainwin_pagedown(void)
    16311629{
    16321630  int i;
     
    16431641}
    16441642
    1645 void owl_function_mainwin_pageup()
     1643void owl_function_mainwin_pageup(void)
    16461644{
    16471645  owl_global_set_curmsg(&g, owl_global_get_topmsg(&g));
     
    16491647}
    16501648
    1651 void owl_function_getsubs()
     1649void owl_function_getsubs(void)
    16521650{
    16531651  char *buff;
     
    16641662}
    16651663
    1666 void owl_function_printallvars()
     1664void owl_function_printallvars(void)
    16671665{
    16681666  const char *name;
     
    16911689}
    16921690
    1693 void owl_function_show_variables()
     1691void owl_function_show_variables(void)
    16941692{
    16951693  owl_list varnames;
     
    17451743}
    17461744
    1747 void owl_function_delete_automsgs()
     1745void owl_function_delete_automsgs(void)
    17481746{
    17491747  /* mark for deletion all messages in the current view that match the
     
    17781776}
    17791777
    1780 void owl_function_status()
     1778void owl_function_status(void)
    17811779{
    17821780  char buff[MAXPATHLEN+1];
     
    18581856}
    18591857
    1860 void owl_function_show_term()
     1858void owl_function_show_term(void)
    18611859{
    18621860  owl_fmtext fm;
     
    22712269}
    22722270
    2273 void owl_function_show_filters()
     2271void owl_function_show_filters(void)
    22742272{
    22752273  const owl_list *l;
     
    23162314}
    23172315
    2318 void owl_function_show_zpunts()
     2316void owl_function_show_zpunts(void)
    23192317{
    23202318  const owl_filter *f;
     
    27492747}
    27502748
    2751 void owl_function_show_colors()
     2749void owl_function_show_colors(void)
    27522750{
    27532751  owl_fmtext fm;
     
    28992897}
    29002898
    2901 void owl_function_show_keymaps()
     2899void owl_function_show_keymaps(void)
    29022900{
    29032901  owl_list l;
     
    31933191void owl_function_dump(const char *filename)
    31943192{
    3195   int i, j, count;
     3193  int i, j;
    31963194  owl_message *m;
    31973195  const owl_view *v;
     
    32163214  }
    32173215
    3218   count=0;
    32193216  j=owl_view_get_size(v);
    32203217  for (i=0; i<j; i++) {
     
    33793376}
    33803377
    3381 void owl_function_toggleoneline()
     3378void owl_function_toggleoneline(void)
    33823379{
    33833380  owl_view *v;
     
    34003397void owl_function_error(const char *fmt, ...)
    34013398{
     3399  static int in_error = 0;
    34023400  va_list ap;
    34033401  char *buff;
    34043402  const char *nl;
    34053403
     3404  if (++in_error > 2) {
     3405    /* More than two nested errors, bail immediately. */
     3406    in_error--;
     3407    return;
     3408  }
     3409
    34063410  va_start(ap, fmt);
    3407 
    34083411  buff = g_strdup_vprintf(fmt, ap);
     3412  va_end(ap);
     3413
    34093414  owl_function_debugmsg("ERROR: %s", buff);
     3415  owl_function_log_err(buff);
     3416
    34103417  nl = strchr(buff, '\n');
    3411   if(nl && *(nl + 1)) {
     3418
     3419  /*
     3420    Showing admin messages triggers a lot of code. If we have a
     3421    recursive error call, that's the most likely candidate, so
     3422    suppress the call in that case, to try to avoid infinite looping.
     3423  */
     3424
     3425  if(nl && *(nl + 1) && in_error == 1) {
    34123426    /* Multiline error */
    34133427    owl_function_adminmsg("ERROR", buff);
     
    34153429    owl_function_makemsg("[Error] %s", buff);
    34163430  }
    3417   owl_function_log_err(buff);
    3418   va_end(ap);
     3431
    34193432  owl_free(buff);
     3433
     3434  in_error--;
    34203435}
    34213436
     
    34383453}
    34393454
    3440 void owl_function_showerrs()
     3455void owl_function_showerrs(void)
    34413456{
    34423457  owl_fmtext fm;
     
    35523567}
    35533568
    3554 int owl_function_get_color_count()
     3569int owl_function_get_color_count(void)
    35553570{
    35563571     return COLORS;
     
    35793594}
    35803595
    3581 void owl_function_mark_message()
     3596void owl_function_mark_message(void)
    35823597{
    35833598  const owl_message *m;
     
    35983613}
    35993614
    3600 void owl_function_swap_cur_marked()
     3615void owl_function_swap_cur_marked(void)
    36013616{
    36023617  int marked_id;
  • global.c

    r27f6487 r40bda84  
    115115  g->timerlist = NULL;
    116116  g->interrupted = FALSE;
     117  g->got_sigtstp = FALSE;
    117118}
    118119
     
    482483  sepbar(NULL);
    483484  owl_editwin_redisplay(g->tw, 0);
    484   owl_function_full_redisplay(&g);
     485  owl_function_full_redisplay();
    485486
    486487  /* TODO: this should handle other forms of popwins */
     
    968969  g->interrupted = 0;
    969970}
     971
     972int owl_global_is_sigstp(const owl_global *g) {
     973  return g->got_sigtstp;
     974}
     975
     976void owl_global_set_got_sigstp(owl_global *g) {
     977  g->got_sigtstp = 1;
     978}
     979
     980void owl_global_unset_got_sigstp(owl_global *g) {
     981  g->got_sigtstp = 0;
     982}
  • help.c

    re19eb97 rc79a047  
    22#include <string.h>
    33
    4 void owl_help()
     4void owl_help(void)
    55{
    66  owl_fmtext fm;
  • keys.c

    r65a9870 rdbe172d  
    349349
    350350  if (pw && owl_popwin_is_active(pw) && v) {
     351    owl_popwin_refresh(pw);
    351352    owl_viewwin_redisplay(v, 1);
    352353  } 
  • libfaim/Makefile.am

    red62482 r215c119  
    1010     aim_cbtypes.h  aim.h  aim_internal.h  faimconfig.h md5.h
    1111
     12libfaim_a_CFLAGS = $(LIBFAIM_CFLAGS)
    1213libfaim_a_CPPFLAGS = -DAIM_BUILDDATE=\"x\" -DAIM_BUILDTIME=\"x\" \
    1314                     -I${top_srcdir}/libfaim
  • logging.c

    re2ebf39 rc79a047  
    179179
    180180  /* create a present message so we can pass it to
    181    * owl_log_shouldlog_message()
     181   * owl_log_shouldlog_message(void)
    182182   */
    183183  m = owl_malloc(sizeof(owl_message));
  • mainwin.c

    r9e5c9f3 r9bda818  
    3232
    3333  recwinlines=owl_global_get_recwin_lines(&g);
    34   topmsg=owl_global_get_topmsg(&g);
    3534  viewsize=owl_view_get_size(v);
    3635
  • message.c

    r24ccc01 rc79a047  
    1414static owl_fmtext_cache * fmtext_cache_next = fmtext_cache;
    1515
    16 void owl_message_init_fmtext_cache ()
     16void owl_message_init_fmtext_cache(void)
    1717{
    1818    int i;
     
    2323}
    2424
    25 owl_fmtext_cache * owl_message_next_fmtext() /*noproto*/
     25owl_fmtext_cache *owl_message_next_fmtext(void) /*noproto*/
    2626{
    2727    owl_fmtext_cache * f = fmtext_cache_next;
  • owl.c

    r4e4847c r40bda84  
    4646} owl_options;
    4747
    48 void usage()
     48void usage(void)
    4949{
    5050  fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
     
    378378}
    379379
     380void sigtstp_handler(int sig, siginfo_t *si, void *data)
     381{
     382  owl_global_set_got_sigstp(&g);
     383}
     384
    380385void owl_register_signal_handlers(void) {
    381386  struct sigaction sigact;
     
    395400  sigaction(SIGINT, &sigact, NULL);
    396401
     402  sigact.sa_sigaction=sigtstp_handler;
     403  sigaction(SIGTSTP, &sigact, NULL);
    397404}
    398405
  • owl.h

    r24ccc01 r40bda84  
    588588  int load_initial_subs;
    589589  int interrupted;
     590  int got_sigtstp;
    590591} owl_global;
    591592
  • perl/lib/BarnOwl.pm

    r7589f0a rde3f641  
    427427}
    428428
     429=head3 default_zephyr_signature
     430
     431Compute the default zephyr signature.
     432
     433=cut
     434
     435sub default_zephyr_signature
     436{
     437  if (my $zsig = getvar('zsig')) {
     438    return $zsig;
     439  }
     440  if (my $zsigproc = getvar('zsigproc')) {
     441    return `$zsigproc`;
     442  }
     443  my $zwrite_signature = get_zephyr_variable('zwrite-signature');
     444  if (defined($zwrite_signature)) {
     445    return $zwrite_signature;
     446  }
     447  my $name = ((getpwuid($<))[6]);
     448  $name =~ s/,.*//;
     449  return $name;
     450}
     451
    429452# Stub for owl::startup / BarnOwl::startup, so it isn't bound to the
    430453# startup command. This may be redefined in a user's configfile.
  • perl/lib/BarnOwl/Complete/Zephyr.pm

    rfdc0c47 r9300fe5  
    4545    my $m = shift;
    4646    return unless $m->type eq 'zephyr';
    47     $classes{$m->class} = 1;
    48     $realms{$m->realm} = 1;
    49     $users{BarnOwl::Message::Zephyr::strip_realm($m->sender)} = 1;
     47    $classes{lc $m->class} = 1;
     48    $realms{lc $m->realm} = 1;
     49    $users{lc BarnOwl::Message::Zephyr::strip_realm($m->sender)} = 1;
    5050}
    5151
  • perl/lib/BarnOwl/Hooks.pm

    r03e25c5 re2f7963  
    196196    my $package = "BarnOwl";
    197197
     198
     199    if(!contains(\@BarnOwl::all_commands, $command)) {
     200        push @BarnOwl::all_commands, $command;
     201    }
     202
    198203    if($symbol =~ m{^edit:(.+)$}) {
    199204        $symbol = $1;
     
    222227        }
    223228    }
    224 
    225     if(!contains(\@BarnOwl::all_commands, $command)) {
    226         push @BarnOwl::all_commands, $command;
    227     }
    228229}
    229230
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Completion.pm

    r216b1d0 r955a36e  
    66use BarnOwl::Completion::Util qw(complete_flags);
    77
    8 my %networks = ();
    9 my %dests = ();
    10 my %servers = ();
     8our %users = ();
     9our %servers = ();
    1110
    12 sub complete_networks { keys %networks }
    13 sub complete_dests    { keys %dests }
    14 sub complete_channels { grep /^#/, keys %dests }
    15 sub complete_nicks    { grep /^[^#]/, keys %dests }
     11sub complete_networks { keys %BarnOwl::Module::IRC::ircnets }
     12sub complete_dests    { keys %users, complete_channels() }
     13sub complete_channels { keys %BarnOwl::Module::IRC::channels }
     14sub complete_nicks    { keys %users }
    1615sub complete_servers  { keys %servers }
    1716
     
    7574    my $m = shift;
    7675    return unless $m->type eq 'IRC';
    77     $networks{$m->network} = 1;
    78     $dests{$m->recipient} = 1;
    79     $dests{$m->sender} = 1;
     76    if ($m->recipient && $m->recipient !~ m{^#}) {
     77        $users{$m->recipient} = 1;
     78    }
     79    if ($m->sender && $m->sender !~ m{^#}) {
     80        $users{$m->sender} = 1;
     81    }
    8082    $servers{$m->server} = 1;
    8183}
  • perlconfig.c

    reea72a13 r1373d35  
    2626{
    2727  SV *ret = newSVpv(str, 0);
    28   if(is_utf8_string(str, strlen(str))) {
     28  if(is_utf8_string((U8*)str, strlen(str))) {
    2929    SvUTF8_on(ret);
    3030  } else {
     
    523523  if(cb == NULL) {
    524524    owl_function_error("Perl callback is NULL!");
     525    return;
    525526  }
    526527  text = owl_new_sv(owl_editwin_get_text(e));
     
    546547}
    547548
    548 void owl_perlconfig_mainloop()
     549void owl_perlconfig_mainloop(owl_timer *t, void *data)
    549550{
    550551  dSP;
  • popwin.c

    r9c01a5e r8240bce  
    6262  owl_global_set_needrefresh(&g);
    6363  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    64   owl_function_full_redisplay(&g);
     64  owl_function_full_redisplay();
    6565  return(0);
    6666}
  • scripts/do-release

    rb9df757 r168f8a9  
    77
    88force=
     9no_tag=
    910
    10 if [ "$1" = "-f" ]; then
    11     force=1
    12 fi
     11for arg; do
     12    case $arg in
     13        -f) force=1 ;;
     14        --no-tag) no_tag=1 ;;
     15    esac
     16done
    1317
    1418VERS=$(perl -ne 'print $1 if m{^AC_INIT\(\[[^\]]+\],\s*\[([^\]]+)\]}' configure.ac) \
     
    2125fi
    2226
    23 if git cat-file -t "$TAG" > /dev/null 2>&1; then
    24     die "Error: Object $TAG already exists."
     27if ! [ "$no_tag" ]; then
     28    if git cat-file -t "$TAG" > /dev/null 2>&1; then
     29        die "Error: Object $TAG already exists."
     30    fi
     31
     32    git tag -s -m "BarnOwl $VERS" "$TAG"
     33else
     34    TAG=HEAD
    2535fi
    2636
     
    2838for sig in 1 2 13 15; do trap "exit $(($sig + 128))" $sig; done
    2939trap 'exittrap' EXIT
    30 
    31 git tag -s -m "BarnOwl $VERS" "$TAG"
    3240
    3341TMPDIR=$(mktemp -d /tmp/barnowl.XXXXXX)
  • select.c

    r27f6487 r40bda84  
    152152}
    153153
    154 int owl_select_dispatch_count()
     154int owl_select_dispatch_count(void)
    155155{
    156156  return owl_list_get_size(owl_global_get_dispatchlist(&g));
     
    205205  FD_ZERO(e);
    206206  max_fd = 0;
    207   len = owl_select_dispatch_count(g);
     207  len = owl_select_dispatch_count();
    208208  for(i = 0; i < len; i++) {
    209209    d = owl_list_get_element(dl, i);
     
    215215}
    216216
    217 void owl_select_gc()
     217void owl_select_gc(void)
    218218{
    219219  int i;
     
    325325}
    326326
    327 void owl_select_handle_intr()
     327void owl_select_mask_signals(sigset_t *oldmask) {
     328  sigset_t set;
     329
     330  sigemptyset(&set);
     331  sigaddset(&set, SIGINT);
     332  sigaddset(&set, SIGTSTP);
     333  sigprocmask(SIG_BLOCK, &set, oldmask);
     334}
     335
     336void owl_select_handle_intr(sigset_t *restore)
    328337{
    329338  owl_input in;
    330339
    331340  owl_global_unset_interrupted(&g);
    332   owl_function_unmask_sigint(NULL);
     341
     342  sigprocmask(SIG_SETMASK, restore, NULL);
    333343
    334344  in.ch = in.uch = owl_global_get_startup_tio(&g)->c_cc[VINTR];
     
    336346}
    337347
    338 void owl_select()
     348void owl_select_check_tstp() {
     349  if(owl_global_is_sigstp(&g)) {
     350    owl_function_makemsg("Use :suspend to suspend.");
     351    owl_global_unset_got_sigstp(&g);
     352  }
     353}
     354
     355void owl_select(void)
    339356{
    340357  int i, max_fd, aim_max_fd, aim_done, ret;
     
    347364  owl_select_process_timers(&timeout);
    348365
    349   owl_function_mask_sigint(&mask);
     366  owl_select_mask_signals(&mask);
     367
     368  owl_select_check_tstp();
    350369  if(owl_global_is_interrupted(&g)) {
    351     owl_select_handle_intr();
     370    owl_select_handle_intr(&mask);
    352371    return;
    353372  }
     
    381400  /* END AIM HACK */
    382401
    383 
    384402  ret = pselect(max_fd+1, &r, &aim_wfds, &e, &timeout, &mask);
    385403
    386404  if(ret < 0 && errno == EINTR) {
     405    owl_select_check_tstp();
    387406    if(owl_global_is_interrupted(&g)) {
    388       owl_select_handle_intr();
    389     }
     407      owl_select_handle_intr(NULL);
     408    }
     409    sigprocmask(SIG_SETMASK, &mask, NULL);
    390410    return;
    391411  }
    392412
    393   owl_function_unmask_sigint(NULL);
     413  sigprocmask(SIG_SETMASK, &mask, NULL);
    394414
    395415  if(ret > 0) {
  • text.c

    re19eb97 rebbeb39  
    316316  toquote_len=strlen(toquote);
    317317  quotestr_len=strlen(quotestr);
    318   out=owl_malloc((in_len*quotestr_len)+30);
    319318  place=0;
    320319  escape = 0;
  • util.c

    reea72a13 rf119757  
    454454
    455455/* Get the default tty name.  Caller must free the return */
    456 char *owl_util_get_default_tty()
     456char *owl_util_get_default_tty(void)
    457457{
    458458  const char *tmp;
     
    475475
    476476/* Animation hack */
    477 void owl_hack_animate()
     477void owl_hack_animate(void)
    478478{
    479479  const owl_messagelist *ml;
     
    557557 * inefficient impelementation which reads the entire file into
    558558 * memory.
     559 *
     560 * Returns the number of lines removed
    559561 */
    560 void owl_util_file_deleteline(const char *filename, const char *line, int backup)
     562int owl_util_file_deleteline(const char *filename, const char *line, int backup)
    561563{
    562564  char buff[LINE], *text;
     
    564566  FILE *file, *backupfile=NULL;
    565567  int size, newline;
     568  int numremoved = 0;
    566569
    567570  /* open the file for reading */
     
    569572  if (!file) {
    570573    owl_function_error("Error opening file %s", filename);
    571     return;
     574    return 0;
    572575  }
    573576
     
    580583      owl_free(backupfilename);
    581584      fclose(file);
    582       return;
     585      return 0;
    583586    }
    584587  }
     
    604607      strcat(text, buff);
    605608      if (newline) strcat(text, "\n");
     609    } else {
     610      numremoved++;
    606611    }
    607612
     
    628633    owl_free(backupfilename);
    629634  owl_free(text);
     635
     636  return numremoved;
    630637}
    631638
     
    664671}
    665672
    666 const char * owl_get_datadir()
     673const char * owl_get_datadir(void)
    667674{
    668675  const char * datadir = getenv("BARNOWL_DATA_DIR");
     
    689696        strncat(r, s, p-s);
    690697        p = g_utf8_next_char(p);
    691         while (p && owl_fmtext_is_format_char(g_utf8_get_char(p))) {
     698        while (owl_fmtext_is_format_char(g_utf8_get_char(p))) {
    692699          p = g_utf8_next_char(p);
    693700        }
  • variable.c

    r8bce750 rde3f641  
    208208         "principal. Note that customizing the sender name will\n"
    209209         "cause your zephyrs to be sent unauthenticated."),
     210
     211  OWLVAR_STRING( "zsigfunc" /* %OwlVarStub */, "BarnOwl::default_zephyr_signature()",
     212                 "zsig perl function",
     213                 "Called every time you start a zephyrgram without an\n"
     214                 "explicit zsig.  The default setting implements the policy\n"
     215                 "descripted in the documentation for the 'zsig' variable.\n"),
    210216
    211217  OWLVAR_STRING( "zsig" /* %OwlVarStub */, "",
  • viewwin.c

    r4083c49 rdd6af02  
    3535void owl_viewwin_init_fmtext(owl_viewwin *v, WINDOW *win, int winlines, int wincols, const owl_fmtext *fmtext)
    3636{
     37  char *text;
     38
    3739  owl_fmtext_copy(&(v->fmtext), fmtext);
     40  text = owl_fmtext_print_plain(fmtext);
     41  if (text[0] != '\0' && text[strlen(text) - 1] != '\n') {
     42      owl_fmtext_append_normal(&(v->fmtext), "\n");
     43  }
    3844  v->textlines=owl_fmtext_num_lines(&(v->fmtext));
    3945  v->topline=0;
  • zcrypt.c

    r36486be ra6ac9fe  
    2323#include <unistd.h>
    2424#include <sys/types.h>
    25 #include <des.h>
     25
     26#ifdef HAVE_KERBEROS_IV
     27#include <kerberosIV/des.h>
     28#else
     29#include <openssl/des.h>
     30#endif
    2631
    2732#define MAX_KEY 128
     
    5156char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
    5257
    53 #ifndef HAVE_DES_ECB_ENCRYPT_PROTO
    54 int des_ecb_encrypt(char [], char [], des_key_schedule, int);
    55 #endif
    56 
    5758#define M_NONE            0
    5859#define M_ZEPHYR_ENCRYPT  1
     
    6162#define M_RANDOMIZE       4
    6263#define M_SETKEY          5
     64
     65static void owl_zcrypt_string_to_schedule(char *keystring, des_key_schedule schedule) {
     66#ifdef HAVE_KERBEROS_IV
     67  des_cblock key;
     68#else
     69  des_cblock _key, *key = &_key;
     70#endif
     71
     72  des_string_to_key(keystring, key);
     73  des_key_sched(key, schedule);
     74}
    6375
    6476/* The 'owl_zcrypt_decrypt' function was written by kretch for Owl.
     
    7385  char *fname, keystring[MAX_KEY];
    7486  FILE *fkey;
    75   des_cblock key;
    7687  des_key_schedule schedule;
    77   char input[8], output[9];
     88  unsigned char input[8], output[8];
    7889  int i, c1, c2;
    7990 
     
    8293  fkey=fopen(fname, "r");
    8394  if (!fkey) return(-1);
    84   fgets(keystring, MAX_KEY-1, fkey);
     95  if (!fgets(keystring, MAX_KEY-1, fkey)) {
     96    fclose(fkey);
     97    return -1;
     98  }
    8599  fclose(fkey);
    86100
     
    88102
    89103  output[0] = '\0';    /* In case no message at all                 */
    90   output[8] = '\0';    /* NULL at end will limit string length to 8 */
    91 
    92   des_string_to_key(keystring, key);
    93   des_key_sched(key, schedule);
     104
     105  owl_zcrypt_string_to_schedule(keystring, schedule);
    94106
    95107  inptr=in;
     
    102114      inptr+=2;
    103115    }
    104     des_ecb_encrypt(input, output, schedule, FALSE);
    105     strcat(out, output);
    106   }
    107 
    108   if (output[0]) {
    109     if (output[strlen(output)-1] != '\n') {
    110       strcat(out, "\n");
    111     }
    112   } else {
     116    des_ecb_encrypt(&input, &output, schedule, FALSE);
     117    strncat(out, (const char *)output, 8);
     118  }
     119
     120  if (out[0] && out[strlen(out) - 1] != '\n')
    113121    strcat(out, "\n");
    114   }
    115122  return(0);
    116123}
     
    119126  char *fname, keystring[MAX_KEY];
    120127  FILE *fkey;
    121   des_cblock key;
    122128  des_key_schedule schedule;
    123   char input[8], output[8];
     129  unsigned char input[8], output[8];
    124130  int size, length, i;
    125131  const char *inbuff = NULL, *inptr;
    126   int use_buffer = FALSE;
    127132  int num_blocks=0, last_block_size=0;
    128133
     
    131136  fkey=fopen(fname, "r");
    132137  if (!fkey) return(-1);
    133   fgets(keystring, MAX_KEY-1, fkey);
     138  if (!fgets(keystring, MAX_KEY-1, fkey)) {
     139    fclose(fkey);
     140    return -1;
     141  }
    134142  fclose(fkey);
    135143
    136   des_string_to_key(keystring, key);
    137   des_key_sched(key, schedule);
     144  owl_zcrypt_string_to_schedule(keystring, schedule);
    138145
    139146  inbuff=in;
     
    141148  num_blocks=(length+7)/8;
    142149  last_block_size=((length+7)%8)+1;
    143   use_buffer=TRUE;
    144150
    145151  strcpy(out, "");
     
    167173
    168174    /* Encrypt and output the block */
    169     des_ecb_encrypt(input, output, schedule, TRUE);
     175    des_ecb_encrypt(&input, &output, schedule, TRUE);
    170176
    171177    for (i = 0; i < 8; i++) {
     
    216222    /* Scan file for a match */
    217223    while (!feof(fsearch)) {
    218       fgets(buffer, MAX_BUFF - 3, fsearch);
     224      if (!fgets(buffer, MAX_BUFF - 3, fsearch)) break;
    219225      for (i = 0; i < numsearch; i++) {
    220226        if (strncasecmp(varname[i], buffer, length[i]) == 0) {
     
    262268}
    263269
    264 static pid_t zephyrpipe_pid = 0;
    265 
    266 #endif
     270#endif
  • zephyr.c

    re440602 rc79a047  
    1515} owl_sub_list;
    1616
    17 Code_t ZResetAuthentication();
     17Code_t ZResetAuthentication(void);
    1818#endif
    1919
     
    2121
    2222#ifdef HAVE_LIBZEPHYR
    23 void owl_zephyr_initialize()
     23void owl_zephyr_initialize(void)
    2424{
    2525  int ret;
     
    127127}
    128128
    129 void owl_zephyr_load_initial_subs() {
     129void owl_zephyr_load_initial_subs(void) {
    130130  int ret_sd, ret_bd, ret_u;
    131131
     
    154154}
    155155#else
    156 void owl_zephyr_initialize()
    157 {
    158 }
    159 #endif
    160 
    161 
    162 int owl_zephyr_shutdown()
     156void owl_zephyr_initialize(void)
     157{
     158}
     159#endif
     160
     161
     162int owl_zephyr_shutdown(void)
    163163{
    164164#ifdef HAVE_LIBZEPHYR
     
    171171}
    172172
    173 int owl_zephyr_zpending()
     173int owl_zephyr_zpending(void)
    174174{
    175175#ifdef HAVE_LIBZEPHYR
     
    183183}
    184184
    185 const char *owl_zephyr_get_realm()
     185const char *owl_zephyr_get_realm(void)
    186186{
    187187#ifdef HAVE_LIBZEPHYR
     
    192192}
    193193
    194 const char *owl_zephyr_get_sender()
     194const char *owl_zephyr_get_sender(void)
    195195{
    196196#ifdef HAVE_LIBZEPHYR
     
    316316 * Return -2 if there is a failure from zephyr to load the subscriptions.
    317317 */
    318 int owl_zephyr_loadbarnowldefaultsubs()
     318int owl_zephyr_loadbarnowldefaultsubs(void)
    319319{
    320320#ifdef HAVE_LIBZEPHYR
     
    340340}
    341341
    342 int owl_zephyr_loaddefaultsubs()
     342int owl_zephyr_loaddefaultsubs(void)
    343343{
    344344#ifdef HAVE_LIBZEPHYR
     
    415415}
    416416
    417 void unsuball()
     417void unsuball(void)
    418418{
    419419#if HAVE_LIBZEPHYR
     
    993993#ifdef HAVE_LIBZEPHYR
    994994  char *line, *subsfile;
     995  int linesdeleted;
    995996 
    996997  line=owl_zephyr_makesubline(class, inst, recip);
     
    10031004  }
    10041005 
    1005   owl_util_file_deleteline(subsfile, line, 1);
     1006  linesdeleted = owl_util_file_deleteline(subsfile, line, 1);
     1007  if (linesdeleted > 0) {
     1008    owl_function_makemsg("Subscription removed");
     1009  } else {
     1010    owl_function_error("No subscription present in %s", subsfile);
     1011  }
    10061012  owl_free(subsfile);
    10071013  owl_free(line);
    1008   owl_function_makemsg("Subscription removed");
    10091014#endif
    10101015}
     
    11191124 * free the return.
    11201125 */
    1121 char *owl_zephyr_getsubs()
     1126char *owl_zephyr_getsubs(void)
    11221127{
    11231128#ifdef HAVE_LIBZEPHYR
  • zwrite.c

    r24ccc01 rde3f641  
    154154void owl_zwrite_populate_zsig(owl_zwrite *z)
    155155{
    156   const char *zsigproc, *zsigowlvar, *zsigzvar;
    157   char *ptr;
    158   struct passwd *pw;
    159 
    160156  /* get a zsig, if not given */
    161   if (z->zsig==NULL) {
    162     zsigproc = owl_global_get_zsigproc(&g);
    163     zsigowlvar = owl_global_get_zsig(&g);
    164     zsigzvar = owl_zephyr_get_variable("zwrite-signature");
    165 
    166     if (zsigowlvar && *zsigowlvar) {
    167       z->zsig=owl_validate_utf8(zsigowlvar);
    168     } else if (zsigproc && *zsigproc) {
    169       FILE *file;
    170       char buff[LINE], *openline;
    171      
    172       /* simple hack for now to nuke stderr */
    173 #if OWL_STDERR_REDIR
    174       openline = owl_strdup(zsigproc);
    175 #else
    176       openline = owl_sprintf("%s 2> /dev/null", zsigproc);
    177 #endif
    178       file=popen(openline, "r");
    179       owl_free(openline);
    180       if (!file) {
    181         if (zsigzvar && *zsigzvar) {
    182           z->zsig=owl_validate_utf8(zsigzvar);
    183         }
    184       } else {
    185         z->zsig=owl_malloc(LINE*5);
    186         strcpy(z->zsig, "");
    187         while (fgets(buff, LINE, file)) { /* wrong sizing */
    188           strcat(z->zsig, buff);
    189         }
    190         pclose(file);
    191         if (z->zsig[0] != '\0' && z->zsig[strlen(z->zsig) - 1] == '\n') {
    192           z->zsig[strlen(z->zsig)-1]='\0';
    193         }
    194       }
    195     } else if (zsigzvar) {
    196       z->zsig=owl_validate_utf8(zsigzvar);
    197     } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) {
    198       z->zsig=owl_validate_utf8(pw->pw_gecos);
    199       ptr=strchr(z->zsig, ',');
    200       if (ptr) {
    201         ptr[0]='\0';
    202       }
    203     }
    204   }
     157  if (z->zsig != NULL)
     158    return;
     159
     160  z->zsig = owl_perlconfig_execute(owl_global_get_zsigfunc(&g));
    205161}
    206162
Note: See TracChangeset for help on using the changeset viewer.