Changes in / [8bba1ae:d296c9a]


Ignore:
Files:
10 added
1 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

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

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

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

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

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

    r9bd51b8 r987cf3f  
    136136              "Send a local message.\n"),
    137137
    138   OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE,
     138  OWLCMD_ARGS("zcrypt", owl_command_zwrite, 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   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);
     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  }
    19271931
    19281932  if (argc < 2) {
     1933    owl_zwrite_delete(z);
    19291934    owl_function_makemsg("Not enough arguments to the zwrite command.");
    19301935  } else {
    1931     owl_function_zwrite_setup(buff);
     1936    owl_function_zwrite_setup(z);
    19321937  }
    19331938  return(NULL);
     
    20162021{
    20172022  owl_function_loopwrite_setup();
    2018   return(NULL);
    2019 }
    2020 
    2021 char *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   }
    20432023  return(NULL);
    20442024}
  • configure.ac

    r4751077a r04af908  
    3535  [with_zephyr=check])
    3636
     37AC_ARG_WITH([krb4],
     38  AS_HELP_STRING([--with-krb4],
     39                 [Build with kerberos IV]))
     40
    3741AS_IF([test "x$with_zephyr" != xno],
    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      ])
     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     ])])
    5057   AC_CHECK_LIB([zephyr], [ZGetSender],
    5158   [LIBS="$LIBS -lzephyr"
     
    131138                                 test "$HAVE_DES_ECB_ENCRYPT"])
    132139
     140CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
     141
    133142AC_SUBST([LIBFAIM_CFLAGS])
    134143
  • functions.c

    r8bba1ae r8bba1ae  
    222222 * that.
    223223 */
    224 owl_message *owl_function_make_outgoing_zephyr(const char *body, const char *zwriteline, const char *zsig)
     224owl_message *owl_function_make_outgoing_zephyr(const owl_zwrite *z)
    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);
    231227
    232228  /* create the message */
    233229  m=owl_malloc(sizeof(owl_message));
    234  
    235   owl_message_create_from_zwrite(m, &zw, body);
    236   owl_zwrite_cleanup(&zw);
     230  owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z));
    237231
    238232  return(m);
     
    295289}
    296290
    297 static void owl_function_write_setup(const char *line, const char *noun, void (*callback)(owl_editwin *))
     291static void owl_function_write_setup(const char *noun)
    298292{
    299293
     
    306300                         "End with a dot on a line by itself.  ^C will quit.",
    307301                         noun);
    308 
    309   owl_function_start_edit_win(line, callback,
     302}
     303
     304void owl_function_zwrite_setup(owl_zwrite *z)
     305{
     306  /* send a ping if necessary */
     307  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);
     316}
     317
     318void owl_function_aimwrite_setup(const char *line)
     319{
     320  owl_function_write_setup("message");
     321  owl_function_start_edit_win(line,
     322                              &owl_callback_aimwrite,
    310323                              owl_strdup(line),
    311324                              owl_free);
    312 }
    313 
    314 void 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 
    327   /* send a ping if necessary */
    328   if (owl_global_is_txping(&g)) {
    329     owl_zwrite_send_ping(&z);
    330   }
    331   owl_zwrite_cleanup(&z);
    332 
    333   owl_function_write_setup(line, "zephyr", &owl_callback_zwrite);
    334 }
    335 
    336 void owl_function_aimwrite_setup(const char *line)
    337 {
    338   owl_function_write_setup(line, "message", &owl_callback_aimwrite);
     325
    339326}
    340327
    341328void owl_function_loopwrite_setup(void)
    342329{
    343   owl_function_write_setup("loopwrite", "message", owl_callback_loopwrite);
     330  owl_function_write_setup("message");
     331  owl_function_start_edit_win("loopwrite",
     332                              &owl_callback_loopwrite,
     333                              "loopwrite", NULL);
    344334}
    345335
    346336void owl_callback_zwrite(owl_editwin *e) {
    347   char *command = owl_editwin_get_cbdata(e);
    348   owl_function_zwrite(command,
    349                       owl_editwin_get_text(e));
     337  owl_zwrite *z = owl_editwin_get_cbdata(e);
     338  owl_function_zwrite(z, owl_editwin_get_text(e));
    350339}
    351340
     
    353342 * the message is expected to be set from the zwrite line itself
    354343 */
    355 void owl_function_zwrite(const char *line, const char *msg)
    356 {
    357   owl_zwrite z;
    358   const char *mymsg;
     344void owl_function_zwrite(owl_zwrite *z, const char *msg)
     345{
    359346  owl_message *m;
    360347
    361   if(!strncmp(line, "zcrypt", strlen("zcrypt"))) {
    362     owl_function_zcrypt(line, msg);
     348  if(strcmp(z->cmd, "zcrypt") == 0) {
     349    owl_function_zcrypt(z, msg);
    363350    return;
    364351  }
    365352
    366353  /* create the zwrite and send the message */
    367   owl_zwrite_create_from_line(&z, line);
    368   owl_zwrite_populate_zsig(&z);
     354  owl_zwrite_populate_zsig(z);
    369355  if (msg) {
    370     owl_zwrite_set_message(&z, msg);
    371   }
    372   owl_zwrite_send_message(&z);
     356    owl_zwrite_set_message(z, msg);
     357  }
     358  owl_zwrite_send_message(z);
    373359  owl_function_makemsg("Waiting for ack...");
    374360
    375361  /* If it's personal */
    376   if (owl_zwrite_is_personal(&z)) {
     362  if (owl_zwrite_is_personal(z)) {
    377363    /* create the outgoing message */
    378     mymsg=owl_zwrite_get_message(&z);
    379     m=owl_function_make_outgoing_zephyr(mymsg, line, owl_zwrite_get_zsig(&z));
     364    m=owl_function_make_outgoing_zephyr(z);
    380365
    381366    if (m) {
     
    385370    }
    386371  }
    387 
    388   /* free the zwrite */
    389   owl_zwrite_cleanup(&z);
    390372}
    391373
     
    393375 * the message is expected to be set from the zwrite line itself
    394376 */
    395 void owl_function_zcrypt(const char *line, const char *msg)
    396 {
    397   owl_zwrite z;
    398   const char *mymsg;
     377void owl_function_zcrypt(owl_zwrite *z, const char *msg)
     378{
    399379  char *cryptmsg;
    400380  owl_message *m;
     
    402382  char *zcrypt;
    403383  int rv, status;
     384  char *old_msg;
    404385
    405386  /* create the zwrite and send the message */
    406   owl_zwrite_create_from_line(&z, line);
    407   owl_zwrite_populate_zsig(&z);
     387  owl_zwrite_populate_zsig(z);
    408388  if (msg) {
    409     owl_zwrite_set_message(&z, msg);
    410   }
    411 
    412   mymsg=owl_zwrite_get_message(&z);
     389    owl_zwrite_set_message(z, msg);
     390  }
     391  old_msg = owl_strdup(owl_zwrite_get_message(z));
    413392
    414393  zcrypt = owl_sprintf("%s/zcrypt", owl_get_bindir());
    415394  argv[0] = "zcrypt";
    416395  argv[1] = "-E";
    417   argv[2] = "-c"; argv[3] = owl_zwrite_get_class(&z);
    418   argv[4] = "-i"; argv[5] = owl_zwrite_get_instance(&z);
     396  argv[2] = "-c"; argv[3] = owl_zwrite_get_class(z);
     397  argv[4] = "-i"; argv[5] = owl_zwrite_get_instance(z);
    419398  argv[6] = NULL;
    420399
    421   rv = call_filter(zcrypt, argv, mymsg, &cryptmsg, &status);
     400  rv = call_filter(zcrypt, argv, owl_zwrite_get_message(z), &cryptmsg, &status);
    422401
    423402  owl_free(zcrypt);
     
    425404  if (rv || status) {
    426405    if(cryptmsg) owl_free(cryptmsg);
     406    owl_free(old_msg);
    427407    owl_function_error("Error in zcrypt, possibly no key found.  Message not sent.");
    428408    owl_function_beep();
    429     owl_zwrite_cleanup(&z);
    430409    return;
    431410  }
    432411
    433   owl_zwrite_set_message(&z, cryptmsg);
    434   owl_zwrite_set_opcode(&z, "crypt");
    435    
    436   owl_zwrite_send_message(&z);
     412  owl_zwrite_set_message_raw(z, cryptmsg);
     413  owl_zwrite_set_opcode(z, "crypt");
     414
     415  owl_zwrite_send_message(z);
    437416  owl_function_makemsg("Waiting for ack...");
    438417
    439418  /* If it's personal */
    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));
     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);
    444423    if (m) {
    445424      owl_global_messagequeue_addmsg(&g, m);
     
    451430  /* free the zwrite */
    452431  owl_free(cryptmsg);
    453   owl_zwrite_cleanup(&z);
    454432}
    455433
  • global.c

    r8bba1ae r8bba1ae  
    1919  char hostname[MAXHOSTNAMELEN];
    2020  char *cd;
    21 
    22   g->malloced=0;
    23   g->freed=0;
    2421
    2522  g_type_init();
     
    955952  g->interrupted = 0;
    956953}
     954
     955void 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
    151 static 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 }
    181151
    182152/*
     
    544514  owl_global_complete_setup(&g);
    545515
    546   owl_setup_default_filters();
     516  owl_global_setup_default_filters(&g);
    547517
    548518  /* set the current view */
  • owl.h

    r5cc7e5e r987cf3f  
    347347
    348348typedef struct _owl_zwrite {
     349  char *cmd;
    349350  char *zwriteline;
    350351  char *class;
     
    613614  owl_colorpair_mgr cpmgr;
    614615  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

    r8278543 r2f25537  
    2020sub to { shift->{to} };
    2121sub room { shift->{room} };
     22sub nick { shift->{nick} };
    2223sub subject { shift->{subject} };
    2324sub status { shift->{status} }
     
    4142sub long_sender {
    4243    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    }
    4351    return $self->from;
    4452}
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

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

    r40def31a rd27ecf3  
    11*~
    22blib/
    3 inc/
    43META.yml
    54Makefile
    65Twitter.par
    76pm_to_blib
     7inc/.author
  • perl/modules/Twitter/lib/BarnOwl/Message/Twitter.pm

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

    ra2640485 r5d59c1e  
    248248                next;
    249249            }
     250            my $orig = $tweet->{retweeted_status};
     251            $orig = $tweet unless defined($orig);
     252
    250253            my $msg = BarnOwl::Message->new(
    251254                type      => 'Twitter',
    252                 sender    => $tweet->{user}{screen_name},
     255                sender    => $orig->{user}{screen_name},
    253256                recipient => $self->{cfg}->{user} || $self->{user},
    254257                direction => 'in',
    255                 source    => decode_entities($tweet->{source}),
    256                 location  => decode_entities($tweet->{user}{location}||""),
    257                 body      => decode_entities($tweet->{text}),
     258                source    => decode_entities($orig->{source}),
     259                location  => decode_entities($orig->{user}{location}||""),
     260                body      => decode_entities($orig->{text}),
    258261                status_id => $tweet->{id},
    259262                service   => $self->{cfg}->{service},
    260263                account   => $self->{cfg}->{account_nickname},
     264                $tweet->{retweeted_status} ? (retweeted_by => $tweet->{user}{screen_name}) : ()
    261265               );
    262266            BarnOwl::queue_message($msg);
  • perlconfig.c

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

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

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

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

    r3f6555d r95414bf  
     1#define OWL_PERL
     2#define WINDOW FAKE_WINDOW
    13#include "owl.h"
     4#undef WINDOW
     5
    26#include <unistd.h>
    37#include <stdlib.h>
    48
     9#undef instr
     10#include <curses.h>
     11
    512owl_global g;
    613
    714int numtests;
    815
     16int owl_regtest(void);
    917int owl_util_regtest(void);
    1018int owl_dict_regtest(void);
     
    1422int owl_editwin_regtest(void);
    1523
     24extern void owl_perl_xs_init(pTHX);
     25
    1626int main(int argc, char **argv, char **env)
    1727{
     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
    1838  /* initialize a fake ncurses, detached from std{in,out} */
    19   FILE *rnull = fopen("/dev/null", "r");
    20   FILE *wnull = fopen("/dev/null", "w");
     39  wnull = fopen("/dev/null", "w");
     40  rnull = fopen("/dev/null", "r");
    2141  newterm("xterm", wnull, rnull);
    2242  /* initialize global structures */
    2343  owl_global_init(&g);
    2444
     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
     96int owl_regtest(void) {
    2597  numtests = 0;
    2698  int numfailures=0;
     
    38110  }
    39111  printf("1..%d\n", numtests);
    40 
    41   /* probably not necessary, but tear down the screen */
    42   endwin();
    43   fclose(rnull);
    44   fclose(wnull);
    45112
    46113  return(numfailures);
  • zcrypt.c

    r60fcd71 r3c2c7fc  
    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;
    117115  char c;
    118116
  • zephyr.c

    r922f589 r987cf3f  
    852852  char *tmpbuff, *myuser, *to;
    853853  owl_message *mout;
     854  owl_zwrite *z;
    854855 
    855856  /* bail if it doesn't look like a message we should reply to.  Some
     
    887888  owl_free(to);
    888889
     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
    889894  /* display the message as an admin message in the receive window */
    890   mout=owl_function_make_outgoing_zephyr(owl_global_get_zaway_msg(&g), tmpbuff, "Automated reply:");
     895  mout=owl_function_make_outgoing_zephyr(z);
    891896  owl_global_messagequeue_addmsg(&g, mout);
    892897  owl_free(tmpbuff);
     898  owl_zwrite_delete(z);
    893899#endif
    894900}
  • zwrite.c

    rc230bc1 r7bfc613  
    55#include "owl.h"
    66
     7owl_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
    717int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)
    818{
     
    1525 
    1626  /* start with null entries */
     27  z->cmd=NULL;
    1728  z->realm=NULL;
    1829  z->class=NULL;
     
    3546  myargc=argc;
    3647  if (myargc && *(myargv[0])!='-') {
     48    z->cmd=owl_strdup(myargv[0]);
    3749    myargc--;
    3850    myargv++;
     
    187199}
    188200
     201/* Set the message with no post-processing*/
     202void 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
    189208void owl_zwrite_set_message(owl_zwrite *z, const char *msg)
    190209{
     
    350369}
    351370
     371void owl_zwrite_delete(owl_zwrite *z)
     372{
     373  owl_zwrite_cleanup(z);
     374  owl_free(z);
     375}
     376
    352377void owl_zwrite_cleanup(owl_zwrite *z)
    353378{
Note: See TracChangeset for help on using the changeset viewer.