Changes in / [d296c9a:8bba1ae]
- Files:
-
- 1 added
- 10 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rde18326 r7d03c8d 35 35 pm_to_blib 36 36 stamp-h1 37 tester 37 38 varstubs.c -
Makefile.am
r9d27ee8 rea7daa8 12 12 zcrypt_SOURCES = zcrypt.c filterproc.c 13 13 14 check_PROGRAMS = tester .bin14 check_PROGRAMS = tester perl_tester 15 15 16 16 barnowl_bin_SOURCES = $(BASE_SRCS) \ … … 19 19 $(GEN_C) $(GEN_H) 20 20 21 man_MANS = doc/barnowl.122 doc_DATA = doc/intro.txt doc/advanced.txt23 24 21 barnowl_bin_LDADD = libfaim/libfaim.a 25 22 26 tester_ bin_SOURCES = $(BASE_SRCS) \23 tester_SOURCES = $(BASE_SRCS) \ 27 24 owl.h owl_perl.h config.h \ 28 25 $(GEN_C) $(GEN_H) \ 29 26 tester.c 30 27 31 tester_bin_LDADD = libfaim/libfaim.a 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 32 36 33 37 TESTS=runtests.sh -
README
raeadc74 r62c91c1 1 1 BarnOwl - owl, with more ponies 2 2 3 Source is freely available from http://github.com/barnowl/barnowl/ 3 Based on owl 2.1.11, by James Kretchmar (http://www.ktools.org) 4 4 5 Based on owl 2.1.11, by James Kretchmar (http://www.ktools.org) 5 This project is a work in progress. 6 We guarantee no stability of form or function. 6 7 7 8 Notes: -
barnowl
rde18326 r9a7b4f2 5 5 6 6 SRCDIR=`dirname "${0}"` 7 EXE="$ 0.bin"7 EXE="$SRCDIR/barnowl.bin" 8 8 9 9 if ! test -x "$EXE"; then -
cmd.c
r1cc9b615 rea7daa8 52 52 cmd = owl_malloc(sizeof(owl_cmd)); 53 53 owl_cmd_create_alias(cmd, alias_from, alias_to); 54 owl_perlconfig_new_command(cmd->name);55 54 owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete); 56 55 return(0); -
commands.c
r987cf3f r9bd51b8 136 136 "Send a local message.\n"), 137 137 138 OWLCMD_ARGS("zcrypt", owl_command_z write, OWL_CTX_INTERACTIVE,138 OWLCMD_ARGS("zcrypt", owl_command_zcrypt, OWL_CTX_INTERACTIVE, 139 139 "send an encrypted zephyr", 140 140 "zcrypt [-n] [-C] [-c class] [-i instance] [-r realm] [-O opcode] [-m <message...>]\n", … … 1911 1911 char *owl_command_zwrite(int argc, const char *const *argv, const char *buff) 1912 1912 { 1913 owl_zwrite *z;1913 owl_zwrite z; 1914 1914 1915 1915 if (!owl_global_is_havezephyr(&g)) { … … 1918 1918 } 1919 1919 /* 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); 1931 1927 1932 1928 if (argc < 2) { 1933 owl_zwrite_delete(z);1934 1929 owl_function_makemsg("Not enough arguments to the zwrite command."); 1935 1930 } else { 1936 owl_function_zwrite_setup( z);1931 owl_function_zwrite_setup(buff); 1937 1932 } 1938 1933 return(NULL); … … 2021 2016 { 2022 2017 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 } 2023 2043 return(NULL); 2024 2044 } -
configure.ac
r04af908 r4751077a 35 35 [with_zephyr=check]) 36 36 37 AC_ARG_WITH([krb4],38 AS_HELP_STRING([--with-krb4],39 [Build with kerberos IV]))40 41 37 AS_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 ]) 57 50 AC_CHECK_LIB([zephyr], [ZGetSender], 58 51 [LIBS="$LIBS -lzephyr" … … 138 131 test "$HAVE_DES_ECB_ENCRYPT"]) 139 132 140 CFLAGS="$CFLAGS -D_XOPEN_SOURCE"141 142 133 AC_SUBST([LIBFAIM_CFLAGS]) 143 134 -
functions.c
r8bba1ae r8bba1ae 222 222 * that. 223 223 */ 224 owl_message *owl_function_make_outgoing_zephyr(const owl_zwrite *z)224 owl_message *owl_function_make_outgoing_zephyr(const char *body, const char *zwriteline, const char *zsig) 225 225 { 226 226 owl_message *m; 227 owl_zwrite zw; 228 229 owl_zwrite_create_from_line(&zw, zwriteline); 230 owl_zwrite_set_zsig(&zw, zsig); 227 231 228 232 /* create the message */ 229 233 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); 231 237 232 238 return(m); … … 289 295 } 290 296 291 static void owl_function_write_setup(const char * noun)297 static void owl_function_write_setup(const char *line, const char *noun, void (*callback)(owl_editwin *)) 292 298 { 293 299 … … 300 306 "End with a dot on a line by itself. ^C will quit.", 301 307 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 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 306 327 /* send a ping if necessary */ 307 328 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); 316 334 } 317 335 318 336 void owl_function_aimwrite_setup(const char *line) 319 337 { 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); 326 339 } 327 340 328 341 void owl_function_loopwrite_setup(void) 329 342 { 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); 334 344 } 335 345 336 346 void 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)); 339 350 } 340 351 … … 342 353 * the message is expected to be set from the zwrite line itself 343 354 */ 344 void owl_function_zwrite(owl_zwrite *z, const char *msg) 345 { 355 void owl_function_zwrite(const char *line, const char *msg) 356 { 357 owl_zwrite z; 358 const char *mymsg; 346 359 owl_message *m; 347 360 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); 350 363 return; 351 364 } 352 365 353 366 /* 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); 355 369 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); 359 373 owl_function_makemsg("Waiting for ack..."); 360 374 361 375 /* If it's personal */ 362 if (owl_zwrite_is_personal( z)) {376 if (owl_zwrite_is_personal(&z)) { 363 377 /* 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)); 365 380 366 381 if (m) { … … 370 385 } 371 386 } 387 388 /* free the zwrite */ 389 owl_zwrite_cleanup(&z); 372 390 } 373 391 … … 375 393 * the message is expected to be set from the zwrite line itself 376 394 */ 377 void owl_function_zcrypt(owl_zwrite *z, const char *msg) 378 { 395 void owl_function_zcrypt(const char *line, const char *msg) 396 { 397 owl_zwrite z; 398 const char *mymsg; 379 399 char *cryptmsg; 380 400 owl_message *m; … … 382 402 char *zcrypt; 383 403 int rv, status; 384 char *old_msg;385 404 386 405 /* 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); 388 408 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); 392 413 393 414 zcrypt = owl_sprintf("%s/zcrypt", owl_get_bindir()); 394 415 argv[0] = "zcrypt"; 395 416 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); 398 419 argv[6] = NULL; 399 420 400 rv = call_filter(zcrypt, argv, owl_zwrite_get_message(z), &cryptmsg, &status);421 rv = call_filter(zcrypt, argv, mymsg, &cryptmsg, &status); 401 422 402 423 owl_free(zcrypt); … … 404 425 if (rv || status) { 405 426 if(cryptmsg) owl_free(cryptmsg); 406 owl_free(old_msg);407 427 owl_function_error("Error in zcrypt, possibly no key found. Message not sent."); 408 428 owl_function_beep(); 429 owl_zwrite_cleanup(&z); 409 430 return; 410 431 } 411 432 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); 416 437 owl_function_makemsg("Waiting for ack..."); 417 438 418 439 /* 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)); 423 444 if (m) { 424 445 owl_global_messagequeue_addmsg(&g, m); … … 430 451 /* free the zwrite */ 431 452 owl_free(cryptmsg); 453 owl_zwrite_cleanup(&z); 432 454 } 433 455 -
global.c
r8bba1ae r8bba1ae 19 19 char hostname[MAXHOSTNAMELEN]; 20 20 char *cd; 21 22 g->malloced=0; 23 g->freed=0; 21 24 22 25 g_type_init(); … … 952 955 g->interrupted = 0; 953 956 } 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 149 149 } 150 150 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 } 151 181 152 182 /* … … 514 544 owl_global_complete_setup(&g); 515 545 516 owl_ global_setup_default_filters(&g);546 owl_setup_default_filters(); 517 547 518 548 /* set the current view */ -
owl.h
r987cf3f r5cc7e5e 347 347 348 348 typedef struct _owl_zwrite { 349 char *cmd;350 349 char *zwriteline; 351 350 char *class; … … 614 613 owl_colorpair_mgr cpmgr; 615 614 pid_t newmsgproc_pid; 615 int malloced, freed; 616 616 owl_regex search_re; 617 617 aim_session_t aimsess; -
perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm
r2f25537 r8278543 20 20 sub to { shift->{to} }; 21 21 sub room { shift->{room} }; 22 sub nick { shift->{nick} };23 22 sub subject { shift->{subject} }; 24 23 sub status { shift->{status} } … … 42 41 sub long_sender { 43 42 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 }51 43 return $self->from; 52 44 } -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r2f25537 raa0a0b5 1241 1241 $muc = $connection->FindMUC(jid => $to); 1242 1242 } 1243 $props{from} = $muc->GetFullJID($from) || $ props{from};1243 $props{from} = $muc->GetFullJID($from) || $nick || $room; 1244 1244 $props{sender} = $nick || $room; 1245 1245 $props{recipient} = $room; -
perl/modules/Twitter/.gitignore
rd27ecf3 r40def31a 1 1 *~ 2 2 blib/ 3 inc/ 3 4 META.yml 4 5 Makefile 5 6 Twitter.par 6 7 pm_to_blib 7 inc/.author -
perl/modules/Twitter/lib/BarnOwl/Message/Twitter.pm
r5d59c1e rf6413c3 17 17 sub service { return (shift->{"service"} || "http://twitter.com"); } 18 18 sub account { return shift->{"account"}; } 19 sub retweeted_by { shift->{retweeted_by}; }20 19 sub long_sender { 21 20 my $self = shift; 22 21 $self->service =~ m#^\s*(.*?://.*?)/.*$#; 23 22 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 29 24 } 30 25 -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
r5d59c1e ra2640485 248 248 next; 249 249 } 250 my $orig = $tweet->{retweeted_status};251 $orig = $tweet unless defined($orig);252 253 250 my $msg = BarnOwl::Message->new( 254 251 type => 'Twitter', 255 sender => $ orig->{user}{screen_name},252 sender => $tweet->{user}{screen_name}, 256 253 recipient => $self->{cfg}->{user} || $self->{user}, 257 254 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}), 261 258 status_id => $tweet->{id}, 262 259 service => $self->{cfg}->{service}, 263 260 account => $self->{cfg}->{account_nickname}, 264 $tweet->{retweeted_status} ? (retweeted_by => $tweet->{user}{screen_name}) : ()265 261 ); 266 262 BarnOwl::queue_message($msg); -
perlconfig.c
r5aa33fd r3aa0522 12 12 /* extern XS(boot_DBI); */ 13 13 14 void owl_perl_xs_init(pTHX) /* noproto */ 14 static void owl_perl_xs_init(pTHX) 15 15 { 16 16 const char *file = __FILE__; … … 363 363 perl_construct(p); 364 364 365 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;366 367 365 owl_global_set_no_have_config(&g); 368 366 -
runtests.sh
r5aa33fd r9f026c1 1 1 #!/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/ 2 HARNESS_PERL=./perl_tester exec prove t/ -
t/00-core-tests.t
r95414bf r1cf3f8d3 1 1 #!/usr/bin/env perl 2 2 use File::Basename; 3 system(dirname($0) . "/../tester" , "--builtin");3 system(dirname($0) . "/../tester"); -
t/mock.pl
r5aa33fd r42ad917 1 use File::Basename; 2 use lib (dirname($0) . '/../perl/lib'); 3 1 4 package BarnOwl; 2 5 use strict; 3 6 use warnings; 7 use Carp; 4 8 5 no warnings 'redefine'; 6 sub debug($) { 9 sub get_data_dir {"."} 10 sub get_config_dir {"."} 11 sub create_style {} 12 13 sub debug { 7 14 warn "[DEBUG] ", shift, "\n" if $ENV{TEST_VERBOSE}; 8 15 } 9 16 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 10 25 1; -
tester.c
r95414bf r3f6555d 1 #define OWL_PERL2 #define WINDOW FAKE_WINDOW3 1 #include "owl.h" 4 #undef WINDOW5 6 2 #include <unistd.h> 7 3 #include <stdlib.h> 8 4 9 #undef instr10 #include <curses.h>11 12 5 owl_global g; 13 6 14 7 int numtests; 15 8 16 int owl_regtest(void);17 9 int owl_util_regtest(void); 18 10 int owl_dict_regtest(void); … … 22 14 int owl_editwin_regtest(void); 23 15 24 extern void owl_perl_xs_init(pTHX);25 26 16 int main(int argc, char **argv, char **env) 27 17 { 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 38 18 /* 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"); 41 21 newterm("xterm", wnull, rnull); 42 22 /* initialize global structures */ 43 23 owl_global_init(&g); 44 24 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 some70 * 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) {97 25 numtests = 0; 98 26 int numfailures=0; … … 110 38 } 111 39 printf("1..%d\n", numtests); 40 41 /* probably not necessary, but tear down the screen */ 42 endwin(); 43 fclose(rnull); 44 fclose(wnull); 112 45 113 46 return(numfailures); -
zcrypt.c
r3c2c7fc r60fcd71 88 88 89 89 cipher_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}, 92 92 }; 93 93 … … 113 113 int mode = M_NONE; 114 114 115 extern int optind, opterr; 116 extern char *optarg; 115 117 char c; 116 118 -
zephyr.c
r987cf3f r922f589 852 852 char *tmpbuff, *myuser, *to; 853 853 owl_message *mout; 854 owl_zwrite *z;855 854 856 855 /* bail if it doesn't look like a message we should reply to. Some … … 888 887 owl_free(to); 889 888 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 894 889 /* 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:"); 896 891 owl_global_messagequeue_addmsg(&g, mout); 897 892 owl_free(tmpbuff); 898 owl_zwrite_delete(z);899 893 #endif 900 894 } -
zwrite.c
r7bfc613 rc230bc1 5 5 #include "owl.h" 6 6 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 17 7 int owl_zwrite_create_from_line(owl_zwrite *z, const char *line) 18 8 { … … 25 15 26 16 /* start with null entries */ 27 z->cmd=NULL;28 17 z->realm=NULL; 29 18 z->class=NULL; … … 46 35 myargc=argc; 47 36 if (myargc && *(myargv[0])!='-') { 48 z->cmd=owl_strdup(myargv[0]);49 37 myargc--; 50 38 myargv++; … … 199 187 } 200 188 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 208 189 void owl_zwrite_set_message(owl_zwrite *z, const char *msg) 209 190 { … … 369 350 } 370 351 371 void owl_zwrite_delete(owl_zwrite *z)372 {373 owl_zwrite_cleanup(z);374 owl_free(z);375 }376 377 352 void owl_zwrite_cleanup(owl_zwrite *z) 378 353 {
Note: See TracChangeset
for help on using the changeset viewer.