Changes in / [d296c9a:8bba1ae]


Ignore:
Files:
1 added
10 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rde18326 r7d03c8d  
    3535pm_to_blib
    3636stamp-h1
     37tester
    3738varstubs.c
  • Makefile.am

    r9d27ee8 rea7daa8  
    1212zcrypt_SOURCES = zcrypt.c filterproc.c
    1313
    14 check_PROGRAMS = tester.bin
     14check_PROGRAMS = tester perl_tester
    1515
    1616barnowl_bin_SOURCES = $(BASE_SRCS) \
     
    1919     $(GEN_C) $(GEN_H)
    2020
    21 man_MANS = doc/barnowl.1
    22 doc_DATA = doc/intro.txt doc/advanced.txt
    23 
    2421barnowl_bin_LDADD = libfaim/libfaim.a
    2522
    26 tester_bin_SOURCES = $(BASE_SRCS) \
     23tester_SOURCES = $(BASE_SRCS) \
    2724     owl.h owl_perl.h config.h \
    2825     $(GEN_C) $(GEN_H) \
    2926     tester.c
    3027
    31 tester_bin_LDADD = libfaim/libfaim.a
     28tester_LDADD = libfaim/libfaim.a
     29
     30perl_tester_SOURCES = $(BASE_SRCS) \
     31     owl.h owl_perl.h config.h \
     32     $(GEN_C) $(GEN_H) \
     33     perl_tester.c
     34
     35perl_tester_LDADD = libfaim/libfaim.a
    3236
    3337TESTS=runtests.sh
  • README

    raeadc74 r62c91c1  
    11BarnOwl - owl, with more ponies
    22
    3 Source is freely available from http://github.com/barnowl/barnowl/
     3Based on owl 2.1.11, by James Kretchmar (http://www.ktools.org)
    44
    5 Based on owl 2.1.11, by James Kretchmar (http://www.ktools.org)
     5This project is a work in progress.
     6We guarantee no stability of form or function.
    67
    78Notes:
  • barnowl

    rde18326 r9a7b4f2  
    55
    66SRCDIR=`dirname "${0}"`
    7 EXE="$0.bin"
     7EXE="$SRCDIR/barnowl.bin"
    88
    99if ! test -x "$EXE"; then
  • cmd.c

    r1cc9b615 rea7daa8  
    5252  cmd = owl_malloc(sizeof(owl_cmd));
    5353  owl_cmd_create_alias(cmd, alias_from, alias_to);
    54   owl_perlconfig_new_command(cmd->name);
    5554  owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete);
    5655  return(0);
  • commands.c

    r987cf3f r9bd51b8  
    136136              "Send a local message.\n"),
    137137
    138   OWLCMD_ARGS("zcrypt", owl_command_zwrite, OWL_CTX_INTERACTIVE,
     138  OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE,
    139139              "send an encrypted zephyr",
    140140              "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [-m <message...>]\n",
     
    19111911char *owl_command_zwrite(int argc, const char *const *argv, const char *buff)
    19121912{
    1913   owl_zwrite *z;
     1913  owl_zwrite z;
    19141914
    19151915  if (!owl_global_is_havezephyr(&g)) {
     
    19181918  }
    19191919  /* check for a zwrite -m */
    1920   z = owl_zwrite_new(buff);
    1921   if (!z) {
    1922     owl_function_error("Error in zwrite arguments");
    1923     return NULL;
    1924   }
    1925 
    1926   if (owl_zwrite_is_message_set(z)) {
    1927     owl_function_zwrite(z, NULL);
    1928     owl_zwrite_delete(z);
    1929     return NULL;
    1930   }
     1920  owl_zwrite_create_from_line(&z, buff);
     1921  if (owl_zwrite_is_message_set(&z)) {
     1922    owl_function_zwrite(buff, NULL);
     1923    owl_zwrite_cleanup(&z);
     1924    return (NULL);
     1925  }
     1926  owl_zwrite_cleanup(&z);
    19311927
    19321928  if (argc < 2) {
    1933     owl_zwrite_delete(z);
    19341929    owl_function_makemsg("Not enough arguments to the zwrite command.");
    19351930  } else {
    1936     owl_function_zwrite_setup(z);
     1931    owl_function_zwrite_setup(buff);
    19371932  }
    19381933  return(NULL);
     
    20212016{
    20222017  owl_function_loopwrite_setup();
     2018  return(NULL);
     2019}
     2020
     2021char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff)
     2022{
     2023  owl_zwrite z;
     2024
     2025  if (!owl_global_is_havezephyr(&g)) {
     2026    owl_function_makemsg("Zephyr is not available");
     2027    return(NULL);
     2028  }
     2029  /* check for a zcrypt -m */
     2030  owl_zwrite_create_from_line(&z, buff);
     2031  if (owl_zwrite_is_message_set(&z)) {
     2032    owl_function_zcrypt(buff, NULL);
     2033    owl_zwrite_cleanup(&z);
     2034    return (NULL);
     2035  }
     2036  owl_zwrite_cleanup(&z);
     2037
     2038  if (argc < 2) {
     2039    owl_function_makemsg("Not enough arguments to the zcrypt command.");
     2040  } else {
     2041    owl_function_zwrite_setup(buff);
     2042  }
    20232043  return(NULL);
    20242044}
  • configure.ac

    r04af908 r4751077a  
    3535  [with_zephyr=check])
    3636
    37 AC_ARG_WITH([krb4],
    38   AS_HELP_STRING([--with-krb4],
    39                  [Build with kerberos IV]))
    40 
    4137AS_IF([test "x$with_zephyr" != xno],
    42   [AS_IF([test "x$with_krb4" != "xno"],
    43    [AC_MSG_CHECKING([for Kerberos IV])
    44     AS_IF([krb5-config krb4 --libs >/dev/null 2>&1],
    45       [AC_MSG_RESULT([yes])
    46        AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV])
    47        CFLAGS="${CFLAGS} `krb5-config krb4 --cflags`"
    48        LIBS="${LIBS} `krb5-config krb4 --libs`"
    49       ],
    50       [AC_MSG_RESULT([no])
    51        AS_IF([test "x$with_krb4" = "xyes"],
    52              [AC_MSG_ERROR([Kerberos IV requested but not found])])
    53        PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
    54        CFLAGS="${CFLAGS} ${LIBCRYPTO_CFLAGS}"
    55        LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
    56      ])])
     38  [AC_MSG_CHECKING([for Kerberos IV])
     39   AS_IF([krb5-config krb4 --libs >/dev/null 2>&1],
     40     [AC_MSG_RESULT([yes])
     41      AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV])
     42      CFLAGS="${CFLAGS} `krb5-config krb4 --cflags`"
     43      LIBS="${LIBS} `krb5-config krb4 --libs`"
     44     ],
     45     [AC_MSG_RESULT([no])
     46      PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto])
     47      CFLAGS="${CFLAGS} ${LIBCRYPTO_CFLAGS}"
     48      LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
     49     ])
    5750   AC_CHECK_LIB([zephyr], [ZGetSender],
    5851   [LIBS="$LIBS -lzephyr"
     
    138131                                 test "$HAVE_DES_ECB_ENCRYPT"])
    139132
    140 CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
    141 
    142133AC_SUBST([LIBFAIM_CFLAGS])
    143134
  • functions.c

    r8bba1ae r8bba1ae  
    222222 * that.
    223223 */
    224 owl_message *owl_function_make_outgoing_zephyr(const owl_zwrite *z)
     224owl_message *owl_function_make_outgoing_zephyr(const char *body, const char *zwriteline, const char *zsig)
    225225{
    226226  owl_message *m;
     227  owl_zwrite zw;
     228
     229  owl_zwrite_create_from_line(&zw, zwriteline);
     230  owl_zwrite_set_zsig(&zw, zsig);
    227231
    228232  /* create the message */
    229233  m=owl_malloc(sizeof(owl_message));
    230   owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z));
     234 
     235  owl_message_create_from_zwrite(m, &zw, body);
     236  owl_zwrite_cleanup(&zw);
    231237
    232238  return(m);
     
    289295}
    290296
    291 static void owl_function_write_setup(const char *noun)
     297static void owl_function_write_setup(const char *line, const char *noun, void (*callback)(owl_editwin *))
    292298{
    293299
     
    300306                         "End with a dot on a line by itself.  ^C will quit.",
    301307                         noun);
    302 }
    303 
    304 void owl_function_zwrite_setup(owl_zwrite *z)
    305 {
     308
     309  owl_function_start_edit_win(line, callback,
     310                              owl_strdup(line),
     311                              owl_free);
     312}
     313
     314void owl_function_zwrite_setup(const char *line)
     315{
     316  owl_zwrite z;
     317  int ret;
     318
     319  /* check the arguments */
     320  ret=owl_zwrite_create_from_line(&z, line);
     321  if (ret) {
     322    owl_function_error("Error in zwrite arguments");
     323    owl_zwrite_cleanup(&z);
     324    return;
     325  }
     326
    306327  /* send a ping if necessary */
    307328  if (owl_global_is_txping(&g)) {
    308     owl_zwrite_send_ping(z);
    309   }
    310 
    311 
    312   owl_function_write_setup("zephyr");
    313   owl_function_start_edit_win(z->zwriteline,
    314                               &owl_callback_zwrite,
    315                               z, (void(*)(void*))owl_zwrite_delete);
     329    owl_zwrite_send_ping(&z);
     330  }
     331  owl_zwrite_cleanup(&z);
     332
     333  owl_function_write_setup(line, "zephyr", &owl_callback_zwrite);
    316334}
    317335
    318336void owl_function_aimwrite_setup(const char *line)
    319337{
    320   owl_function_write_setup("message");
    321   owl_function_start_edit_win(line,
    322                               &owl_callback_aimwrite,
    323                               owl_strdup(line),
    324                               owl_free);
    325 
     338  owl_function_write_setup(line, "message", &owl_callback_aimwrite);
    326339}
    327340
    328341void owl_function_loopwrite_setup(void)
    329342{
    330   owl_function_write_setup("message");
    331   owl_function_start_edit_win("loopwrite",
    332                               &owl_callback_loopwrite,
    333                               "loopwrite", NULL);
     343  owl_function_write_setup("loopwrite", "message", owl_callback_loopwrite);
    334344}
    335345
    336346void owl_callback_zwrite(owl_editwin *e) {
    337   owl_zwrite *z = owl_editwin_get_cbdata(e);
    338   owl_function_zwrite(z, owl_editwin_get_text(e));
     347  char *command = owl_editwin_get_cbdata(e);
     348  owl_function_zwrite(command,
     349                      owl_editwin_get_text(e));
    339350}
    340351
     
    342353 * the message is expected to be set from the zwrite line itself
    343354 */
    344 void owl_function_zwrite(owl_zwrite *z, const char *msg)
    345 {
     355void owl_function_zwrite(const char *line, const char *msg)
     356{
     357  owl_zwrite z;
     358  const char *mymsg;
    346359  owl_message *m;
    347360
    348   if(strcmp(z->cmd, "zcrypt") == 0) {
    349     owl_function_zcrypt(z, msg);
     361  if(!strncmp(line, "zcrypt", strlen("zcrypt"))) {
     362    owl_function_zcrypt(line, msg);
    350363    return;
    351364  }
    352365
    353366  /* create the zwrite and send the message */
    354   owl_zwrite_populate_zsig(z);
     367  owl_zwrite_create_from_line(&z, line);
     368  owl_zwrite_populate_zsig(&z);
    355369  if (msg) {
    356     owl_zwrite_set_message(z, msg);
    357   }
    358   owl_zwrite_send_message(z);
     370    owl_zwrite_set_message(&z, msg);
     371  }
     372  owl_zwrite_send_message(&z);
    359373  owl_function_makemsg("Waiting for ack...");
    360374
    361375  /* If it's personal */
    362   if (owl_zwrite_is_personal(z)) {
     376  if (owl_zwrite_is_personal(&z)) {
    363377    /* create the outgoing message */
    364     m=owl_function_make_outgoing_zephyr(z);
     378    mymsg=owl_zwrite_get_message(&z);
     379    m=owl_function_make_outgoing_zephyr(mymsg, line, owl_zwrite_get_zsig(&z));
    365380
    366381    if (m) {
     
    370385    }
    371386  }
     387
     388  /* free the zwrite */
     389  owl_zwrite_cleanup(&z);
    372390}
    373391
     
    375393 * the message is expected to be set from the zwrite line itself
    376394 */
    377 void owl_function_zcrypt(owl_zwrite *z, const char *msg)
    378 {
     395void owl_function_zcrypt(const char *line, const char *msg)
     396{
     397  owl_zwrite z;
     398  const char *mymsg;
    379399  char *cryptmsg;
    380400  owl_message *m;
     
    382402  char *zcrypt;
    383403  int rv, status;
    384   char *old_msg;
    385404
    386405  /* create the zwrite and send the message */
    387   owl_zwrite_populate_zsig(z);
     406  owl_zwrite_create_from_line(&z, line);
     407  owl_zwrite_populate_zsig(&z);
    388408  if (msg) {
    389     owl_zwrite_set_message(z, msg);
    390   }
    391   old_msg = owl_strdup(owl_zwrite_get_message(z));
     409    owl_zwrite_set_message(&z, msg);
     410  }
     411
     412  mymsg=owl_zwrite_get_message(&z);
    392413
    393414  zcrypt = owl_sprintf("%s/zcrypt", owl_get_bindir());
    394415  argv[0] = "zcrypt";
    395416  argv[1] = "-E";
    396   argv[2] = "-c"; argv[3] = owl_zwrite_get_class(z);
    397   argv[4] = "-i"; argv[5] = owl_zwrite_get_instance(z);
     417  argv[2] = "-c"; argv[3] = owl_zwrite_get_class(&z);
     418  argv[4] = "-i"; argv[5] = owl_zwrite_get_instance(&z);
    398419  argv[6] = NULL;
    399420
    400   rv = call_filter(zcrypt, argv, owl_zwrite_get_message(z), &cryptmsg, &status);
     421  rv = call_filter(zcrypt, argv, mymsg, &cryptmsg, &status);
    401422
    402423  owl_free(zcrypt);
     
    404425  if (rv || status) {
    405426    if(cryptmsg) owl_free(cryptmsg);
    406     owl_free(old_msg);
    407427    owl_function_error("Error in zcrypt, possibly no key found.  Message not sent.");
    408428    owl_function_beep();
     429    owl_zwrite_cleanup(&z);
    409430    return;
    410431  }
    411432
    412   owl_zwrite_set_message_raw(z, cryptmsg);
    413   owl_zwrite_set_opcode(z, "crypt");
    414 
    415   owl_zwrite_send_message(z);
     433  owl_zwrite_set_message(&z, cryptmsg);
     434  owl_zwrite_set_opcode(&z, "crypt");
     435   
     436  owl_zwrite_send_message(&z);
    416437  owl_function_makemsg("Waiting for ack...");
    417438
    418439  /* If it's personal */
    419   if (owl_zwrite_is_personal(z)) {
    420     /* Create the outgoing message. Restore the un-crypted message for display. */
    421     owl_zwrite_set_message_raw(z, old_msg);
    422     m=owl_function_make_outgoing_zephyr(z);
     440  if (owl_zwrite_is_personal(&z)) {
     441    /* create the outgoing message */
     442    mymsg=owl_zwrite_get_message(&z);
     443    m=owl_function_make_outgoing_zephyr(mymsg, line, owl_zwrite_get_zsig(&z));
    423444    if (m) {
    424445      owl_global_messagequeue_addmsg(&g, m);
     
    430451  /* free the zwrite */
    431452  owl_free(cryptmsg);
     453  owl_zwrite_cleanup(&z);
    432454}
    433455
  • global.c

    r8bba1ae r8bba1ae  
    1919  char hostname[MAXHOSTNAMELEN];
    2020  char *cd;
     21
     22  g->malloced=0;
     23  g->freed=0;
    2124
    2225  g_type_init();
     
    952955  g->interrupted = 0;
    953956}
    954 
    955 void owl_global_setup_default_filters(owl_global *g)
    956 {
    957   int i;
    958   static const struct {
    959     const char *name;
    960     const char *desc;
    961   } filters[] = {
    962     { "personal",
    963       "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message  ) )" },
    964     { "trash",
    965       "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },
    966     { "wordwrap", "not ( type ^admin$ or type ^zephyr$ )" },
    967     { "ping", "opcode ^ping$" },
    968     { "auto", "opcode ^auto$" },
    969     { "login", "not login ^none$" },
    970     { "reply-lockout", "class ^noc or class ^mail$" },
    971     { "out", "direction ^out$" },
    972     { "aim", "type ^aim$" },
    973     { "zephyr", "type ^zephyr$" },
    974     { "none", "false" },
    975     { "all", "true" },
    976     { NULL, NULL }
    977   };
    978 
    979   owl_function_debugmsg("startup: creating default filters");
    980 
    981   for (i = 0; filters[i].name != NULL; i++)
    982     owl_global_add_filter(g, owl_filter_new_fromstring(filters[i].name,
    983                                                        filters[i].desc));
    984 }
  • owl.c

    r0be3efd r0be3efd  
    149149}
    150150
     151static void owl_setup_default_filters(void)
     152{
     153  int i;
     154  static const struct {
     155    const char *name;
     156    const char *desc;
     157  } filters[] = {
     158    { "personal",
     159      "isprivate ^true$ and ( not type ^zephyr$ or ( class ^message  ) )" },
     160    { "trash",
     161      "class ^mail$ or opcode ^ping$ or type ^admin$ or ( not login ^none$ )" },
     162    { "wordwrap", "not ( type ^admin$ or type ^zephyr$ )" },
     163    { "ping", "opcode ^ping$" },
     164    { "auto", "opcode ^auto$" },
     165    { "login", "not login ^none$" },
     166    { "reply-lockout", "class ^noc or class ^mail$" },
     167    { "out", "direction ^out$" },
     168    { "aim", "type ^aim$" },
     169    { "zephyr", "type ^zephyr$" },
     170    { "none", "false" },
     171    { "all", "true" },
     172    { NULL, NULL }
     173  };
     174
     175  owl_function_debugmsg("startup: creating default filters");
     176
     177  for (i = 0; filters[i].name != NULL; i++)
     178    owl_global_add_filter(&g, owl_filter_new_fromstring(filters[i].name,
     179                                                        filters[i].desc));
     180}
    151181
    152182/*
     
    514544  owl_global_complete_setup(&g);
    515545
    516   owl_global_setup_default_filters(&g);
     546  owl_setup_default_filters();
    517547
    518548  /* set the current view */
  • owl.h

    r987cf3f r5cc7e5e  
    347347
    348348typedef struct _owl_zwrite {
    349   char *cmd;
    350349  char *zwriteline;
    351350  char *class;
     
    614613  owl_colorpair_mgr cpmgr;
    615614  pid_t newmsgproc_pid;
     615  int malloced, freed;
    616616  owl_regex search_re;
    617617  aim_session_t aimsess;
  • perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm

    r2f25537 r8278543  
    2020sub to { shift->{to} };
    2121sub room { shift->{room} };
    22 sub nick { shift->{nick} };
    2322sub subject { shift->{subject} };
    2423sub status { shift->{status} }
     
    4241sub long_sender {
    4342    my $self = shift;
    44     if ($self->jtype eq 'groupchat' && $self->nick) {
    45         my $from_jid = Net::Jabber::JID->new($self->from);
    46         if ($from_jid->GetJID('base') eq $self->room &&
    47             $from_jid->GetResource() eq $self->nick) {
    48             return $self->nick;
    49         }
    50     }
    5143    return $self->from;
    5244}
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r2f25537 raa0a0b5  
    12411241            $muc = $connection->FindMUC(jid => $to);
    12421242        }
    1243         $props{from} = $muc->GetFullJID($from) || $props{from};
     1243        $props{from} = $muc->GetFullJID($from) || $nick || $room;
    12441244        $props{sender} = $nick || $room;
    12451245        $props{recipient} = $room;
  • perl/modules/Twitter/.gitignore

    rd27ecf3 r40def31a  
    11*~
    22blib/
     3inc/
    34META.yml
    45Makefile
    56Twitter.par
    67pm_to_blib
    7 inc/.author
  • perl/modules/Twitter/lib/BarnOwl/Message/Twitter.pm

    r5d59c1e rf6413c3  
    1717sub service { return (shift->{"service"} || "http://twitter.com"); }
    1818sub account { return shift->{"account"}; }
    19 sub retweeted_by { shift->{retweeted_by}; }
    2019sub long_sender {
    2120    my $self = shift;
    2221    $self->service =~ m#^\s*(.*?://.*?)/.*$#;
    2322    my $service = $1 || $self->service;
    24     my $long = $service . '/' . $self->sender;
    25     if ($self->retweeted_by) {
    26         $long = "(retweeted by " . $self->retweeted_by . ") $long";
    27     }
    28     return $long;
     23    return $service . '/' . $self->sender
    2924}
    3025
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm

    r5d59c1e ra2640485  
    248248                next;
    249249            }
    250             my $orig = $tweet->{retweeted_status};
    251             $orig = $tweet unless defined($orig);
    252 
    253250            my $msg = BarnOwl::Message->new(
    254251                type      => 'Twitter',
    255                 sender    => $orig->{user}{screen_name},
     252                sender    => $tweet->{user}{screen_name},
    256253                recipient => $self->{cfg}->{user} || $self->{user},
    257254                direction => 'in',
    258                 source    => decode_entities($orig->{source}),
    259                 location  => decode_entities($orig->{user}{location}||""),
    260                 body      => decode_entities($orig->{text}),
     255                source    => decode_entities($tweet->{source}),
     256                location  => decode_entities($tweet->{user}{location}||""),
     257                body      => decode_entities($tweet->{text}),
    261258                status_id => $tweet->{id},
    262259                service   => $self->{cfg}->{service},
    263260                account   => $self->{cfg}->{account_nickname},
    264                 $tweet->{retweeted_status} ? (retweeted_by => $tweet->{user}{screen_name}) : ()
    265261               );
    266262            BarnOwl::queue_message($msg);
  • perlconfig.c

    r5aa33fd r3aa0522  
    1212/* extern XS(boot_DBI); */
    1313
    14 void owl_perl_xs_init(pTHX) /* noproto */
     14static void owl_perl_xs_init(pTHX)
    1515{
    1616  const char *file = __FILE__;
     
    363363  perl_construct(p);
    364364
    365   PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
    366 
    367365  owl_global_set_no_have_config(&g);
    368366
  • runtests.sh

    r5aa33fd r9f026c1  
    11#!/bin/sh
    2 SRCDIR=`dirname "${0}"`
    3 
    4 export BARNOWL_DATA_DIR="$SRCDIR/perl/"
    5 export BARNOWL_BIN_DIR="$SRCDIR/"
    6 
    7 HARNESS_PERL=./tester exec prove t/
     2HARNESS_PERL=./perl_tester exec prove t/
  • t/00-core-tests.t

    r95414bf r1cf3f8d3  
    11#!/usr/bin/env perl
    22use File::Basename;
    3 system(dirname($0) . "/../tester", "--builtin");
     3system(dirname($0) . "/../tester");
  • t/mock.pl

    r5aa33fd r42ad917  
     1use File::Basename;
     2use lib (dirname($0) . '/../perl/lib');
     3
    14package BarnOwl;
    25use strict;
    36use warnings;
     7use Carp;
    48
    5 no warnings 'redefine';
    6 sub debug($) {
     9sub get_data_dir {"."}
     10sub get_config_dir {"."}
     11sub create_style {}
     12
     13sub debug {
    714    warn "[DEBUG] ", shift, "\n" if $ENV{TEST_VERBOSE};
    815}
    916
     17sub BarnOwl::Internal::new_command {}
     18sub BarnOwl::Internal::new_variable_bool {}
     19sub BarnOwl::Internal::new_variable_int {}
     20sub BarnOwl::Internal::new_variable_string {}
     21sub BarnOwl::Editwin::save_excursion(&) {}
     22
     23use BarnOwl;
     24
    10251;
  • tester.c

    r95414bf r3f6555d  
    1 #define OWL_PERL
    2 #define WINDOW FAKE_WINDOW
    31#include "owl.h"
    4 #undef WINDOW
    5 
    62#include <unistd.h>
    73#include <stdlib.h>
    84
    9 #undef instr
    10 #include <curses.h>
    11 
    125owl_global g;
    136
    147int numtests;
    158
    16 int owl_regtest(void);
    179int owl_util_regtest(void);
    1810int owl_dict_regtest(void);
     
    2214int owl_editwin_regtest(void);
    2315
    24 extern void owl_perl_xs_init(pTHX);
    25 
    2616int main(int argc, char **argv, char **env)
    2717{
    28   FILE *rnull;
    29   FILE *wnull;
    30   char *perlerr;
    31   int status = 0;
    32 
    33   if (argc <= 1) {
    34     fprintf(stderr, "Usage: %s --builtin|TEST.t|-le CODE\n", argv[0]);
    35     return 1;
    36   }
    37 
    3818  /* initialize a fake ncurses, detached from std{in,out} */
    39   wnull = fopen("/dev/null", "w");
    40   rnull = fopen("/dev/null", "r");
     19  FILE *rnull = fopen("/dev/null", "r");
     20  FILE *wnull = fopen("/dev/null", "w");
    4121  newterm("xterm", wnull, rnull);
    4222  /* initialize global structures */
    4323  owl_global_init(&g);
    4424
    45   perlerr = owl_perlconfig_initperl(NULL, &argc, &argv, &env);
    46   if (perlerr) {
    47     endwin();
    48     fprintf(stderr, "Internal perl error: %s\n", perlerr);
    49     status = 1;
    50     goto out;
    51   }
    52 
    53   owl_global_complete_setup(&g);
    54   owl_global_setup_default_filters(&g);
    55 
    56   owl_view_create(owl_global_get_current_view(&g), "main",
    57                   owl_global_get_filter(&g, "all"),
    58                   owl_global_get_style_by_name(&g, "default"));
    59 
    60   owl_function_firstmsg();
    61 
    62   ENTER;
    63   SAVETMPS;
    64 
    65   if (strcmp(argv[1], "--builtin") == 0) {
    66     status = owl_regtest();
    67   } else if (strcmp(argv[1], "-le") == 0 && argc > 2) {
    68     /*
    69      * 'prove' runs its harness perl with '-le CODE' to get some
    70      * information out.
    71      */
    72     moreswitches("l");
    73     eval_pv(argv[2], true);
    74   } else {
    75     sv_setpv(get_sv("0", false), argv[1]);
    76     sv_setpv(get_sv("main::test_prog", TRUE), argv[1]);
    77 
    78     eval_pv("do $main::test_prog; die($@) if($@)", true);
    79   }
    80 
    81   status = 0;
    82 
    83   FREETMPS;
    84   LEAVE;
    85 
    86  out:
    87   perl_destruct(owl_global_get_perlinterp(&g));
    88   perl_free(owl_global_get_perlinterp(&g));
    89   /* probably not necessary, but tear down the screen */
    90   endwin();
    91   fclose(rnull);
    92   fclose(wnull);
    93   return status;
    94 }
    95 
    96 int owl_regtest(void) {
    9725  numtests = 0;
    9826  int numfailures=0;
     
    11038  }
    11139  printf("1..%d\n", numtests);
     40
     41  /* probably not necessary, but tear down the screen */
     42  endwin();
     43  fclose(rnull);
     44  fclose(wnull);
    11245
    11346  return(numfailures);
  • zcrypt.c

    r3c2c7fc r60fcd71  
    8888
    8989cipher_pair ciphers[NCIPHER] = {
    90   [CIPHER_DES] = { do_encrypt_des, do_decrypt_des},
    91   [CIPHER_AES] = { do_encrypt_aes, do_decrypt_aes},
     90  [CIPHER_DES] { do_encrypt_des, do_decrypt_des},
     91  [CIPHER_AES] { do_encrypt_aes, do_decrypt_aes},
    9292};
    9393
     
    113113  int mode = M_NONE;
    114114
     115  extern int optind, opterr;
     116  extern char *optarg;
    115117  char c;
    116118
  • zephyr.c

    r987cf3f r922f589  
    852852  char *tmpbuff, *myuser, *to;
    853853  owl_message *mout;
    854   owl_zwrite *z;
    855854 
    856855  /* bail if it doesn't look like a message we should reply to.  Some
     
    888887  owl_free(to);
    889888
    890   z = owl_zwrite_new(tmpbuff);
    891   owl_zwrite_set_message(z, owl_global_get_zaway_msg(&g));
    892   owl_zwrite_set_zsig(z, "Automated reply:");
    893 
    894889  /* display the message as an admin message in the receive window */
    895   mout=owl_function_make_outgoing_zephyr(z);
     890  mout=owl_function_make_outgoing_zephyr(owl_global_get_zaway_msg(&g), tmpbuff, "Automated reply:");
    896891  owl_global_messagequeue_addmsg(&g, mout);
    897892  owl_free(tmpbuff);
    898   owl_zwrite_delete(z);
    899893#endif
    900894}
  • zwrite.c

    r7bfc613 rc230bc1  
    55#include "owl.h"
    66
    7 owl_zwrite *owl_zwrite_new(const char *line)
    8 {
    9   owl_zwrite *z = owl_malloc(sizeof *z);
    10   if (owl_zwrite_create_from_line(z, line) < 0) {
    11     owl_zwrite_delete(z);
    12     return NULL;
    13   }
    14   return z;
    15 }
    16 
    177int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)
    188{
     
    2515 
    2616  /* start with null entries */
    27   z->cmd=NULL;
    2817  z->realm=NULL;
    2918  z->class=NULL;
     
    4635  myargc=argc;
    4736  if (myargc && *(myargv[0])!='-') {
    48     z->cmd=owl_strdup(myargv[0]);
    4937    myargc--;
    5038    myargv++;
     
    199187}
    200188
    201 /* Set the message with no post-processing*/
    202 void owl_zwrite_set_message_raw(owl_zwrite *z, const char *msg)
    203 {
    204   if (z->message) owl_free(z->message);
    205   z->message = owl_validate_utf8(msg);
    206 }
    207 
    208189void owl_zwrite_set_message(owl_zwrite *z, const char *msg)
    209190{
     
    369350}
    370351
    371 void owl_zwrite_delete(owl_zwrite *z)
    372 {
    373   owl_zwrite_cleanup(z);
    374   owl_free(z);
    375 }
    376 
    377352void owl_zwrite_cleanup(owl_zwrite *z)
    378353{
Note: See TracChangeset for help on using the changeset viewer.